History

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

Pull networking fixes from Jakub Kicinski: - fix failure to add bond interfaces to a bridge, the offload-handling code was too defensive there and recent refactoring unearthed that. Users complained (Ido) - fix unnecessarily reflecting ECN bits within TOS values / QoS marking in TCP ACK and reset packets (Wei) - fix a deadlock with bpf iterator. Hopefully we're in the clear on this front now... (Yonghong) - BPF fix for clobbering r2 in bpf_gen_ld_abs (Daniel) - fix AQL on mt76 devices with FW rate control and add a couple of AQL issues in mac80211 code (Felix) - fix authentication issue with mwifiex (Maximilian) - WiFi connectivity fix: revert IGTK support in ti/wlcore (Mauro) - fix exception handling for multipath routes via same device (David Ahern) - revert back to a BH spin lock flavor for nsid_lock: there are paths which do require the BH context protection (Taehee) - fix interrupt / queue / NAPI handling in the lantiq driver (Hauke) - fix ife module load deadlock (Cong) - make an adjustment to netlink reply message type for code added in this release (the sole change touching uAPI here) (Michal) - a number of fixes for small NXP and Microchip switches (Vladimir) [ Pull request acked by David: "you can expect more of this in the future as I try to delegate more things to Jakub" ] * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (167 commits) net: mscc: ocelot: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries net: dsa: seville: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries net: dsa: felix: fix some key offsets for IP4_TCP_UDP VCAP IS2 entries inet_diag: validate INET_DIAG_REQ_PROTOCOL attribute net: bridge: br_vlan_get_pvid_rcu() should dereference the VLAN group under RCU net: Update MAINTAINERS for MediaTek switch driver net/mlx5e: mlx5e_fec_in_caps() returns a boolean net/mlx5e: kTLS, Avoid kzalloc(GFP_KERNEL) under spinlock net/mlx5e: kTLS, Fix leak on resync error flow net/mlx5e: kTLS, Add missing dma_unmap in RX resync net/mlx5e: kTLS, Fix napi sync and possible use-after-free net/mlx5e: TLS, Do not expose FPGA TLS counter if not supported net/mlx5e: Fix using wrong stats_grps in mlx5e_update_ndo_stats() net/mlx5e: Fix multicast counter not up-to-date in "ip -s" net/mlx5e: Fix endianness when calculating pedit mask first bit net/mlx5e: Enable adding peer miss rules only if merged eswitch is supported net/mlx5e: CT: Fix freeing ct_label mapping net/mlx5e: Fix memory leak of tunnel info when rule under multipath not ready net/mlx5e: Use synchronize_rcu to sync with NAPI net/mlx5e: Use RCU to protect rq->xdp_prog ...

Linus Torvalds committed 6 years ago

Commit d3017132 parents 0baca07 b334ec6165 files · +1705 −824Browse files

Unified · Split

165 files
  1. Documentation/bpf/ringbuf.rst +1 −4
  2. Documentation/networking/ethtool-netlink.rst +3 −0
  3. MAINTAINERS +6 −9
  4. arch/arm/boot/dts/at91-sama5d2_icp.dts +1 −1
  5. drivers/atm/eni.c +1 −1
  6. drivers/net/dsa/microchip/ksz8795.c +14 −6
  7. drivers/net/dsa/microchip/ksz9477.c +19 −10
  8. drivers/net/dsa/microchip/ksz_common.c +12 −1
  9. drivers/net/dsa/microchip/ksz_common.h +2 −1
  10. drivers/net/dsa/ocelot/felix.c +7 −1
  11. drivers/net/dsa/ocelot/felix_vsc9959.c +8 −8
  12. drivers/net/dsa/ocelot/seville_vsc9953.c +9 −9
  13. drivers/net/dsa/rtl8366.c +13 −7
  14. drivers/net/ethernet/broadcom/bnxt/bnxt.c +27 −16
  15. drivers/net/ethernet/broadcom/bnxt/bnxt.h +4 −0
  16. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +23 −11
  17. drivers/net/ethernet/cadence/macb_main.c +1 −2
  18. drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +6 −3
  19. drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c +1 −1
  20. drivers/net/ethernet/dec/tulip/de2104x.c +1 −1
  21. drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h +2 −2
  22. drivers/net/ethernet/freescale/enetc/enetc_pf.c +1 −1
  23. drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +2 −2
  24. drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +20 −20
  25. drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +4 −0
  26. drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c +15 −5
  27. drivers/net/ethernet/huawei/hinic/hinic_main.c +24 −0
  28. drivers/net/ethernet/huawei/hinic/hinic_rx.c +14 −7
  29. drivers/net/ethernet/huawei/hinic/hinic_tx.c +6 −18
  30. drivers/net/ethernet/ibm/ibmvnic.c +4 −2
  31. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +16 −6
  32. drivers/net/ethernet/intel/igc/igc.h +8 −12
  33. drivers/net/ethernet/intel/igc/igc_ptp.c +19 −0
  34. drivers/net/ethernet/lantiq_xrx200.c +13 −8
  35. drivers/net/ethernet/marvell/mvneta.c +7 −3
  36. drivers/net/ethernet/mellanox/mlx5/core/en.h +1 −2
  37. drivers/net/ethernet/mellanox/mlx5/core/en/monitor_stats.c +1 −1
  38. drivers/net/ethernet/mellanox/mlx5/core/en/port.c +2 −5
  39. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +16 −5
  40. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +16 −10
  41. drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +5 −0
  42. drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +1 −1
  43. drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c +2 −12
  44. drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +1 −2
  45. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +22 −21
  46. drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c +8 −4
  47. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +31 −54
  48. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 −2
  49. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +6 −10
  50. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +12 −0
  51. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +3 −0
  52. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +26 −19
  53. drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +13 −4
  54. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +28 −24
  55. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +4 −4
  56. drivers/net/ethernet/mscc/ocelot.c +15 −9
  57. drivers/net/ethernet/mscc/ocelot_net.c +6 −6
  58. drivers/net/ethernet/mscc/ocelot_vsc7514.c +145 −104
  59. drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +2 −2
  60. drivers/net/ethernet/qlogic/qed/qed_dev.c +10 −1
  61. drivers/net/ethernet/qlogic/qed/qed_l2.c +3 −0
  62. drivers/net/ethernet/qlogic/qed/qed_main.c +2 −0
  63. drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 −0
  64. drivers/net/ethernet/qlogic/qede/qede_filter.c +3 −0
  65. drivers/net/ethernet/qlogic/qede/qede_main.c +5 −6
  66. drivers/net/ethernet/sfc/ef100.c +1 −0
  67. drivers/net/ethernet/ti/cpsw_new.c +53 −0
  68. drivers/net/geneve.c +27 −10
  69. drivers/net/hyperv/hyperv_net.h +7 −0
  70. drivers/net/hyperv/netvsc.c +111 −13
  71. drivers/net/hyperv/netvsc_drv.c +29 −6
  72. drivers/net/hyperv/rndis_filter.c +66 −7
  73. drivers/net/ieee802154/adf7242.c +3 −1
  74. drivers/net/ieee802154/ca8210.c +1 −0
  75. drivers/net/ipa/ipa_table.c +2 −2
  76. drivers/net/phy/phy.c +1 −1
  77. drivers/net/phy/phy_device.c +6 −5
  78. drivers/net/usb/rndis_host.c +1 −1
  79. drivers/net/wan/hdlc_cisco.c +1 −0
  80. drivers/net/wan/hdlc_fr.c +5 −1
  81. drivers/net/wan/hdlc_ppp.c +12 −5
  82. drivers/net/wan/lapbether.c +2 −2
  83. drivers/net/wireguard/noise.c +1 −4
  84. drivers/net/wireguard/peerlookup.c +8 −3
  85. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +9 −3
  86. drivers/net/wireless/marvell/mwifiex/fw.h +1 −1
  87. drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +2 −2
  88. drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +2 −1
  89. drivers/net/wireless/mediatek/mt76/mt7915/init.c +6 −2
  90. drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 −1
  91. drivers/net/wireless/ti/wlcore/cmd.h +0 −1
  92. drivers/net/wireless/ti/wlcore/main.c +0 −4
  93. drivers/s390/net/qeth_l2_main.c +1 −1
  94. drivers/s390/net/qeth_l3_main.c +1 −1
  95. include/linux/netdev_features.h +1 −1
  96. include/linux/netdevice.h +2 −0
  97. include/linux/qed/qed_if.h +1 −0
  98. include/linux/skbuff.h +4 −3
  99. include/net/flow.h +1 −0
  100. include/net/netlink.h +0 −2
  101. include/net/netns/nftables.h +1 −0
  102. include/net/sctp/structs.h +5 −3
  103. include/net/vxlan.h +3 −0
  104. include/soc/mscc/ocelot.h +2 −0
  105. include/uapi/linux/ethtool_netlink.h +1 −0
  106. kernel/bpf/hashtab.c +4 −11
  107. kernel/bpf/inode.c +3 −1
  108. lib/test_rhashtable.c +1 −1
  109. net/batman-adv/bridge_loop_avoidance.c +117 −28
  110. net/batman-adv/bridge_loop_avoidance.h +2 −2
  111. net/batman-adv/multicast.c +36 −10
  112. net/batman-adv/multicast.h +15 −0
  113. net/batman-adv/routing.c +4 −0
  114. net/batman-adv/soft-interface.c +5 −6
  115. net/bridge/br_vlan.c +17 −10
  116. net/core/dev.c +1 −1
  117. net/core/dst.c +1 −1
  118. net/core/fib_rules.c +1 −1
  119. net/core/filter.c +10 −9
  120. net/core/net_namespace.c +11 −11
  121. net/dcb/dcbnl.c +8 −0
  122. net/dsa/slave.c +16 −2
  123. net/dsa/tag_ocelot.c +7 −4
  124. net/ethtool/tunnels.c +2 −2
  125. net/hsr/hsr_netlink.c +3 −3
  126. net/ipv4/fib_frontend.c +1 −0
  127. net/ipv4/inet_diag.c +15 −5
  128. net/ipv4/ip_output.c +2 −1
  129. net/ipv4/ip_tunnel_core.c +1 −0
  130. net/ipv4/route.c +9 −5
  131. net/ipv6/Kconfig +1 −0
  132. net/ipv6/ip6_fib.c +9 −4
  133. net/ipv6/route.c +1 −1
  134. net/mac80211/airtime.c +14 −6
  135. net/mac80211/mlme.c +2 −1
  136. net/mac80211/rx.c +2 −1
  137. net/mac80211/util.c +4 −3
  138. net/mac80211/vht.c +4 −4
  139. net/mac802154/tx.c +5 −3
  140. net/mptcp/pm_netlink.c +16 −3
  141. net/mptcp/subflow.c +5 −2
  142. net/netfilter/nf_conntrack_netlink.c +5 −17
  143. net/netfilter/nf_conntrack_proto.c +2 −0
  144. net/netfilter/nf_tables_api.c +57 −13
  145. net/netfilter/nft_meta.c +2 −2
  146. net/qrtr/qrtr.c +11 −10
  147. net/sched/act_ife.c +34 −10
  148. net/sched/act_tunnel_key.c +1 −0
  149. net/sched/cls_flower.c +4 −1
  150. net/sched/sch_generic.c +33 −15
  151. net/sched/sch_taprio.c +17 −11
  152. net/sctp/socket.c +3 −6
  153. net/tipc/group.c +10 −4
  154. net/tipc/link.c +2 −1
  155. net/tipc/msg.c +2 −1
  156. net/tipc/socket.c +1 −4
  157. net/wireless/Kconfig +1 −0
  158. net/wireless/util.c +1 −1
  159. net/xdp/xdp_umem.c +8 −9
  160. tools/bpf/Makefile +2 −2
  161. tools/bpf/resolve_btfids/Makefile +1 −0
  162. tools/lib/bpf/Makefile +3 −1
  163. tools/lib/bpf/libbpf.c +1 −1
  164. tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map.c +15 −0
  165. tools/testing/selftests/net/rtnetlink.sh +47 −0
Documentation/bpf/ringbuf.rst+1−4
@@ -182,9 +182,6 @@ in the order of reservations, but only after all previous records where · 181 unmodified lines
182already committed. It is thus possible for slow producers to temporarily hold182already committed. It is thus possible for slow producers to temporarily hold
183off submitted records, that were reserved later.183off submitted records, that were reserved later.
184 184
185Reservation/commit/consumer protocol is verified by litmus tests in
186Documentation/litmus_tests/bpf-rb/_.
187
188One interesting implementation bit, that significantly simplifies (and thus185One interesting implementation bit, that significantly simplifies (and thus
189speeds up as well) implementation of both producers and consumers is how data186speeds up as well) implementation of both producers and consumers is how data
190area is mapped twice contiguously back-to-back in the virtual memory. This187area is mapped twice contiguously back-to-back in the virtual memory. This
@@ -200,7 +197,7 @@ a self-pacing notifications of new data being availability. · 9 unmodified lines
200being available after commit only if consumer has already caught up right up to197being available after commit only if consumer has already caught up right up to
201the record being committed. If not, consumer still has to catch up and thus198the record being committed. If not, consumer still has to catch up and thus
202will see new data anyways without needing an extra poll notification.199will see new data anyways without needing an extra poll notification.
203Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbuf.c_) show that200Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbufs.c) show that
204this allows to achieve a very high throughput without having to resort to201this allows to achieve a very high throughput without having to resort to
205tricks like "notify only every Nth sample", which are necessary with perf202tricks like "notify only every Nth sample", which are necessary with perf
206buffer. For extreme cases, when BPF program wants more manual control of203buffer. For extreme cases, when BPF program wants more manual control of
Documentation/networking/ethtool-netlink.rst+3−0
@@ -206,6 +206,7 @@ Userspace to kernel: · 205 unmodified lines
206 ``ETHTOOL_MSG_TSINFO_GET`` get timestamping info206 ``ETHTOOL_MSG_TSINFO_GET`` get timestamping info
207 ``ETHTOOL_MSG_CABLE_TEST_ACT`` action start cable test207 ``ETHTOOL_MSG_CABLE_TEST_ACT`` action start cable test
208 ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT`` action start raw TDR cable test208 ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT`` action start raw TDR cable test
209 ``ETHTOOL_MSG_TUNNEL_INFO_GET`` get tunnel offload info
209 ===================================== ================================210 ===================================== ================================
210 211
211Kernel to userspace:212Kernel to userspace:
@@ -239,6 +240,7 @@ Kernel to userspace: · 27 unmodified lines
239 ``ETHTOOL_MSG_TSINFO_GET_REPLY`` timestamping info240 ``ETHTOOL_MSG_TSINFO_GET_REPLY`` timestamping info
240 ``ETHTOOL_MSG_CABLE_TEST_NTF`` Cable test results241 ``ETHTOOL_MSG_CABLE_TEST_NTF`` Cable test results
241 ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF`` Cable test TDR results242 ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF`` Cable test TDR results
243 ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info
242 ===================================== =================================244 ===================================== =================================
243 245
244``GET`` requests are sent by userspace applications to retrieve device246``GET`` requests are sent by userspace applications to retrieve device
@@ -1363,4 +1365,5 @@ are netlink only. · 1118 unmodified lines
1363 ``ETHTOOL_SFECPARAM`` n/a1365 ``ETHTOOL_SFECPARAM`` n/a
1364 n/a ''ETHTOOL_MSG_CABLE_TEST_ACT''1366 n/a ''ETHTOOL_MSG_CABLE_TEST_ACT''
1365 n/a ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''1367 n/a ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''
1368 n/a ``ETHTOOL_MSG_TUNNEL_INFO_GET``
1366 =================================== =====================================1369 =================================== =====================================
MAINTAINERS+6−9
@@ -4408,12 +4408,6 @@ T: git git://git.infradead.org/users/hch/configfs.git · 4407 unmodified lines
4408F: fs/configfs/4408F: fs/configfs/
4409F: include/linux/configfs.h4409F: include/linux/configfs.h
4410 4410
4411CONNECTOR
4412M: Evgeniy Polyakov <zbr@ioremap.net>
4413L: netdev@vger.kernel.org
4414S: Maintained
4415F: drivers/connector/
4416
4417CONSOLE SUBSYSTEM4411CONSOLE SUBSYSTEM
4418M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>4412M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4419S: Supported4413S: Supported
@@ -8329,8 +8323,9 @@ S: Supported · 3909 unmodified lines
8329F: drivers/pci/hotplug/rpaphp*8323F: drivers/pci/hotplug/rpaphp*
8330 8324
8331IBM Power SRIOV Virtual NIC Device Driver8325IBM Power SRIOV Virtual NIC Device Driver
8332M: Thomas Falcon <tlfalcon@linux.ibm.com>8326M: Dany Madden <drt@linux.ibm.com>
8333M: John Allen <jallen@linux.ibm.com>8327M: Lijun Pan <ljp@linux.ibm.com>
8328M: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
8334L: netdev@vger.kernel.org8329L: netdev@vger.kernel.org
8335S: Supported8330S: Supported
8336F: drivers/net/ethernet/ibm/ibmvnic.*8331F: drivers/net/ethernet/ibm/ibmvnic.*
@@ -8344,7 +8339,7 @@ F: arch/powerpc/platforms/powernv/copy-paste.h · 7 unmodified lines
8344F: arch/powerpc/platforms/powernv/vas*8339F: arch/powerpc/platforms/powernv/vas*
8345 8340
8346IBM Power Virtual Ethernet Device Driver8341IBM Power Virtual Ethernet Device Driver
8347M: Thomas Falcon <tlfalcon@linux.ibm.com>8342M: Cristobal Forno <cforno12@linux.ibm.com>
8348L: netdev@vger.kernel.org8343L: netdev@vger.kernel.org
8349S: Supported8344S: Supported
8350F: drivers/net/ethernet/ibm/ibmveth.*8345F: drivers/net/ethernet/ibm/ibmveth.*
@@ -11042,6 +11037,7 @@ F: drivers/char/hw_random/mtk-rng.c · 2691 unmodified lines
11042 11037
11043MEDIATEK SWITCH DRIVER11038MEDIATEK SWITCH DRIVER
11044M: Sean Wang <sean.wang@mediatek.com>11039M: Sean Wang <sean.wang@mediatek.com>
11040M: Landen Chao <Landen.Chao@mediatek.com>
11045L: netdev@vger.kernel.org11041L: netdev@vger.kernel.org
11046S: Maintained11042S: Maintained
11047F: drivers/net/dsa/mt7530.*11043F: drivers/net/dsa/mt7530.*
@@ -12055,6 +12051,7 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/ · 1007 unmodified lines
12055T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git12051T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
12056T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git12052T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
12057F: Documentation/devicetree/bindings/net/12053F: Documentation/devicetree/bindings/net/
12054F: drivers/connector/
12058F: drivers/net/12055F: drivers/net/
12059F: include/linux/etherdevice.h12056F: include/linux/etherdevice.h
12060F: include/linux/fcdevice.h12057F: include/linux/fcdevice.h
arch/arm/boot/dts/at91-sama5d2_icp.dts+1−1
@@ -116,7 +116,6 @@ · 115 unmodified lines
116 switch0: ksz8563@0 {116 switch0: ksz8563@0 {
117 compatible = "microchip,ksz8563";117 compatible = "microchip,ksz8563";
118 reg = <0>;118 reg = <0>;
119 phy-mode = "mii";
120 reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;119 reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;
121 120
122 spi-max-frequency = <500000>;121 spi-max-frequency = <500000>;
@@ -140,6 +139,7 @@ · 17 unmodified lines
140 reg = <2>;139 reg = <2>;
141 label = "cpu";140 label = "cpu";
142 ethernet = <&macb0>;141 ethernet = <&macb0>;
142 phy-mode = "mii";
143 fixed-link {143 fixed-link {
144 speed = <100>;144 speed = <100>;
145 full-duplex;145 full-duplex;
drivers/atm/eni.c+1−1
@@ -2224,7 +2224,7 @@ static int eni_init_one(struct pci_dev *pci_dev, · 2223 unmodified lines
2224 2224
2225 rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));2225 rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
2226 if (rc < 0)2226 if (rc < 0)
2227 goto out;2227 goto err_disable;
2228 2228
2229 rc = -ENOMEM;2229 rc = -ENOMEM;
2230 eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL);2230 eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL);
drivers/net/dsa/microchip/ksz8795.c+14−6
@@ -932,11 +932,19 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 931 unmodified lines
932 ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);932 ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
933 933
934 if (cpu_port) {934 if (cpu_port) {
935 if (!p->interface && dev->compat_interface) {
936 dev_warn(dev->dev,
937 "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
938 "Please update your device tree.\n",
939 port);
940 p->interface = dev->compat_interface;
941 }
942
935 /* Configure MII interface for proper network communication. */943 /* Configure MII interface for proper network communication. */
936 ksz_read8(dev, REG_PORT_5_CTRL_6, &data8);944 ksz_read8(dev, REG_PORT_5_CTRL_6, &data8);
937 data8 &= ~PORT_INTERFACE_TYPE;945 data8 &= ~PORT_INTERFACE_TYPE;
938 data8 &= ~PORT_GMII_1GPS_MODE;946 data8 &= ~PORT_GMII_1GPS_MODE;
939 switch (dev->interface) {947 switch (p->interface) {
940 case PHY_INTERFACE_MODE_MII:948 case PHY_INTERFACE_MODE_MII:
941 p->phydev.speed = SPEED_100;949 p->phydev.speed = SPEED_100;
942 break;950 break;
@@ -952,11 +960,11 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 9 unmodified lines
952 default:960 default:
953 data8 &= ~PORT_RGMII_ID_IN_ENABLE;961 data8 &= ~PORT_RGMII_ID_IN_ENABLE;
954 data8 &= ~PORT_RGMII_ID_OUT_ENABLE;962 data8 &= ~PORT_RGMII_ID_OUT_ENABLE;
955 if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||963 if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
956 dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)964 p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
957 data8 |= PORT_RGMII_ID_IN_ENABLE;965 data8 |= PORT_RGMII_ID_IN_ENABLE;
958 if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||966 if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
959 dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)967 p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
960 data8 |= PORT_RGMII_ID_OUT_ENABLE;968 data8 |= PORT_RGMII_ID_OUT_ENABLE;
961 data8 |= PORT_GMII_1GPS_MODE;969 data8 |= PORT_GMII_1GPS_MODE;
962 data8 |= PORT_INTERFACE_RGMII;970 data8 |= PORT_INTERFACE_RGMII;
@@ -1252,7 +1260,7 @@ static int ksz8795_switch_init(struct ksz_device *dev) · 289 unmodified lines
1252 }1260 }
1253 1261
1254 /* set the real number of ports */1262 /* set the real number of ports */
1255 dev->ds->num_ports = dev->port_cnt;1263 dev->ds->num_ports = dev->port_cnt + 1;
1256 1264
1257 return 0;1265 return 0;
1258}1266}
drivers/net/dsa/microchip/ksz9477.c+19−10
@@ -1208,7 +1208,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 1207 unmodified lines
1208 1208
1209 /* configure MAC to 1G & RGMII mode */1209 /* configure MAC to 1G & RGMII mode */
1210 ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);1210 ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
1211 switch (dev->interface) {1211 switch (p->interface) {
1212 case PHY_INTERFACE_MODE_MII:1212 case PHY_INTERFACE_MODE_MII:
1213 ksz9477_set_xmii(dev, 0, &data8);1213 ksz9477_set_xmii(dev, 0, &data8);
1214 ksz9477_set_gbit(dev, false, &data8);1214 ksz9477_set_gbit(dev, false, &data8);
@@ -1229,11 +1229,11 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 14 unmodified lines
1229 ksz9477_set_gbit(dev, true, &data8);1229 ksz9477_set_gbit(dev, true, &data8);
1230 data8 &= ~PORT_RGMII_ID_IG_ENABLE;1230 data8 &= ~PORT_RGMII_ID_IG_ENABLE;
1231 data8 &= ~PORT_RGMII_ID_EG_ENABLE;1231 data8 &= ~PORT_RGMII_ID_EG_ENABLE;
1232 if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||1232 if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1233 dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)1233 p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
1234 data8 |= PORT_RGMII_ID_IG_ENABLE;1234 data8 |= PORT_RGMII_ID_IG_ENABLE;
1235 if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||1235 if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1236 dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)1236 p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
1237 data8 |= PORT_RGMII_ID_EG_ENABLE;1237 data8 |= PORT_RGMII_ID_EG_ENABLE;
1238 p->phydev.speed = SPEED_1000;1238 p->phydev.speed = SPEED_1000;
1239 break;1239 break;
@@ -1269,23 +1269,32 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds) · 29 unmodified lines
1269 dev->cpu_port = i;1269 dev->cpu_port = i;
1270 dev->host_mask = (1 << dev->cpu_port);1270 dev->host_mask = (1 << dev->cpu_port);
1271 dev->port_mask |= dev->host_mask;1271 dev->port_mask |= dev->host_mask;
1272 p = &dev->ports[i];
1272 1273
1273 /* Read from XMII register to determine host port1274 /* Read from XMII register to determine host port
1274 * interface. If set specifically in device tree1275 * interface. If set specifically in device tree
1275 * note the difference to help debugging.1276 * note the difference to help debugging.
1276 */1277 */
1277 interface = ksz9477_get_interface(dev, i);1278 interface = ksz9477_get_interface(dev, i);
1278 if (!dev->interface)1279 if (!p->interface) {
1279 dev->interface = interface;1280 if (dev->compat_interface) {
1280 if (interface && interface != dev->interface)1281 dev_warn(dev->dev,
1282 "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
1283 "Please update your device tree.\n",
1284 i);
1285 p->interface = dev->compat_interface;
1286 } else {
1287 p->interface = interface;
1288 }
1289 }
1290 if (interface && interface != p->interface)
1281 dev_info(dev->dev,1291 dev_info(dev->dev,
1282 "use %s instead of %s\n",1292 "use %s instead of %s\n",
1283 phy_modes(dev->interface),1293 phy_modes(p->interface),
1284 phy_modes(interface));1294 phy_modes(interface));
1285 1295
1286 /* enable cpu port */1296 /* enable cpu port */
1287 ksz9477_port_setup(dev, i, true);1297 ksz9477_port_setup(dev, i, true);
1288 p = &dev->ports[dev->cpu_port];
1289 p->vid_member = dev->port_mask;1298 p->vid_member = dev->port_mask;
1290 p->on = 1;1299 p->on = 1;
1291 }1300 }
drivers/net/dsa/microchip/ksz_common.c+12−1
@@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev, · 387 unmodified lines
388 const struct ksz_dev_ops *ops)388 const struct ksz_dev_ops *ops)
389{389{
390 phy_interface_t interface;390 phy_interface_t interface;
391 struct device_node *port;
392 unsigned int port_num;
391 int ret;393 int ret;
392 394
393 if (dev->pdata)395 if (dev->pdata)
@@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev, · 27 unmodified lines
421 /* Host port interface will be self detected, or specifically set in423 /* Host port interface will be self detected, or specifically set in
422 * device tree.424 * device tree.
423 */425 */
426 for (port_num = 0; port_num < dev->port_cnt; ++port_num)
427 dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA;
424 if (dev->dev->of_node) {428 if (dev->dev->of_node) {
425 ret = of_get_phy_mode(dev->dev->of_node, &interface);429 ret = of_get_phy_mode(dev->dev->of_node, &interface);
426 if (ret == 0)430 if (ret == 0)
427 dev->interface = interface;431 dev->compat_interface = interface;
432 for_each_available_child_of_node(dev->dev->of_node, port) {
433 if (of_property_read_u32(port, "reg", &port_num))
434 continue;
435 if (port_num >= dev->port_cnt)
436 return -EINVAL;
437 of_get_phy_mode(port, &dev->ports[port_num].interface);
438 }
428 dev->synclko_125 = of_property_read_bool(dev->dev->of_node,439 dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
429 "microchip,synclko-125");440 "microchip,synclko-125");
430 }441 }
drivers/net/dsa/microchip/ksz_common.h+2−1
@@ -39,6 +39,7 @@ struct ksz_port { · 38 unmodified lines
39 u32 freeze:1; /* MIB counter freeze is enabled */39 u32 freeze:1; /* MIB counter freeze is enabled */
40 40
41 struct ksz_port_mib mib;41 struct ksz_port_mib mib;
42 phy_interface_t interface;
42};43};
43 44
44struct ksz_device {45struct ksz_device {
@@ -72,7 +73,7 @@ struct ksz_device { · 27 unmodified lines
72 int mib_cnt;73 int mib_cnt;
73 int mib_port_cnt;74 int mib_port_cnt;
74 int last_port; /* ports after that not used */75 int last_port; /* ports after that not used */
75 phy_interface_t interface;76 phy_interface_t compat_interface;
76 u32 regs_size;77 u32 regs_size;
77 bool phy_errata_9477;78 bool phy_errata_9477;
78 bool synclko_125;79 bool synclko_125;
drivers/net/dsa/ocelot/felix.c+7−1
@@ -585,7 +585,10 @@ static int felix_setup(struct dsa_switch *ds) · 584 unmodified lines
585 if (err)585 if (err)
586 return err;586 return err;
587 587
588 ocelot_init(ocelot);588 err = ocelot_init(ocelot);
589 if (err)
590 return err;
591
589 if (ocelot->ptp) {592 if (ocelot->ptp) {
590 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);593 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
591 if (err) {594 if (err) {
@@ -640,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds) · 48 unmodified lines
640{643{
641 struct ocelot *ocelot = ds->priv;644 struct ocelot *ocelot = ds->priv;
642 struct felix *felix = ocelot_to_felix(ocelot);645 struct felix *felix = ocelot_to_felix(ocelot);
646 int port;
643 647
644 if (felix->info->mdio_bus_free)648 if (felix->info->mdio_bus_free)
645 felix->info->mdio_bus_free(ocelot);649 felix->info->mdio_bus_free(ocelot);
646 650
651 for (port = 0; port < ocelot->num_phys_ports; port++)
652 ocelot_deinit_port(ocelot, port);
647 ocelot_deinit_timestamp(ocelot);653 ocelot_deinit_timestamp(ocelot);
648 /* stop workqueue thread */654 /* stop workqueue thread */
649 ocelot_deinit(ocelot);655 ocelot_deinit(ocelot);
drivers/net/dsa/ocelot/felix_vsc9959.c+8−8
@@ -645,17 +645,17 @@ static struct vcap_field vsc9959_vcap_is2_keys[] = { · 644 unmodified lines
645 [VCAP_IS2_HK_DIP_EQ_SIP] = {118, 1},645 [VCAP_IS2_HK_DIP_EQ_SIP] = {118, 1},
646 /* IP4_TCP_UDP (TYPE=100) */646 /* IP4_TCP_UDP (TYPE=100) */
647 [VCAP_IS2_HK_TCP] = {119, 1},647 [VCAP_IS2_HK_TCP] = {119, 1},
648 [VCAP_IS2_HK_L4_SPORT] = {120, 16},648 [VCAP_IS2_HK_L4_DPORT] = {120, 16},
649 [VCAP_IS2_HK_L4_DPORT] = {136, 16},649 [VCAP_IS2_HK_L4_SPORT] = {136, 16},
650 [VCAP_IS2_HK_L4_RNG] = {152, 8},650 [VCAP_IS2_HK_L4_RNG] = {152, 8},
651 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {160, 1},651 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {160, 1},
652 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {161, 1},652 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {161, 1},
653 [VCAP_IS2_HK_L4_URG] = {162, 1},653 [VCAP_IS2_HK_L4_FIN] = {162, 1},
654 [VCAP_IS2_HK_L4_ACK] = {163, 1},654 [VCAP_IS2_HK_L4_SYN] = {163, 1},
655 [VCAP_IS2_HK_L4_PSH] = {164, 1},655 [VCAP_IS2_HK_L4_RST] = {164, 1},
656 [VCAP_IS2_HK_L4_RST] = {165, 1},656 [VCAP_IS2_HK_L4_PSH] = {165, 1},
657 [VCAP_IS2_HK_L4_SYN] = {166, 1},657 [VCAP_IS2_HK_L4_ACK] = {166, 1},
658 [VCAP_IS2_HK_L4_FIN] = {167, 1},658 [VCAP_IS2_HK_L4_URG] = {167, 1},
659 [VCAP_IS2_HK_L4_1588_DOM] = {168, 8},659 [VCAP_IS2_HK_L4_1588_DOM] = {168, 8},
660 [VCAP_IS2_HK_L4_1588_VER] = {176, 4},660 [VCAP_IS2_HK_L4_1588_VER] = {176, 4},
661 /* IP4_OTHER (TYPE=101) */661 /* IP4_OTHER (TYPE=101) */
drivers/net/dsa/ocelot/seville_vsc9953.c+9−9
@@ -659,17 +659,17 @@ static struct vcap_field vsc9953_vcap_is2_keys[] = { · 658 unmodified lines
659 [VCAP_IS2_HK_DIP_EQ_SIP] = {122, 1},659 [VCAP_IS2_HK_DIP_EQ_SIP] = {122, 1},
660 /* IP4_TCP_UDP (TYPE=100) */660 /* IP4_TCP_UDP (TYPE=100) */
661 [VCAP_IS2_HK_TCP] = {123, 1},661 [VCAP_IS2_HK_TCP] = {123, 1},
662 [VCAP_IS2_HK_L4_SPORT] = {124, 16},662 [VCAP_IS2_HK_L4_DPORT] = {124, 16},
663 [VCAP_IS2_HK_L4_DPORT] = {140, 16},663 [VCAP_IS2_HK_L4_SPORT] = {140, 16},
664 [VCAP_IS2_HK_L4_RNG] = {156, 8},664 [VCAP_IS2_HK_L4_RNG] = {156, 8},
665 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {164, 1},665 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {164, 1},
666 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {165, 1},666 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {165, 1},
667 [VCAP_IS2_HK_L4_URG] = {166, 1},667 [VCAP_IS2_HK_L4_FIN] = {166, 1},
668 [VCAP_IS2_HK_L4_ACK] = {167, 1},668 [VCAP_IS2_HK_L4_SYN] = {167, 1},
669 [VCAP_IS2_HK_L4_PSH] = {168, 1},669 [VCAP_IS2_HK_L4_RST] = {168, 1},
670 [VCAP_IS2_HK_L4_RST] = {169, 1},670 [VCAP_IS2_HK_L4_PSH] = {169, 1},
671 [VCAP_IS2_HK_L4_SYN] = {170, 1},671 [VCAP_IS2_HK_L4_ACK] = {170, 1},
672 [VCAP_IS2_HK_L4_FIN] = {171, 1},672 [VCAP_IS2_HK_L4_URG] = {171, 1},
673 /* IP4_OTHER (TYPE=101) */673 /* IP4_OTHER (TYPE=101) */
674 [VCAP_IS2_HK_IP4_L3_PROTO] = {123, 8},674 [VCAP_IS2_HK_IP4_L3_PROTO] = {123, 8},
675 [VCAP_IS2_HK_L3_PAYLOAD] = {131, 56},675 [VCAP_IS2_HK_L3_PAYLOAD] = {131, 56},
@@ -1008,7 +1008,7 @@ static const struct felix_info seville_info_vsc9953 = { · 332 unmodified lines
1008 .vcap_is2_keys = vsc9953_vcap_is2_keys,1008 .vcap_is2_keys = vsc9953_vcap_is2_keys,
1009 .vcap_is2_actions = vsc9953_vcap_is2_actions,1009 .vcap_is2_actions = vsc9953_vcap_is2_actions,
1010 .vcap = vsc9953_vcap_props,1010 .vcap = vsc9953_vcap_props,
1011 .shared_queue_sz = 128 * 1024,1011 .shared_queue_sz = 2048 * 1024,
1012 .num_mact_rows = 2048,1012 .num_mact_rows = 2048,
1013 .num_ports = 10,1013 .num_ports = 10,
1014 .mdio_bus_alloc = vsc9953_mdio_bus_alloc,1014 .mdio_bus_alloc = vsc9953_mdio_bus_alloc,
drivers/net/dsa/rtl8366.c+13−7
@@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, · 451 unmodified lines
452 return ret;452 return ret;
453 453
454 if (vid == vlanmc.vid) {454 if (vid == vlanmc.vid) {
455 /* clear VLAN member configurations */455 /* Remove this port from the VLAN */
456 vlanmc.vid = 0;456 vlanmc.member &= ~BIT(port);
457 vlanmc.priority = 0;457 vlanmc.untag &= ~BIT(port);
458 vlanmc.member = 0;458 /*
459 vlanmc.untag = 0;459 * If no ports are members of this VLAN
460 vlanmc.fid = 0;460 * anymore then clear the whole member
461 461 * config so it can be reused.
462 */
463 if (!vlanmc.member && vlanmc.untag) {
464 vlanmc.vid = 0;
465 vlanmc.priority = 0;
466 vlanmc.fid = 0;
467 }
462 ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);468 ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
463 if (ret) {469 if (ret) {
464 dev_err(smi->dev,470 dev_err(smi->dev,
drivers/net/ethernet/broadcom/bnxt/bnxt.c+27−16
@@ -3782,6 +3782,7 @@ static int bnxt_hwrm_func_qstat_ext(struct bnxt *bp, · 3781 unmodified lines
3782 return -EOPNOTSUPP;3782 return -EOPNOTSUPP;
3783 3783
3784 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1);3784 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1);
3785 req.fid = cpu_to_le16(0xffff);
3785 req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;3786 req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
3786 mutex_lock(&bp->hwrm_cmd_lock);3787 mutex_lock(&bp->hwrm_cmd_lock);
3787 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);3788 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -3852,7 +3853,7 @@ static void bnxt_init_stats(struct bnxt *bp) · 64 unmodified lines
3852 tx_masks = stats->hw_masks;3853 tx_masks = stats->hw_masks;
3853 tx_count = sizeof(struct tx_port_stats_ext) / 8;3854 tx_count = sizeof(struct tx_port_stats_ext) / 8;
3854 3855
3855 flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;3856 flags = PORT_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
3856 rc = bnxt_hwrm_port_qstats_ext(bp, flags);3857 rc = bnxt_hwrm_port_qstats_ext(bp, flags);
3857 if (rc) {3858 if (rc) {
3858 mask = (1ULL << 40) - 1;3859 mask = (1ULL << 40) - 1;
@@ -4305,7 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 446 unmodified lines
4305 u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;4306 u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
4306 u16 dst = BNXT_HWRM_CHNL_CHIMP;4307 u16 dst = BNXT_HWRM_CHNL_CHIMP;
4307 4308
4308 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))4309 if (BNXT_NO_FW_ACCESS(bp))
4309 return -EBUSY;4310 return -EBUSY;
4310 4311
4311 if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {4312 if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {
@@ -5723,7 +5724,7 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp, · 1411 unmodified lines
5723 struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;5724 struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;
5724 u16 error_code;5725 u16 error_code;
5725 5726
5726 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))5727 if (BNXT_NO_FW_ACCESS(bp))
5727 return 0;5728 return 0;
5728 5729
5729 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1);5730 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1);
@@ -7817,7 +7818,7 @@ static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa) · 2087 unmodified lines
7817 7818
7818 if (set_tpa)7819 if (set_tpa)
7819 tpa_flags = bp->flags & BNXT_FLAG_TPA;7820 tpa_flags = bp->flags & BNXT_FLAG_TPA;
7820 else if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))7821 else if (BNXT_NO_FW_ACCESS(bp))
7821 return 0;7822 return 0;
7822 for (i = 0; i < bp->nr_vnics; i++) {7823 for (i = 0; i < bp->nr_vnics; i++) {
7823 rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags);7824 rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags);
@@ -9311,18 +9312,16 @@ static ssize_t bnxt_show_temp(struct device *dev, · 1487 unmodified lines
9311 struct hwrm_temp_monitor_query_output *resp;9312 struct hwrm_temp_monitor_query_output *resp;
9312 struct bnxt *bp = dev_get_drvdata(dev);9313 struct bnxt *bp = dev_get_drvdata(dev);
9313 u32 len = 0;9314 u32 len = 0;
9315 int rc;
9314 9316
9315 resp = bp->hwrm_cmd_resp_addr;9317 resp = bp->hwrm_cmd_resp_addr;
9316 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);9318 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
9317 mutex_lock(&bp->hwrm_cmd_lock);9319 mutex_lock(&bp->hwrm_cmd_lock);
9318 if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))9320 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
9321 if (!rc)
9319 len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */9322 len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
9320 mutex_unlock(&bp->hwrm_cmd_lock);9323 mutex_unlock(&bp->hwrm_cmd_lock);
9321 9324 return rc ?: len;
9322 if (len)
9323 return len;
9324
9325 return sprintf(buf, "unknown\n");
9326}9325}
9327static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);9326static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
9328 9327
@@ -9342,7 +9341,16 @@ static void bnxt_hwmon_close(struct bnxt *bp) · 13 unmodified lines
9342 9341
9343static void bnxt_hwmon_open(struct bnxt *bp)9342static void bnxt_hwmon_open(struct bnxt *bp)
9344{9343{
9344 struct hwrm_temp_monitor_query_input req = {0};
9345 struct pci_dev *pdev = bp->pdev;9345 struct pci_dev *pdev = bp->pdev;
9346 int rc;
9347
9348 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
9349 rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
9350 if (rc == -EACCES || rc == -EOPNOTSUPP) {
9351 bnxt_hwmon_close(bp);
9352 return;
9353 }
9346 9354
9347 if (bp->hwmon_dev)9355 if (bp->hwmon_dev)
9348 return;9356 return;
@@ -11779,6 +11787,10 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 2430 unmodified lines
11779 if (BNXT_PF(bp))11787 if (BNXT_PF(bp))
11780 bnxt_sriov_disable(bp);11788 bnxt_sriov_disable(bp);
11781 11789
11790 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11791 bnxt_cancel_sp_work(bp);
11792 bp->sp_event = 0;
11793
11782 bnxt_dl_fw_reporters_destroy(bp, true);11794 bnxt_dl_fw_reporters_destroy(bp, true);
11783 if (BNXT_PF(bp))11795 if (BNXT_PF(bp))
11784 devlink_port_type_clear(&bp->dl_port);11796 devlink_port_type_clear(&bp->dl_port);
@@ -11786,9 +11798,6 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 1 unmodified line
11786 unregister_netdev(dev);11798 unregister_netdev(dev);
11787 bnxt_dl_unregister(bp);11799 bnxt_dl_unregister(bp);
11788 bnxt_shutdown_tc(bp);11800 bnxt_shutdown_tc(bp);
11789 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11790 bnxt_cancel_sp_work(bp);
11791 bp->sp_event = 0;
11792 11801
11793 bnxt_clear_int_mode(bp);11802 bnxt_clear_int_mode(bp);
11794 bnxt_hwrm_func_drv_unrgtr(bp);11803 bnxt_hwrm_func_drv_unrgtr(bp);
@@ -12089,7 +12098,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp) · 294 unmodified lines
12089static void bnxt_vpd_read_info(struct bnxt *bp)12098static void bnxt_vpd_read_info(struct bnxt *bp)
12090{12099{
12091 struct pci_dev *pdev = bp->pdev;12100 struct pci_dev *pdev = bp->pdev;
12092 int i, len, pos, ro_size;12101 int i, len, pos, ro_size, size;
12093 ssize_t vpd_size;12102 ssize_t vpd_size;
12094 u8 *vpd_data;12103 u8 *vpd_data;
12095 12104
@@ -12124,7 +12133,8 @@ static void bnxt_vpd_read_info(struct bnxt *bp) · 28 unmodified lines
12124 if (len + pos > vpd_size)12133 if (len + pos > vpd_size)
12125 goto read_sn;12134 goto read_sn;
12126 12135
12127 strlcpy(bp->board_partno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));12136 size = min(len, BNXT_VPD_FLD_LEN - 1);
12137 memcpy(bp->board_partno, &vpd_data[pos], size);
12128 12138
12129read_sn:12139read_sn:
12130 pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,12140 pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
@@ -12137,7 +12147,8 @@ read_sn: · 6 unmodified lines
12137 if (len + pos > vpd_size)12147 if (len + pos > vpd_size)
12138 goto exit;12148 goto exit;
12139 12149
12140 strlcpy(bp->board_serialno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));12150 size = min(len, BNXT_VPD_FLD_LEN - 1);
12151 memcpy(bp->board_serialno, &vpd_data[pos], size);
12141exit:12152exit:
12142 kfree(vpd_data);12153 kfree(vpd_data);
12143}12154}
drivers/net/ethernet/broadcom/bnxt/bnxt.h+4−0
@@ -1737,6 +1737,10 @@ struct bnxt { · 1736 unmodified lines
1737#define BNXT_STATE_FW_FATAL_COND 61737#define BNXT_STATE_FW_FATAL_COND 6
1738#define BNXT_STATE_DRV_REGISTERED 71738#define BNXT_STATE_DRV_REGISTERED 7
1739 1739
1740#define BNXT_NO_FW_ACCESS(bp) \
1741 (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \
1742 pci_channel_offline((bp)->pdev))
1743
1740 struct bnxt_irq *irq_tbl;1744 struct bnxt_irq *irq_tbl;
1741 int total_irqs;1745 int total_irqs;
1742 u8 mac_addr[ETH_ALEN];1746 u8 mac_addr[ETH_ALEN];
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+23−11
@@ -1322,6 +1322,9 @@ static int bnxt_get_regs_len(struct net_device *dev) · 1321 unmodified lines
1322 struct bnxt *bp = netdev_priv(dev);1322 struct bnxt *bp = netdev_priv(dev);
1323 int reg_len;1323 int reg_len;
1324 1324
1325 if (!BNXT_PF(bp))
1326 return -EOPNOTSUPP;
1327
1325 reg_len = BNXT_PXP_REG_LEN;1328 reg_len = BNXT_PXP_REG_LEN;
1326 1329
1327 if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)1330 if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)
@@ -1788,9 +1791,12 @@ static int bnxt_set_pauseparam(struct net_device *dev, · 460 unmodified lines
1788 if (!BNXT_PHY_CFG_ABLE(bp))1791 if (!BNXT_PHY_CFG_ABLE(bp))
1789 return -EOPNOTSUPP;1792 return -EOPNOTSUPP;
1790 1793
1794 mutex_lock(&bp->link_lock);
1791 if (epause->autoneg) {1795 if (epause->autoneg) {
1792 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))1796 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
1793 return -EINVAL;1797 rc = -EINVAL;
1798 goto pause_exit;
1799 }
1794 1800
1795 link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;1801 link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
1796 if (bp->hwrm_spec_code >= 0x10201)1802 if (bp->hwrm_spec_code >= 0x10201)
@@ -1811,11 +1817,11 @@ static int bnxt_set_pauseparam(struct net_device *dev, · 14 unmodified lines
1811 if (epause->tx_pause)1817 if (epause->tx_pause)
1812 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;1818 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
1813 1819
1814 if (netif_running(dev)) {1820 if (netif_running(dev))
1815 mutex_lock(&bp->link_lock);
1816 rc = bnxt_hwrm_set_pause(bp);1821 rc = bnxt_hwrm_set_pause(bp);
1817 mutex_unlock(&bp->link_lock);1822
1818 }1823pause_exit:
1824 mutex_unlock(&bp->link_lock);
1819 return rc;1825 return rc;
1820}1826}
1821 1827
@@ -2552,8 +2558,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 730 unmodified lines
2552 struct bnxt *bp = netdev_priv(dev);2558 struct bnxt *bp = netdev_priv(dev);
2553 struct ethtool_eee *eee = &bp->eee;2559 struct ethtool_eee *eee = &bp->eee;
2554 struct bnxt_link_info *link_info = &bp->link_info;2560 struct bnxt_link_info *link_info = &bp->link_info;
2555 u32 advertising =2561 u32 advertising;
2556 _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
2557 int rc = 0;2562 int rc = 0;
2558 2563
2559 if (!BNXT_PHY_CFG_ABLE(bp))2564 if (!BNXT_PHY_CFG_ABLE(bp))
@@ -2562,19 +2567,23 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 2 unmodified lines
2562 if (!(bp->flags & BNXT_FLAG_EEE_CAP))2567 if (!(bp->flags & BNXT_FLAG_EEE_CAP))
2563 return -EOPNOTSUPP;2568 return -EOPNOTSUPP;
2564 2569
2570 mutex_lock(&bp->link_lock);
2571 advertising = _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
2565 if (!edata->eee_enabled)2572 if (!edata->eee_enabled)
2566 goto eee_ok;2573 goto eee_ok;
2567 2574
2568 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {2575 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
2569 netdev_warn(dev, "EEE requires autoneg\n");2576 netdev_warn(dev, "EEE requires autoneg\n");
2570 return -EINVAL;2577 rc = -EINVAL;
2578 goto eee_exit;
2571 }2579 }
2572 if (edata->tx_lpi_enabled) {2580 if (edata->tx_lpi_enabled) {
2573 if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||2581 if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||
2574 edata->tx_lpi_timer < bp->lpi_tmr_lo)) {2582 edata->tx_lpi_timer < bp->lpi_tmr_lo)) {
2575 netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",2583 netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",
2576 bp->lpi_tmr_lo, bp->lpi_tmr_hi);2584 bp->lpi_tmr_lo, bp->lpi_tmr_hi);
2577 return -EINVAL;2585 rc = -EINVAL;
2586 goto eee_exit;
2578 } else if (!bp->lpi_tmr_hi) {2587 } else if (!bp->lpi_tmr_hi) {
2579 edata->tx_lpi_timer = eee->tx_lpi_timer;2588 edata->tx_lpi_timer = eee->tx_lpi_timer;
2580 }2589 }
@@ -2584,7 +2593,8 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 3 unmodified lines
2584 } else if (edata->advertised & ~advertising) {2593 } else if (edata->advertised & ~advertising) {
2585 netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",2594 netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
2586 edata->advertised, advertising);2595 edata->advertised, advertising);
2587 return -EINVAL;2596 rc = -EINVAL;
2597 goto eee_exit;
2588 }2598 }
2589 2599
2590 eee->advertised = edata->advertised;2600 eee->advertised = edata->advertised;
@@ -2596,6 +2606,8 @@ eee_ok: · 5 unmodified lines
2596 if (netif_running(dev))2606 if (netif_running(dev))
2597 rc = bnxt_hwrm_set_link_setting(bp, false, true);2607 rc = bnxt_hwrm_set_link_setting(bp, false, true);
2598 2608
2609eee_exit:
2610 mutex_unlock(&bp->link_lock);
2599 return rc;2611 return rc;
2600}2612}
2601 2613
drivers/net/ethernet/cadence/macb_main.c+1−2
@@ -647,8 +647,7 @@ static void macb_mac_link_up(struct phylink_config *config, · 646 unmodified lines
647 ctrl |= GEM_BIT(GBE);647 ctrl |= GEM_BIT(GBE);
648 }648 }
649 649
650 /* We do not support MLO_PAUSE_RX yet */650 if (rx_pause)
651 if (tx_pause)
652 ctrl |= MACB_BIT(PAE);651 ctrl |= MACB_BIT(PAE);
653 652
654 macb_set_tx_clk(bp->tx_clk, speed, ndev);653 macb_set_tx_clk(bp->tx_clk, speed, ndev);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c+6−3
@@ -1911,13 +1911,16 @@ out: · 1910 unmodified lines
1911static int configure_filter_tcb(struct adapter *adap, unsigned int tid,1911static int configure_filter_tcb(struct adapter *adap, unsigned int tid,
1912 struct filter_entry *f)1912 struct filter_entry *f)
1913{1913{
1914 if (f->fs.hitcnts)1914 if (f->fs.hitcnts) {
1915 set_tcb_field(adap, f, tid, TCB_TIMESTAMP_W,1915 set_tcb_field(adap, f, tid, TCB_TIMESTAMP_W,
1916 TCB_TIMESTAMP_V(TCB_TIMESTAMP_M) |1916 TCB_TIMESTAMP_V(TCB_TIMESTAMP_M),
1917 TCB_TIMESTAMP_V(0ULL),
1918 1);
1919 set_tcb_field(adap, f, tid, TCB_RTT_TS_RECENT_AGE_W,
1917 TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M),1920 TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M),
1918 TCB_TIMESTAMP_V(0ULL) |
1919 TCB_RTT_TS_RECENT_AGE_V(0ULL),1921 TCB_RTT_TS_RECENT_AGE_V(0ULL),
1920 1);1922 1);
1923 }
1921 1924
1922 if (f->fs.newdmac)1925 if (f->fs.newdmac)
1923 set_tcb_tflag(adap, f, tid, TF_CCTRL_ECE_S, 1,1926 set_tcb_tflag(adap, f, tid, TF_CCTRL_ECE_S, 1,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c+1−1
@@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct adapter *adap) · 228 unmodified lines
229{229{
230 struct mps_entries_ref *mps_entry, *tmp;230 struct mps_entries_ref *mps_entry, *tmp;
231 231
232 if (!list_empty(&adap->mps_ref))232 if (list_empty(&adap->mps_ref))
233 return;233 return;
234 234
235 spin_lock(&adap->mps_ref_lock);235 spin_lock(&adap->mps_ref_lock);
drivers/net/ethernet/dec/tulip/de2104x.c+1−1
@@ -85,7 +85,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi · 84 unmodified lines
85#define DSL CONFIG_DE2104X_DSL85#define DSL CONFIG_DE2104X_DSL
86#endif86#endif
87 87
88#define DE_RX_RING_SIZE 6488#define DE_RX_RING_SIZE 128
89#define DE_TX_RING_SIZE 6489#define DE_TX_RING_SIZE 64
90#define DE_RING_BYTES \90#define DE_RING_BYTES \
91 ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \91 ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \
drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h+2−2
@@ -66,8 +66,8 @@ struct dpmac_cmd_get_counter { · 65 unmodified lines
66};66};
67 67
68struct dpmac_rsp_get_counter {68struct dpmac_rsp_get_counter {
69 u64 pad;69 __le64 pad;
70 u64 counter;70 __le64 counter;
71};71};
72 72
73#endif /* _FSL_DPMAC_CMD_H */73#endif /* _FSL_DPMAC_CMD_H */
drivers/net/ethernet/freescale/enetc/enetc_pf.c+1−1
@@ -1053,7 +1053,6 @@ static int enetc_pf_probe(struct pci_dev *pdev, · 1052 unmodified lines
1053 1053
1054err_reg_netdev:1054err_reg_netdev:
1055 enetc_teardown_serdes(priv);1055 enetc_teardown_serdes(priv);
1056 enetc_mdio_remove(pf);
1057 enetc_free_msix(priv);1056 enetc_free_msix(priv);
1058err_alloc_msix:1057err_alloc_msix:
1059 enetc_free_si_resources(priv);1058 enetc_free_si_resources(priv);
@@ -1061,6 +1060,7 @@ err_alloc_si_res: · 1 unmodified line
1061 si->ndev = NULL;1060 si->ndev = NULL;
1062 free_netdev(ndev);1061 free_netdev(ndev);
1063err_alloc_netdev:1062err_alloc_netdev:
1063 enetc_mdio_remove(pf);
1064 enetc_of_put_phy(pf);1064 enetc_of_put_phy(pf);
1065err_map_pf_space:1065err_map_pf_space:
1066 enetc_pci_remove(pdev);1066 enetc_pci_remove(pdev);
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c+2−2
@@ -334,7 +334,7 @@ static void hns_dsaf_xge_srst_by_port_acpi(struct dsaf_device *dsaf_dev, · 333 unmodified lines
334 * bit6-11 for ppe0-5334 * bit6-11 for ppe0-5
335 * bit12-17 for roce0-5335 * bit12-17 for roce0-5
336 * bit18-19 for com/dfx336 * bit18-19 for com/dfx
337 * @enable: false - request reset , true - drop reset337 * @dereset: false - request reset , true - drop reset
338 */338 */
339static void339static void
340hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)340hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
@@ -357,7 +357,7 @@ hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset) · 16 unmodified lines
357 * bit6-11 for ppe0-5357 * bit6-11 for ppe0-5
358 * bit12-17 for roce0-5358 * bit12-17 for roce0-5
359 * bit18-19 for com/dfx359 * bit18-19 for com/dfx
360 * @enable: false - request reset , true - drop reset360 * @dereset: false - request reset , true - drop reset
361 */361 */
362static void362static void
363hns_dsaf_srst_chns_acpi(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)363hns_dsaf_srst_chns_acpi(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c+20−20
@@ -463,8 +463,8 @@ static int __lb_clean_rings(struct hns_nic_priv *priv, · 462 unmodified lines
463 463
464/**464/**
465 * nic_run_loopback_test - run loopback test465 * nic_run_loopback_test - run loopback test
466 * @nic_dev: net device466 * @ndev: net device
467 * @loopback_type: loopback type467 * @loop_mode: loopback mode
468 */468 */
469static int __lb_run_test(struct net_device *ndev,469static int __lb_run_test(struct net_device *ndev,
470 enum hnae_loop loop_mode)470 enum hnae_loop loop_mode)
@@ -572,7 +572,7 @@ static int __lb_down(struct net_device *ndev, enum hnae_loop loop) · 101 unmodified lines
572 572
573/**573/**
574 * hns_nic_self_test - self test574 * hns_nic_self_test - self test
575 * @dev: net device575 * @ndev: net device
576 * @eth_test: test cmd576 * @eth_test: test cmd
577 * @data: test result577 * @data: test result
578 */578 */
@@ -633,7 +633,7 @@ static void hns_nic_self_test(struct net_device *ndev, · 54 unmodified lines
633 633
634/**634/**
635 * hns_nic_get_drvinfo - get net driver info635 * hns_nic_get_drvinfo - get net driver info
636 * @dev: net device636 * @net_dev: net device
637 * @drvinfo: driver info637 * @drvinfo: driver info
638 */638 */
639static void hns_nic_get_drvinfo(struct net_device *net_dev,639static void hns_nic_get_drvinfo(struct net_device *net_dev,
@@ -658,7 +658,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev, · 18 unmodified lines
658 658
659/**659/**
660 * hns_get_ringparam - get ring parameter660 * hns_get_ringparam - get ring parameter
661 * @dev: net device661 * @net_dev: net device
662 * @param: ethtool parameter662 * @param: ethtool parameter
663 */663 */
664static void hns_get_ringparam(struct net_device *net_dev,664static void hns_get_ringparam(struct net_device *net_dev,
@@ -683,7 +683,7 @@ static void hns_get_ringparam(struct net_device *net_dev, · 18 unmodified lines
683 683
684/**684/**
685 * hns_get_pauseparam - get pause parameter685 * hns_get_pauseparam - get pause parameter
686 * @dev: net device686 * @net_dev: net device
687 * @param: pause parameter687 * @param: pause parameter
688 */688 */
689static void hns_get_pauseparam(struct net_device *net_dev,689static void hns_get_pauseparam(struct net_device *net_dev,
@@ -701,7 +701,7 @@ static void hns_get_pauseparam(struct net_device *net_dev, · 11 unmodified lines
701 701
702/**702/**
703 * hns_set_pauseparam - set pause parameter703 * hns_set_pauseparam - set pause parameter
704 * @dev: net device704 * @net_dev: net device
705 * @param: pause parameter705 * @param: pause parameter
706 *706 *
707 * Return 0 on success, negative on failure707 * Return 0 on success, negative on failure
@@ -725,7 +725,7 @@ static int hns_set_pauseparam(struct net_device *net_dev, · 17 unmodified lines
725 725
726/**726/**
727 * hns_get_coalesce - get coalesce info.727 * hns_get_coalesce - get coalesce info.
728 * @dev: net device728 * @net_dev: net device
729 * @ec: coalesce info.729 * @ec: coalesce info.
730 *730 *
731 * Return 0 on success, negative on failure.731 * Return 0 on success, negative on failure.
@@ -769,7 +769,7 @@ static int hns_get_coalesce(struct net_device *net_dev, · 37 unmodified lines
769 769
770/**770/**
771 * hns_set_coalesce - set coalesce info.771 * hns_set_coalesce - set coalesce info.
772 * @dev: net device772 * @net_dev: net device
773 * @ec: coalesce info.773 * @ec: coalesce info.
774 *774 *
775 * Return 0 on success, negative on failure.775 * Return 0 on success, negative on failure.
@@ -808,7 +808,7 @@ static int hns_set_coalesce(struct net_device *net_dev, · 32 unmodified lines
808 808
809/**809/**
810 * hns_get_channels - get channel info.810 * hns_get_channels - get channel info.
811 * @dev: net device811 * @net_dev: net device
812 * @ch: channel info.812 * @ch: channel info.
813 */813 */
814static void814static void
@@ -825,7 +825,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch) · 10 unmodified lines
825 825
826/**826/**
827 * get_ethtool_stats - get detail statistics.827 * get_ethtool_stats - get detail statistics.
828 * @dev: net device828 * @netdev: net device
829 * @stats: statistics info.829 * @stats: statistics info.
830 * @data: statistics data.830 * @data: statistics data.
831 */831 */
@@ -883,8 +883,8 @@ static void hns_get_ethtool_stats(struct net_device *netdev, · 51 unmodified lines
883 883
884/**884/**
885 * get_strings: Return a set of strings that describe the requested objects885 * get_strings: Return a set of strings that describe the requested objects
886 * @dev: net device886 * @netdev: net device
887 * @stats: string set ID.887 * @stringset: string set ID.
888 * @data: objects data.888 * @data: objects data.
889 */889 */
890static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)890static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
@@ -972,7 +972,7 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 81 unmodified lines
972 972
973/**973/**
974 * nic_get_sset_count - get string set count witch returned by nic_get_strings.974 * nic_get_sset_count - get string set count witch returned by nic_get_strings.
975 * @dev: net device975 * @netdev: net device
976 * @stringset: string set index, 0: self test string; 1: statistics string.976 * @stringset: string set index, 0: self test string; 1: statistics string.
977 *977 *
978 * Return string set count.978 * Return string set count.
@@ -1006,7 +1006,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset) · 27 unmodified lines
1006 1006
1007/**1007/**
1008 * hns_phy_led_set - set phy LED status.1008 * hns_phy_led_set - set phy LED status.
1009 * @dev: net device1009 * @netdev: net device
1010 * @value: LED state.1010 * @value: LED state.
1011 *1011 *
1012 * Return 0 on success, negative on failure.1012 * Return 0 on success, negative on failure.
@@ -1028,7 +1028,7 @@ static int hns_phy_led_set(struct net_device *netdev, int value) · 15 unmodified lines
1028 1028
1029/**1029/**
1030 * nic_set_phys_id - set phy identify LED.1030 * nic_set_phys_id - set phy identify LED.
1031 * @dev: net device1031 * @netdev: net device
1032 * @state: LED state.1032 * @state: LED state.
1033 *1033 *
1034 * Return 0 on success, negative on failure.1034 * Return 0 on success, negative on failure.
@@ -1104,9 +1104,9 @@ hns_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state) · 69 unmodified lines
1104 1104
1105/**1105/**
1106 * hns_get_regs - get net device register1106 * hns_get_regs - get net device register
1107 * @dev: net device1107 * @net_dev: net device
1108 * @cmd: ethtool cmd1108 * @cmd: ethtool cmd
1109 * @date: register data1109 * @data: register data
1110 */1110 */
1111static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,1111static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
1112 void *data)1112 void *data)
@@ -1126,7 +1126,7 @@ static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd, · 13 unmodified lines
1126 1126
1127/**1127/**
1128 * nic_get_regs_len - get total register len.1128 * nic_get_regs_len - get total register len.
1129 * @dev: net device1129 * @net_dev: net device
1130 *1130 *
1131 * Return total register len.1131 * Return total register len.
1132 */1132 */
@@ -1151,7 +1151,7 @@ static int hns_get_regs_len(struct net_device *net_dev) · 18 unmodified lines
1151 1151
1152/**1152/**
1153 * hns_nic_nway_reset - nway reset1153 * hns_nic_nway_reset - nway reset
1154 * @dev: net device1154 * @netdev: net device
1155 *1155 *
1156 * Return 0 on success, negative on failure1156 * Return 0 on success, negative on failure
1157 */1157 */
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c+4−0
@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev, · 1653 unmodified lines
1654 }1654 }
1655 1655
1656 netif_carrier_off(netdev);1656 netif_carrier_off(netdev);
1657 netif_tx_disable(netdev);
1657 1658
1658 err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,1659 err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
1659 &test_index);1660 &test_index);
@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev, · 2 unmodified lines
1662 data[test_index] = 1;1663 data[test_index] = 1;
1663 }1664 }
1664 1665
1666 netif_tx_wake_all_queues(netdev);
1667
1665 err = hinic_port_link_state(nic_dev, &link_state);1668 err = hinic_port_link_state(nic_dev, &link_state);
1666 if (!err && link_state == HINIC_LINK_STATE_UP)1669 if (!err && link_state == HINIC_LINK_STATE_UP)
1667 netif_carrier_on(netdev);1670 netif_carrier_on(netdev);
1671
1668}1672}
1669 1673
1670static int hinic_set_phys_id(struct net_device *netdev,1674static int hinic_set_phys_id(struct net_device *netdev,
drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c+15−5
@@ -47,8 +47,12 @@ · 46 unmodified lines
47 47
48#define MGMT_MSG_TIMEOUT 500048#define MGMT_MSG_TIMEOUT 5000
49 49
50#define SET_FUNC_PORT_MBOX_TIMEOUT 30000
51
50#define SET_FUNC_PORT_MGMT_TIMEOUT 2500052#define SET_FUNC_PORT_MGMT_TIMEOUT 25000
51 53
54#define UPDATE_FW_MGMT_TIMEOUT 20000
55
52#define mgmt_to_pfhwdev(pf_mgmt) \56#define mgmt_to_pfhwdev(pf_mgmt) \
53 container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)57 container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
54 58
@@ -361,16 +365,22 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, · 306 unmodified lines
361 return -EINVAL;365 return -EINVAL;
362 }366 }
363 367
364 if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)368 if (HINIC_IS_VF(hwif)) {
365 timeout = SET_FUNC_PORT_MGMT_TIMEOUT;369 if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
370 timeout = SET_FUNC_PORT_MBOX_TIMEOUT;
366 371
367 if (HINIC_IS_VF(hwif))
368 return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,372 return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,
369 in_size, buf_out, out_size, 0);373 in_size, buf_out, out_size, timeout);
370 else374 } else {
375 if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
376 timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
377 else if (cmd == HINIC_PORT_CMD_UPDATE_FW)
378 timeout = UPDATE_FW_MGMT_TIMEOUT;
379
371 return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,380 return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
372 buf_out, out_size, MGMT_DIRECT_SEND,381 buf_out, out_size, MGMT_DIRECT_SEND,
373 MSG_NOT_RESP, timeout);382 MSG_NOT_RESP, timeout);
383 }
374}384}
375 385
376static void recv_mgmt_msg_work_handler(struct work_struct *work)386static void recv_mgmt_msg_work_handler(struct work_struct *work)
drivers/net/ethernet/huawei/hinic/hinic_main.c+24−0
@@ -174,6 +174,24 @@ err_init_txq: · 173 unmodified lines
174 return err;174 return err;
175}175}
176 176
177static void enable_txqs_napi(struct hinic_dev *nic_dev)
178{
179 int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
180 int i;
181
182 for (i = 0; i < num_txqs; i++)
183 napi_enable(&nic_dev->txqs[i].napi);
184}
185
186static void disable_txqs_napi(struct hinic_dev *nic_dev)
187{
188 int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
189 int i;
190
191 for (i = 0; i < num_txqs; i++)
192 napi_disable(&nic_dev->txqs[i].napi);
193}
194
177/**195/**
178 * free_txqs - Free the Logical Tx Queues of specific NIC device196 * free_txqs - Free the Logical Tx Queues of specific NIC device
179 * @nic_dev: the specific NIC device197 * @nic_dev: the specific NIC device
@@ -400,6 +418,8 @@ int hinic_open(struct net_device *netdev) · 220 unmodified lines
400 goto err_create_txqs;418 goto err_create_txqs;
401 }419 }
402 420
421 enable_txqs_napi(nic_dev);
422
403 err = create_rxqs(nic_dev);423 err = create_rxqs(nic_dev);
404 if (err) {424 if (err) {
405 netif_err(nic_dev, drv, netdev,425 netif_err(nic_dev, drv, netdev,
@@ -484,6 +504,7 @@ err_port_state: · 78 unmodified lines
484 }504 }
485 505
486err_create_rxqs:506err_create_rxqs:
507 disable_txqs_napi(nic_dev);
487 free_txqs(nic_dev);508 free_txqs(nic_dev);
488 509
489err_create_txqs:510err_create_txqs:
@@ -497,6 +518,9 @@ int hinic_close(struct net_device *netdev) · 7 unmodified lines
497 struct hinic_dev *nic_dev = netdev_priv(netdev);518 struct hinic_dev *nic_dev = netdev_priv(netdev);
498 unsigned int flags;519 unsigned int flags;
499 520
521 /* Disable txq napi firstly to aviod rewaking txq in free_tx_poll */
522 disable_txqs_napi(nic_dev);
523
500 down(&nic_dev->mgmt_lock);524 down(&nic_dev->mgmt_lock);
501 525
502 flags = nic_dev->flags;526 flags = nic_dev->flags;
drivers/net/ethernet/huawei/hinic/hinic_rx.c+14−7
@@ -543,18 +543,25 @@ static int rx_request_irq(struct hinic_rxq *rxq) · 542 unmodified lines
543 if (err) {543 if (err) {
544 netif_err(nic_dev, drv, rxq->netdev,544 netif_err(nic_dev, drv, rxq->netdev,
545 "Failed to set RX interrupt coalescing attribute\n");545 "Failed to set RX interrupt coalescing attribute\n");
546 rx_del_napi(rxq);546 goto err_req_irq;
547 return err;
548 }547 }
549 548
550 err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq);549 err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq);
551 if (err) {550 if (err)
552 rx_del_napi(rxq);551 goto err_req_irq;
553 return err;
554 }
555 552
556 cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask);553 cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask);
557 return irq_set_affinity_hint(rq->irq, &rq->affinity_mask);554 err = irq_set_affinity_hint(rq->irq, &rq->affinity_mask);
555 if (err)
556 goto err_irq_affinity;
557
558 return 0;
559
560err_irq_affinity:
561 free_irq(rq->irq, rxq);
562err_req_irq:
563 rx_del_napi(rxq);
564 return err;
558}565}
559 566
560static void rx_free_irq(struct hinic_rxq *rxq)567static void rx_free_irq(struct hinic_rxq *rxq)
drivers/net/ethernet/huawei/hinic/hinic_tx.c+6−18
@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget) · 716 unmodified lines
717 netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);717 netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
718 718
719 __netif_tx_lock(netdev_txq, smp_processor_id());719 __netif_tx_lock(netdev_txq, smp_processor_id());
720 720 if (!netif_testing(nic_dev->netdev))
721 netif_wake_subqueue(nic_dev->netdev, qp->q_id);721 netif_wake_subqueue(nic_dev->netdev, qp->q_id);
722 722
723 __netif_tx_unlock(netdev_txq);723 __netif_tx_unlock(netdev_txq);
724 724
@@ -745,18 +745,6 @@ static int free_tx_poll(struct napi_struct *napi, int budget) · 20 unmodified lines
745 return budget;745 return budget;
746}746}
747 747
748static void tx_napi_add(struct hinic_txq *txq, int weight)
749{
750 netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, weight);
751 napi_enable(&txq->napi);
752}
753
754static void tx_napi_del(struct hinic_txq *txq)
755{
756 napi_disable(&txq->napi);
757 netif_napi_del(&txq->napi);
758}
759
760static irqreturn_t tx_irq(int irq, void *data)748static irqreturn_t tx_irq(int irq, void *data)
761{749{
762 struct hinic_txq *txq = data;750 struct hinic_txq *txq = data;
@@ -790,7 +778,7 @@ static int tx_request_irq(struct hinic_txq *txq) · 27 unmodified lines
790 778
791 qp = container_of(sq, struct hinic_qp, sq);779 qp = container_of(sq, struct hinic_qp, sq);
792 780
793 tx_napi_add(txq, nic_dev->tx_weight);781 netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, nic_dev->tx_weight);
794 782
795 hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry,783 hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry,
796 TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC,784 TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC,
@@ -807,14 +795,14 @@ static int tx_request_irq(struct hinic_txq *txq) · 10 unmodified lines
807 if (err) {795 if (err) {
808 netif_err(nic_dev, drv, txq->netdev,796 netif_err(nic_dev, drv, txq->netdev,
809 "Failed to set TX interrupt coalescing attribute\n");797 "Failed to set TX interrupt coalescing attribute\n");
810 tx_napi_del(txq);798 netif_napi_del(&txq->napi);
811 return err;799 return err;
812 }800 }
813 801
814 err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq);802 err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq);
815 if (err) {803 if (err) {
816 dev_err(&pdev->dev, "Failed to request Tx irq\n");804 dev_err(&pdev->dev, "Failed to request Tx irq\n");
817 tx_napi_del(txq);805 netif_napi_del(&txq->napi);
818 return err;806 return err;
819 }807 }
820 808
@@ -826,7 +814,7 @@ static void tx_free_irq(struct hinic_txq *txq) · 5 unmodified lines
826 struct hinic_sq *sq = txq->sq;814 struct hinic_sq *sq = txq->sq;
827 815
828 free_irq(sq->irq, txq);816 free_irq(sq->irq, txq);
829 tx_napi_del(txq);817 netif_napi_del(&txq->napi);
830}818}
831 819
832/**820/**
drivers/net/ethernet/ibm/ibmvnic.c+4−2
@@ -2032,16 +2032,18 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 2031 unmodified lines
2032 2032
2033 } else {2033 } else {
2034 rc = reset_tx_pools(adapter);2034 rc = reset_tx_pools(adapter);
2035 if (rc)2035 if (rc) {
2036 netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",2036 netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",
2037 rc);2037 rc);
2038 goto out;2038 goto out;
2039 }
2039 2040
2040 rc = reset_rx_pools(adapter);2041 rc = reset_rx_pools(adapter);
2041 if (rc)2042 if (rc) {
2042 netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",2043 netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",
2043 rc);2044 rc);
2044 goto out;2045 goto out;
2046 }
2045 }2047 }
2046 ibmvnic_disable_irqs(adapter);2048 ibmvnic_disable_irqs(adapter);
2047 }2049 }
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+16−6
@@ -1115,7 +1115,7 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf) · 1114 unmodified lines
1115static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)1115static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
1116{1116{
1117 struct i40e_mac_filter *f;1117 struct i40e_mac_filter *f;
1118 int num_vlans = 0, bkt;1118 u16 num_vlans = 0, bkt;
1119 1119
1120 hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {1120 hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {
1121 if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)1121 if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)
@@ -1134,8 +1134,8 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) · 12 unmodified lines
1134 *1134 *
1135 * Called to get number of VLANs and VLAN list present in mac_filter_hash.1135 * Called to get number of VLANs and VLAN list present in mac_filter_hash.
1136 **/1136 **/
1137static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,1137static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans,
1138 s16 **vlan_list)1138 s16 **vlan_list)
1139{1139{
1140 struct i40e_mac_filter *f;1140 struct i40e_mac_filter *f;
1141 int i = 0;1141 int i = 0;
@@ -1169,11 +1169,11 @@ err: · 27 unmodified lines
1169 **/1169 **/
1170static i40e_status1170static i40e_status
1171i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,1171i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
1172 bool unicast_enable, s16 *vl, int num_vlans)1172 bool unicast_enable, s16 *vl, u16 num_vlans)
1173{1173{
1174 i40e_status aq_ret, aq_tmp = 0;
1174 struct i40e_pf *pf = vf->pf;1175 struct i40e_pf *pf = vf->pf;
1175 struct i40e_hw *hw = &pf->hw;1176 struct i40e_hw *hw = &pf->hw;
1176 i40e_status aq_ret;
1177 int i;1177 int i;
1178 1178
1179 /* No VLAN to set promisc on, set on VSI */1179 /* No VLAN to set promisc on, set on VSI */
@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, · 42 unmodified lines
1222 vf->vf_id,1222 vf->vf_id,
1223 i40e_stat_str(&pf->hw, aq_ret),1223 i40e_stat_str(&pf->hw, aq_ret),
1224 i40e_aq_str(&pf->hw, aq_err));1224 i40e_aq_str(&pf->hw, aq_err));
1225
1226 if (!aq_tmp)
1227 aq_tmp = aq_ret;
1225 }1228 }
1226 1229
1227 aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,1230 aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,
@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, · 7 unmodified lines
1235 vf->vf_id,1238 vf->vf_id,
1236 i40e_stat_str(&pf->hw, aq_ret),1239 i40e_stat_str(&pf->hw, aq_ret),
1237 i40e_aq_str(&pf->hw, aq_err));1240 i40e_aq_str(&pf->hw, aq_err));
1241
1242 if (!aq_tmp)
1243 aq_tmp = aq_ret;
1238 }1244 }
1239 }1245 }
1246
1247 if (aq_tmp)
1248 aq_ret = aq_tmp;
1249
1240 return aq_ret;1250 return aq_ret;
1241}1251}
1242 1252
@@ -1258,7 +1268,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, · 15 unmodified lines
1258 i40e_status aq_ret = I40E_SUCCESS;1268 i40e_status aq_ret = I40E_SUCCESS;
1259 struct i40e_pf *pf = vf->pf;1269 struct i40e_pf *pf = vf->pf;
1260 struct i40e_vsi *vsi;1270 struct i40e_vsi *vsi;
1261 int num_vlans;1271 u16 num_vlans;
1262 s16 *vl;1272 s16 *vl;
1263 1273
1264 vsi = i40e_find_vsi_from_id(pf, vsi_id);1274 vsi = i40e_find_vsi_from_id(pf, vsi_id);
drivers/net/ethernet/intel/igc/igc.h+8−12
@@ -299,18 +299,14 @@ extern char igc_driver_name[]; · 298 unmodified lines
299#define IGC_RX_HDR_LEN IGC_RXBUFFER_256299#define IGC_RX_HDR_LEN IGC_RXBUFFER_256
300 300
301/* Transmit and receive latency (for PTP timestamps) */301/* Transmit and receive latency (for PTP timestamps) */
302/* FIXME: These values were estimated using the ones that i225 has as302#define IGC_I225_TX_LATENCY_10 240
303 * basis, they seem to provide good numbers with ptp4l/phc2sys, but we303#define IGC_I225_TX_LATENCY_100 58
304 * need to confirm them.304#define IGC_I225_TX_LATENCY_1000 80
305 */305#define IGC_I225_TX_LATENCY_2500 1325
306#define IGC_I225_TX_LATENCY_10 9542306#define IGC_I225_RX_LATENCY_10 6450
307#define IGC_I225_TX_LATENCY_100 1024307#define IGC_I225_RX_LATENCY_100 185
308#define IGC_I225_TX_LATENCY_1000 178308#define IGC_I225_RX_LATENCY_1000 300
309#define IGC_I225_TX_LATENCY_2500 64309#define IGC_I225_RX_LATENCY_2500 1485
310#define IGC_I225_RX_LATENCY_10 20662
311#define IGC_I225_RX_LATENCY_100 2213
312#define IGC_I225_RX_LATENCY_1000 448
313#define IGC_I225_RX_LATENCY_2500 160
314 310
315/* RX and TX descriptor control thresholds.311/* RX and TX descriptor control thresholds.
316 * PTHRESH - MAC will consider prefetch if it has fewer than this number of312 * PTHRESH - MAC will consider prefetch if it has fewer than this number of
drivers/net/ethernet/intel/igc/igc_ptp.c+19−0
@@ -364,6 +364,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) · 363 unmodified lines
364 struct sk_buff *skb = adapter->ptp_tx_skb;364 struct sk_buff *skb = adapter->ptp_tx_skb;
365 struct skb_shared_hwtstamps shhwtstamps;365 struct skb_shared_hwtstamps shhwtstamps;
366 struct igc_hw *hw = &adapter->hw;366 struct igc_hw *hw = &adapter->hw;
367 int adjust = 0;
367 u64 regval;368 u64 regval;
368 369
369 if (WARN_ON_ONCE(!skb))370 if (WARN_ON_ONCE(!skb))
@@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) · 3 unmodified lines
373 regval |= (u64)rd32(IGC_TXSTMPH) << 32;374 regval |= (u64)rd32(IGC_TXSTMPH) << 32;
374 igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);375 igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
375 376
377 switch (adapter->link_speed) {
378 case SPEED_10:
379 adjust = IGC_I225_TX_LATENCY_10;
380 break;
381 case SPEED_100:
382 adjust = IGC_I225_TX_LATENCY_100;
383 break;
384 case SPEED_1000:
385 adjust = IGC_I225_TX_LATENCY_1000;
386 break;
387 case SPEED_2500:
388 adjust = IGC_I225_TX_LATENCY_2500;
389 break;
390 }
391
392 shhwtstamps.hwtstamp =
393 ktime_add_ns(shhwtstamps.hwtstamp, adjust);
394
376 /* Clear the lock early before calling skb_tstamp_tx so that395 /* Clear the lock early before calling skb_tstamp_tx so that
377 * applications are not woken up before the lock bit is clear. We use396 * applications are not woken up before the lock bit is clear. We use
378 * a copy of the skb pointer to ensure other threads can't change it397 * a copy of the skb pointer to ensure other threads can't change it
drivers/net/ethernet/lantiq_xrx200.c+13−8
@@ -230,8 +230,8 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget) · 229 unmodified lines
230 }230 }
231 231
232 if (rx < budget) {232 if (rx < budget) {
233 napi_complete(&ch->napi);233 if (napi_complete_done(&ch->napi, rx))
234 ltq_dma_enable_irq(&ch->dma);234 ltq_dma_enable_irq(&ch->dma);
235 }235 }
236 236
237 return rx;237 return rx;
@@ -268,9 +268,12 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) · 30 unmodified lines
268 net_dev->stats.tx_bytes += bytes;268 net_dev->stats.tx_bytes += bytes;
269 netdev_completed_queue(ch->priv->net_dev, pkts, bytes);269 netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
270 270
271 if (netif_queue_stopped(net_dev))
272 netif_wake_queue(net_dev);
273
271 if (pkts < budget) {274 if (pkts < budget) {
272 napi_complete(&ch->napi);275 if (napi_complete_done(&ch->napi, pkts))
273 ltq_dma_enable_irq(&ch->dma);276 ltq_dma_enable_irq(&ch->dma);
274 }277 }
275 278
276 return pkts;279 return pkts;
@@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) · 65 unmodified lines
342{345{
343 struct xrx200_chan *ch = ptr;346 struct xrx200_chan *ch = ptr;
344 347
345 ltq_dma_disable_irq(&ch->dma);348 if (napi_schedule_prep(&ch->napi)) {
346 ltq_dma_ack_irq(&ch->dma);349 __napi_schedule(&ch->napi);
350 ltq_dma_disable_irq(&ch->dma);
351 }
347 352
348 napi_schedule(&ch->napi);353 ltq_dma_ack_irq(&ch->dma);
349 354
350 return IRQ_HANDLED;355 return IRQ_HANDLED;
351}356}
@@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev) · 147 unmodified lines
499 504
500 /* setup NAPI */505 /* setup NAPI */
501 netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32);506 netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32);
502 netif_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);507 netif_tx_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
503 508
504 platform_set_drvdata(pdev, priv);509 platform_set_drvdata(pdev, priv);
505 510
drivers/net/ethernet/marvell/mvneta.c+7−3
@@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq, · 2028 unmodified lines
2029 struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);2029 struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
2030 int i;2030 int i;
2031 2031
2032 page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
2033 sync_len, napi);
2034 for (i = 0; i < sinfo->nr_frags; i++)2032 for (i = 0; i < sinfo->nr_frags; i++)
2035 page_pool_put_full_page(rxq->page_pool,2033 page_pool_put_full_page(rxq->page_pool,
2036 skb_frag_page(&sinfo->frags[i]), napi);2034 skb_frag_page(&sinfo->frags[i]), napi);
2035 page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
2036 sync_len, napi);
2037}2037}
2038 2038
2039static int2039static int
@@ -2383,8 +2383,12 @@ static int mvneta_rx_swbm(struct napi_struct *napi, · 343 unmodified lines
2383 mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,2383 mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,
2384 &size, page, &ps);2384 &size, page, &ps);
2385 } else {2385 } else {
2386 if (unlikely(!xdp_buf.data_hard_start))2386 if (unlikely(!xdp_buf.data_hard_start)) {
2387 rx_desc->buf_phys_addr = 0;
2388 page_pool_put_full_page(rxq->page_pool, page,
2389 true);
2387 continue;2390 continue;
2391 }
2388 2392
2389 mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf,2393 mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf,
2390 &size, page);2394 &size, page);
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−2
@@ -600,7 +600,7 @@ struct mlx5e_rq { · 599 unmodified lines
600 struct dim dim; /* Dynamic Interrupt Moderation */600 struct dim dim; /* Dynamic Interrupt Moderation */
601 601
602 /* XDP */602 /* XDP */
603 struct bpf_prog *xdp_prog;603 struct bpf_prog __rcu *xdp_prog;
604 struct mlx5e_xdpsq *xdpsq;604 struct mlx5e_xdpsq *xdpsq;
605 DECLARE_BITMAP(flags, 8);605 DECLARE_BITMAP(flags, 8);
606 struct page_pool *page_pool;606 struct page_pool *page_pool;
@@ -1005,7 +1005,6 @@ int mlx5e_update_nic_rx(struct mlx5e_priv *priv); · 398 unmodified lines
1005void mlx5e_update_carrier(struct mlx5e_priv *priv);1005void mlx5e_update_carrier(struct mlx5e_priv *priv);
1006int mlx5e_close(struct net_device *netdev);1006int mlx5e_close(struct net_device *netdev);
1007int mlx5e_open(struct net_device *netdev);1007int mlx5e_open(struct net_device *netdev);
1008void mlx5e_update_ndo_stats(struct mlx5e_priv *priv);
1009 1008
1010void mlx5e_queue_update_stats(struct mlx5e_priv *priv);1009void mlx5e_queue_update_stats(struct mlx5e_priv *priv);
1011int mlx5e_bits_invert(unsigned long a, int size);1010int mlx5e_bits_invert(unsigned long a, int size);
drivers/net/ethernet/mellanox/mlx5/core/en/monitor_stats.c+1−1
@@ -51,7 +51,7 @@ static void mlx5e_monitor_counters_work(struct work_struct *work) · 50 unmodified lines
51 monitor_counters_work);51 monitor_counters_work);
52 52
53 mutex_lock(&priv->state_lock);53 mutex_lock(&priv->state_lock);
54 mlx5e_update_ndo_stats(priv);54 mlx5e_stats_update_ndo_stats(priv);
55 mutex_unlock(&priv->state_lock);55 mutex_unlock(&priv->state_lock);
56 mlx5e_monitor_counter_arm(priv);56 mlx5e_monitor_counter_arm(priv);
57}57}
drivers/net/ethernet/mellanox/mlx5/core/en/port.c+2−5
@@ -490,11 +490,8 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy) · 489 unmodified lines
490 int err;490 int err;
491 int i;491 int i;
492 492
493 if (!MLX5_CAP_GEN(dev, pcam_reg))493 if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm))
494 return -EOPNOTSUPP;494 return false;
495
496 if (!MLX5_CAP_PCAM_REG(dev, pplm))
497 return -EOPNOTSUPP;
498 495
499 MLX5_SET(pplm_reg, in, local_port, 1);496 MLX5_SET(pplm_reg, in, local_port, 1);
500 err = mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);497 err = mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+16−5
@@ -699,6 +699,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 698 unmodified lines
699err_rule:699err_rule:
700 mlx5e_mod_hdr_detach(ct_priv->esw->dev,700 mlx5e_mod_hdr_detach(ct_priv->esw->dev,
701 &esw->offloads.mod_hdr, zone_rule->mh);701 &esw->offloads.mod_hdr, zone_rule->mh);
702 mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id);
702err_mod_hdr:703err_mod_hdr:
703 kfree(spec);704 kfree(spec);
704 return err;705 return err;
@@ -958,12 +959,22 @@ mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv, · 253 unmodified lines
958 return 0;959 return 0;
959}960}
960 961
962void mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr)
963{
964 struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
965
966 if (!ct_priv || !ct_attr->ct_labels_id)
967 return;
968
969 mapping_remove(ct_priv->labels_mapping, ct_attr->ct_labels_id);
970}
971
961int972int
962mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,973mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
963 struct mlx5_flow_spec *spec,974 struct mlx5_flow_spec *spec,
964 struct flow_cls_offload *f,975 struct flow_cls_offload *f,
965 struct mlx5_ct_attr *ct_attr,976 struct mlx5_ct_attr *ct_attr,
966 struct netlink_ext_ack *extack)977 struct netlink_ext_ack *extack)
967{978{
968 struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);979 struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
969 struct flow_rule *rule = flow_cls_offload_flow_rule(f);980 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h+16−10
@@ -87,12 +87,15 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv); · 86 unmodified lines
87void87void
88mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv);88mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv);
89 89
90void
91mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr);
92
90int93int
91mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,94mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
92 struct mlx5_flow_spec *spec,95 struct mlx5_flow_spec *spec,
93 struct flow_cls_offload *f,96 struct flow_cls_offload *f,
94 struct mlx5_ct_attr *ct_attr,97 struct mlx5_ct_attr *ct_attr,
95 struct netlink_ext_ack *extack);98 struct netlink_ext_ack *extack);
96int99int
97mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,100mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
98 struct mlx5_flow_spec *spec);101 struct mlx5_flow_spec *spec);
@@ -130,12 +133,15 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv) · 31 unmodified lines
130{133{
131}134}
132 135
136static inline void
137mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) {}
138
133static inline int139static inline int
134mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,140mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
135 struct mlx5_flow_spec *spec,141 struct mlx5_flow_spec *spec,
136 struct flow_cls_offload *f,142 struct flow_cls_offload *f,
137 struct mlx5_ct_attr *ct_attr,143 struct mlx5_ct_attr *ct_attr,
138 struct netlink_ext_ack *extack)144 struct netlink_ext_ack *extack)
139{145{
140 struct flow_rule *rule = flow_cls_offload_flow_rule(f);146 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
141 147
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+5−0
@@ -20,6 +20,11 @@ enum mlx5e_icosq_wqe_type { · 19 unmodified lines
20};20};
21 21
22/* General */22/* General */
23static inline bool mlx5e_skb_is_multicast(struct sk_buff *skb)
24{
25 return skb->pkt_type == PACKET_MULTICAST || skb->pkt_type == PACKET_BROADCAST;
26}
27
23void mlx5e_trigger_irq(struct mlx5e_icosq *sq);28void mlx5e_trigger_irq(struct mlx5e_icosq *sq);
24void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);29void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);
25void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);30void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c+1−1
@@ -122,7 +122,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq, · 121 unmodified lines
122bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,122bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
123 u32 *len, struct xdp_buff *xdp)123 u32 *len, struct xdp_buff *xdp)
124{124{
125 struct bpf_prog *prog = READ_ONCE(rq->xdp_prog);125 struct bpf_prog *prog = rcu_dereference(rq->xdp_prog);
126 u32 act;126 u32 act;
127 int err;127 int err;
128 128
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c+2−12
@@ -31,7 +31,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 30 unmodified lines
31{31{
32 struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk;32 struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk;
33 u32 cqe_bcnt32 = cqe_bcnt;33 u32 cqe_bcnt32 = cqe_bcnt;
34 bool consumed;
35 34
36 /* Check packet size. Note LRO doesn't use linear SKB */35 /* Check packet size. Note LRO doesn't use linear SKB */
37 if (unlikely(cqe_bcnt > rq->hw_mtu)) {36 if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -51,10 +50,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 13 unmodified lines
51 xsk_buff_dma_sync_for_cpu(xdp);50 xsk_buff_dma_sync_for_cpu(xdp);
52 prefetch(xdp->data);51 prefetch(xdp->data);
53 52
54 rcu_read_lock();
55 consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp);
56 rcu_read_unlock();
57
58 /* Possible flows:53 /* Possible flows:
59 * - XDP_REDIRECT to XSKMAP:54 * - XDP_REDIRECT to XSKMAP:
60 * The page is owned by the userspace from now.55 * The page is owned by the userspace from now.
@@ -70,7 +65,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 9 unmodified lines
70 * allocated first from the Reuse Ring, so it has enough space.65 * allocated first from the Reuse Ring, so it has enough space.
71 */66 */
72 67
73 if (likely(consumed)) {68 if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp))) {
74 if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))69 if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))
75 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */70 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
76 return NULL; /* page/packet was consumed by XDP */71 return NULL; /* page/packet was consumed by XDP */
@@ -88,7 +83,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 11 unmodified lines
88 u32 cqe_bcnt)83 u32 cqe_bcnt)
89{84{
90 struct xdp_buff *xdp = wi->di->xsk;85 struct xdp_buff *xdp = wi->di->xsk;
91 bool consumed;
92 86
93 /* wi->offset is not used in this function, because xdp->data and the87 /* wi->offset is not used in this function, because xdp->data and the
94 * DMA address point directly to the necessary place. Furthermore, the88 * DMA address point directly to the necessary place. Furthermore, the
@@ -107,11 +101,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 12 unmodified lines
107 return NULL;101 return NULL;
108 }102 }
109 103
110 rcu_read_lock();104 if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp)))
111 consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp);
112 rcu_read_unlock();
113
114 if (likely(consumed))
115 return NULL; /* page/packet was consumed by XDP */105 return NULL; /* page/packet was consumed by XDP */
116 106
117 /* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse107 /* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c+1−2
@@ -106,8 +106,7 @@ err_free_cparam: · 105 unmodified lines
106void mlx5e_close_xsk(struct mlx5e_channel *c)106void mlx5e_close_xsk(struct mlx5e_channel *c)
107{107{
108 clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state);108 clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
109 napi_synchronize(&c->napi);109 synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */
110 synchronize_rcu(); /* Sync with the XSK wakeup. */
111 110
112 mlx5e_close_rq(&c->xskrq);111 mlx5e_close_rq(&c->xskrq);
113 mlx5e_close_cq(&c->xskrq.cq);112 mlx5e_close_cq(&c->xskrq.cq);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c+22−21
@@ -234,7 +234,7 @@ mlx5e_get_ktls_rx_priv_ctx(struct tls_context *tls_ctx) · 233 unmodified lines
234 234
235/* Re-sync */235/* Re-sync */
236/* Runs in work context */236/* Runs in work context */
237static struct mlx5_wqe_ctrl_seg *237static int
238resync_post_get_progress_params(struct mlx5e_icosq *sq,238resync_post_get_progress_params(struct mlx5e_icosq *sq,
239 struct mlx5e_ktls_offload_context_rx *priv_rx)239 struct mlx5e_ktls_offload_context_rx *priv_rx)
240{240{
@@ -258,15 +258,19 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 17 unmodified lines
258 PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);258 PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
259 if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {259 if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {
260 err = -ENOMEM;260 err = -ENOMEM;
261 goto err_out;261 goto err_free;
262 }262 }
263 263
264 buf->priv_rx = priv_rx;264 buf->priv_rx = priv_rx;
265 265
266 BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);266 BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
267
268 spin_lock(&sq->channel->async_icosq_lock);
269
267 if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {270 if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
271 spin_unlock(&sq->channel->async_icosq_lock);
268 err = -ENOSPC;272 err = -ENOSPC;
269 goto err_out;273 goto err_dma_unmap;
270 }274 }
271 275
272 pi = mlx5e_icosq_get_next_pi(sq, 1);276 pi = mlx5e_icosq_get_next_pi(sq, 1);
@@ -294,12 +298,18 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 21 unmodified lines
294 };298 };
295 icosq_fill_wi(sq, pi, &wi);299 icosq_fill_wi(sq, pi, &wi);
296 sq->pc++;300 sq->pc++;
301 mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
302 spin_unlock(&sq->channel->async_icosq_lock);
297 303
298 return cseg;304 return 0;
299 305
306err_dma_unmap:
307 dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
308err_free:
309 kfree(buf);
300err_out:310err_out:
301 priv_rx->stats->tls_resync_req_skip++;311 priv_rx->stats->tls_resync_req_skip++;
302 return ERR_PTR(err);312 return err;
303}313}
304 314
305/* Function is called with elevated refcount.315/* Function is called with elevated refcount.
@@ -309,10 +319,8 @@ static void resync_handle_work(struct work_struct *work) · 3 unmodified lines
309{319{
310 struct mlx5e_ktls_offload_context_rx *priv_rx;320 struct mlx5e_ktls_offload_context_rx *priv_rx;
311 struct mlx5e_ktls_rx_resync_ctx *resync;321 struct mlx5e_ktls_rx_resync_ctx *resync;
312 struct mlx5_wqe_ctrl_seg *cseg;
313 struct mlx5e_channel *c;322 struct mlx5e_channel *c;
314 struct mlx5e_icosq *sq;323 struct mlx5e_icosq *sq;
315 struct mlx5_wq_cyc *wq;
316 324
317 resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work);325 resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work);
318 priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync);326 priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync);
@@ -324,18 +332,9 @@ static void resync_handle_work(struct work_struct *work) · 5 unmodified lines
324 332
325 c = resync->priv->channels.c[priv_rx->rxq];333 c = resync->priv->channels.c[priv_rx->rxq];
326 sq = &c->async_icosq;334 sq = &c->async_icosq;
327 wq = &sq->wq;
328
329 spin_lock(&c->async_icosq_lock);
330 335
331 cseg = resync_post_get_progress_params(sq, priv_rx);336 if (resync_post_get_progress_params(sq, priv_rx))
332 if (IS_ERR(cseg)) {
333 refcount_dec(&resync->refcnt);337 refcount_dec(&resync->refcnt);
334 goto unlock;
335 }
336 mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg);
337unlock:
338 spin_unlock(&c->async_icosq_lock);
339}338}
340 339
341static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync,340static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync,
@@ -386,16 +385,17 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi, · 44 unmodified lines
386 struct mlx5e_ktls_offload_context_rx *priv_rx;385 struct mlx5e_ktls_offload_context_rx *priv_rx;
387 struct mlx5e_ktls_rx_resync_ctx *resync;386 struct mlx5e_ktls_rx_resync_ctx *resync;
388 u8 tracker_state, auth_state, *ctx;387 u8 tracker_state, auth_state, *ctx;
388 struct device *dev;
389 u32 hw_seq;389 u32 hw_seq;
390 390
391 priv_rx = buf->priv_rx;391 priv_rx = buf->priv_rx;
392 resync = &priv_rx->resync;392 resync = &priv_rx->resync;
393 393 dev = resync->priv->mdev->device;
394 if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags)))394 if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags)))
395 goto out;395 goto out;
396 396
397 dma_sync_single_for_cpu(resync->priv->mdev->device, buf->dma_addr,397 dma_sync_single_for_cpu(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE,
398 PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);398 DMA_FROM_DEVICE);
399 399
400 ctx = buf->progress.ctx;400 ctx = buf->progress.ctx;
401 tracker_state = MLX5_GET(tls_progress_params, ctx, record_tracker_state);401 tracker_state = MLX5_GET(tls_progress_params, ctx, record_tracker_state);
@@ -411,6 +411,7 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi, · 9 unmodified lines
411 priv_rx->stats->tls_resync_req_end++;411 priv_rx->stats->tls_resync_req_end++;
412out:412out:
413 refcount_dec(&resync->refcnt);413 refcount_dec(&resync->refcnt);
414 dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
414 kfree(buf);415 kfree(buf);
415}416}
416 417
@@ -659,7 +660,7 @@ void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx) · 242 unmodified lines
659 priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx);660 priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx);
660 set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags);661 set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags);
661 mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL);662 mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL);
662 napi_synchronize(&priv->channels.c[priv_rx->rxq]->napi);663 synchronize_rcu(); /* Sync with NAPI */
663 if (!cancel_work_sync(&priv_rx->rule.work))664 if (!cancel_work_sync(&priv_rx->rule.work))
664 /* completion is needed, as the priv_rx in the add flow665 /* completion is needed, as the priv_rx in the add flow
665 * is maintained on the wqe info (wi), not on the socket.666 * is maintained on the wqe info (wi), not on the socket.
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c+8−4
@@ -35,7 +35,6 @@ · 34 unmodified lines
35#include <net/sock.h>35#include <net/sock.h>
36 36
37#include "en.h"37#include "en.h"
38#include "accel/tls.h"
39#include "fpga/sdk.h"38#include "fpga/sdk.h"
40#include "en_accel/tls.h"39#include "en_accel/tls.h"
41 40
@@ -51,9 +50,14 @@ static const struct counter_desc mlx5e_tls_sw_stats_desc[] = { · 9 unmodified lines
51 50
52#define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc)51#define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc)
53 52
53static bool is_tls_atomic_stats(struct mlx5e_priv *priv)
54{
55 return priv->tls && !mlx5_accel_is_ktls_device(priv->mdev);
56}
57
54int mlx5e_tls_get_count(struct mlx5e_priv *priv)58int mlx5e_tls_get_count(struct mlx5e_priv *priv)
55{59{
56 if (!priv->tls)60 if (!is_tls_atomic_stats(priv))
57 return 0;61 return 0;
58 62
59 return NUM_TLS_SW_COUNTERS;63 return NUM_TLS_SW_COUNTERS;
@@ -63,7 +67,7 @@ int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data) · 3 unmodified lines
63{67{
64 unsigned int i, idx = 0;68 unsigned int i, idx = 0;
65 69
66 if (!priv->tls)70 if (!is_tls_atomic_stats(priv))
67 return 0;71 return 0;
68 72
69 for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)73 for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
@@ -77,7 +81,7 @@ int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data) · 7 unmodified lines
77{81{
78 int i, idx = 0;82 int i, idx = 0;
79 83
80 if (!priv->tls)84 if (!is_tls_atomic_stats(priv))
81 return 0;85 return 0;
82 86
83 for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)87 for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+31−54
@@ -158,16 +158,6 @@ static void mlx5e_update_carrier_work(struct work_struct *work) · 157 unmodified lines
158 mutex_unlock(&priv->state_lock);158 mutex_unlock(&priv->state_lock);
159}159}
160 160
161void mlx5e_update_ndo_stats(struct mlx5e_priv *priv)
162{
163 int i;
164
165 for (i = mlx5e_nic_stats_grps_num(priv) - 1; i >= 0; i--)
166 if (mlx5e_nic_stats_grps[i]->update_stats_mask &
167 MLX5E_NDO_UPDATE_STATS)
168 mlx5e_nic_stats_grps[i]->update_stats(priv);
169}
170
171static void mlx5e_update_stats_work(struct work_struct *work)161static void mlx5e_update_stats_work(struct work_struct *work)
172{162{
173 struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv,163 struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv,
@@ -399,7 +389,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 225 unmodified lines
399 389
400 if (params->xdp_prog)390 if (params->xdp_prog)
401 bpf_prog_inc(params->xdp_prog);391 bpf_prog_inc(params->xdp_prog);
402 rq->xdp_prog = params->xdp_prog;392 RCU_INIT_POINTER(rq->xdp_prog, params->xdp_prog);
403 393
404 rq_xdp_ix = rq->ix;394 rq_xdp_ix = rq->ix;
405 if (xsk)395 if (xsk)
@@ -408,7 +398,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 2 unmodified lines
408 if (err < 0)398 if (err < 0)
409 goto err_rq_wq_destroy;399 goto err_rq_wq_destroy;
410 400
411 rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;401 rq->buff.map_dir = params->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
412 rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk);402 rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk);
413 pool_size = 1 << params->log_rq_mtu_frames;403 pool_size = 1 << params->log_rq_mtu_frames;
414 404
@@ -564,8 +554,8 @@ err_free: · 149 unmodified lines
564 }554 }
565 555
566err_rq_wq_destroy:556err_rq_wq_destroy:
567 if (rq->xdp_prog)557 if (params->xdp_prog)
568 bpf_prog_put(rq->xdp_prog);558 bpf_prog_put(params->xdp_prog);
569 xdp_rxq_info_unreg(&rq->xdp_rxq);559 xdp_rxq_info_unreg(&rq->xdp_rxq);
570 page_pool_destroy(rq->page_pool);560 page_pool_destroy(rq->page_pool);
571 mlx5_wq_destroy(&rq->wq_ctrl);561 mlx5_wq_destroy(&rq->wq_ctrl);
@@ -575,10 +565,16 @@ err_rq_wq_destroy: · 3 unmodified lines
575 565
576static void mlx5e_free_rq(struct mlx5e_rq *rq)566static void mlx5e_free_rq(struct mlx5e_rq *rq)
577{567{
568 struct mlx5e_channel *c = rq->channel;
569 struct bpf_prog *old_prog = NULL;
578 int i;570 int i;
579 571
580 if (rq->xdp_prog)572 /* drop_rq has neither channel nor xdp_prog. */
581 bpf_prog_put(rq->xdp_prog);573 if (c)
574 old_prog = rcu_dereference_protected(rq->xdp_prog,
575 lockdep_is_held(&c->priv->state_lock));
576 if (old_prog)
577 bpf_prog_put(old_prog);
582 578
583 switch (rq->wq_type) {579 switch (rq->wq_type) {
584 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:580 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
@@ -867,7 +863,7 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq) · 282 unmodified lines
867void mlx5e_deactivate_rq(struct mlx5e_rq *rq)863void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
868{864{
869 clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);865 clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
870 napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */866 synchronize_rcu(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */
871}867}
872 868
873void mlx5e_close_rq(struct mlx5e_rq *rq)869void mlx5e_close_rq(struct mlx5e_rq *rq)
@@ -1312,12 +1308,10 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq) · 438 unmodified lines
1312 1308
1313static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)1309static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)
1314{1310{
1315 struct mlx5e_channel *c = sq->channel;
1316 struct mlx5_wq_cyc *wq = &sq->wq;1311 struct mlx5_wq_cyc *wq = &sq->wq;
1317 1312
1318 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);1313 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
1319 /* prevent netif_tx_wake_queue */1314 synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */
1320 napi_synchronize(&c->napi);
1321 1315
1322 mlx5e_tx_disable_queue(sq->txq);1316 mlx5e_tx_disable_queue(sq->txq);
1323 1317
@@ -1392,10 +1386,8 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq) · 68 unmodified lines
1392 1386
1393void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)1387void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
1394{1388{
1395 struct mlx5e_channel *c = icosq->channel;
1396
1397 clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);1389 clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);
1398 napi_synchronize(&c->napi);1390 synchronize_rcu(); /* Sync with NAPI. */
1399}1391}
1400 1392
1401void mlx5e_close_icosq(struct mlx5e_icosq *sq)1393void mlx5e_close_icosq(struct mlx5e_icosq *sq)
@@ -1474,7 +1466,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq) · 72 unmodified lines
1474 struct mlx5e_channel *c = sq->channel;1466 struct mlx5e_channel *c = sq->channel;
1475 1467
1476 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);1468 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
1477 napi_synchronize(&c->napi);1469 synchronize_rcu(); /* Sync with NAPI. */
1478 1470
1479 mlx5e_destroy_sq(c->mdev, sq->sqn);1471 mlx5e_destroy_sq(c->mdev, sq->sqn);
1480 mlx5e_free_xdpsq_descs(sq);1472 mlx5e_free_xdpsq_descs(sq);
@@ -3567,6 +3559,7 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) · 2086 unmodified lines
3567 3559
3568 s->rx_packets += rq_stats->packets + xskrq_stats->packets;3560 s->rx_packets += rq_stats->packets + xskrq_stats->packets;
3569 s->rx_bytes += rq_stats->bytes + xskrq_stats->bytes;3561 s->rx_bytes += rq_stats->bytes + xskrq_stats->bytes;
3562 s->multicast += rq_stats->mcast_packets + xskrq_stats->mcast_packets;
3570 3563
3571 for (j = 0; j < priv->max_opened_tc; j++) {3564 for (j = 0; j < priv->max_opened_tc; j++) {
3572 struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];3565 struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
@@ -3582,7 +3575,6 @@ void · 9 unmodified lines
3582mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)3575mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
3583{3576{
3584 struct mlx5e_priv *priv = netdev_priv(dev);3577 struct mlx5e_priv *priv = netdev_priv(dev);
3585 struct mlx5e_vport_stats *vstats = &priv->stats.vport;
3586 struct mlx5e_pport_stats *pstats = &priv->stats.pport;3578 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
3587 3579
3588 /* In switchdev mode, monitor counters doesn't monitor3580 /* In switchdev mode, monitor counters doesn't monitor
@@ -3617,12 +3609,6 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) · 28 unmodified lines
3617 stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +3609 stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
3618 stats->rx_frame_errors;3610 stats->rx_frame_errors;
3619 stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors;3611 stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors;
3620
3621 /* vport multicast also counts packets that are dropped due to steering
3622 * or rx out of buffer
3623 */
3624 stats->multicast =
3625 VPORT_COUNTER_GET(vstats, received_eth_multicast.packets);
3626}3612}
3627 3613
3628static void mlx5e_set_rx_mode(struct net_device *dev)3614static void mlx5e_set_rx_mode(struct net_device *dev)
@@ -4330,6 +4316,16 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog) · 701 unmodified lines
4330 return 0;4316 return 0;
4331}4317}
4332 4318
4319static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
4320{
4321 struct bpf_prog *old_prog;
4322
4323 old_prog = rcu_replace_pointer(rq->xdp_prog, prog,
4324 lockdep_is_held(&rq->channel->priv->state_lock));
4325 if (old_prog)
4326 bpf_prog_put(old_prog);
4327}
4328
4333static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)4329static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
4334{4330{
4335 struct mlx5e_priv *priv = netdev_priv(netdev);4331 struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4388,29 +4384,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) · 52 unmodified lines
4388 */4384 */
4389 for (i = 0; i < priv->channels.num; i++) {4385 for (i = 0; i < priv->channels.num; i++) {
4390 struct mlx5e_channel *c = priv->channels.c[i];4386 struct mlx5e_channel *c = priv->channels.c[i];
4391 bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
4392
4393 clear_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
4394 if (xsk_open)
4395 clear_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
4396 napi_synchronize(&c->napi);
4397 /* prevent mlx5e_poll_rx_cq from accessing rq->xdp_prog */
4398
4399 old_prog = xchg(&c->rq.xdp_prog, prog);
4400 if (old_prog)
4401 bpf_prog_put(old_prog);
4402
4403 if (xsk_open) {
4404 old_prog = xchg(&c->xskrq.xdp_prog, prog);
4405 if (old_prog)
4406 bpf_prog_put(old_prog);
4407 }
4408 4387
4409 set_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);4388 mlx5e_rq_replace_xdp_prog(&c->rq, prog);
4410 if (xsk_open)4389 if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
4411 set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);4390 mlx5e_rq_replace_xdp_prog(&c->xskrq, prog);
4412 /* napi_schedule in case we have missed anything */
4413 napi_schedule(&c->napi);
4414 }4391 }
4415 4392
4416unlock:4393unlock:
@@ -5200,7 +5177,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { · 783 unmodified lines
5200 .enable = mlx5e_nic_enable,5177 .enable = mlx5e_nic_enable,
5201 .disable = mlx5e_nic_disable,5178 .disable = mlx5e_nic_disable,
5202 .update_rx = mlx5e_update_nic_rx,5179 .update_rx = mlx5e_update_nic_rx,
5203 .update_stats = mlx5e_update_ndo_stats,5180 .update_stats = mlx5e_stats_update_ndo_stats,
5204 .update_carrier = mlx5e_update_carrier,5181 .update_carrier = mlx5e_update_carrier,
5205 .rx_handlers = &mlx5e_rx_handlers_nic,5182 .rx_handlers = &mlx5e_rx_handlers_nic,
5206 .max_tc = MLX5E_MAX_NUM_TC,5183 .max_tc = MLX5E_MAX_NUM_TC,
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+2−2
@@ -1171,7 +1171,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = { · 1170 unmodified lines
1171 .cleanup_tx = mlx5e_cleanup_rep_tx,1171 .cleanup_tx = mlx5e_cleanup_rep_tx,
1172 .enable = mlx5e_rep_enable,1172 .enable = mlx5e_rep_enable,
1173 .update_rx = mlx5e_update_rep_rx,1173 .update_rx = mlx5e_update_rep_rx,
1174 .update_stats = mlx5e_update_ndo_stats,1174 .update_stats = mlx5e_stats_update_ndo_stats,
1175 .rx_handlers = &mlx5e_rx_handlers_rep,1175 .rx_handlers = &mlx5e_rx_handlers_rep,
1176 .max_tc = 1,1176 .max_tc = 1,
1177 .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR),1177 .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR),
@@ -1189,7 +1189,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { · 11 unmodified lines
1189 .enable = mlx5e_uplink_rep_enable,1189 .enable = mlx5e_uplink_rep_enable,
1190 .disable = mlx5e_uplink_rep_disable,1190 .disable = mlx5e_uplink_rep_disable,
1191 .update_rx = mlx5e_update_rep_rx,1191 .update_rx = mlx5e_update_rep_rx,
1192 .update_stats = mlx5e_update_ndo_stats,1192 .update_stats = mlx5e_stats_update_ndo_stats,
1193 .update_carrier = mlx5e_update_carrier,1193 .update_carrier = mlx5e_update_carrier,
1194 .rx_handlers = &mlx5e_rx_handlers_rep,1194 .rx_handlers = &mlx5e_rx_handlers_rep,
1195 .max_tc = MLX5E_MAX_NUM_TC,1195 .max_tc = MLX5E_MAX_NUM_TC,
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+6−10
@@ -53,6 +53,7 @@ · 52 unmodified lines
53#include "en/xsk/rx.h"53#include "en/xsk/rx.h"
54#include "en/health.h"54#include "en/health.h"
55#include "en/params.h"55#include "en/params.h"
56#include "en/txrx.h"
56 57
57static struct sk_buff *58static struct sk_buff *
58mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,59mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
@@ -1080,6 +1081,9 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, · 1021 unmodified lines
1080 mlx5e_enable_ecn(rq, skb);1081 mlx5e_enable_ecn(rq, skb);
1081 1082
1082 skb->protocol = eth_type_trans(skb, netdev);1083 skb->protocol = eth_type_trans(skb, netdev);
1084
1085 if (unlikely(mlx5e_skb_is_multicast(skb)))
1086 stats->mcast_packets++;
1083}1087}
1084 1088
1085static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq,1089static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq,
@@ -1132,7 +1136,6 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 46 unmodified lines
1132 struct xdp_buff xdp;1136 struct xdp_buff xdp;
1133 struct sk_buff *skb;1137 struct sk_buff *skb;
1134 void *va, *data;1138 void *va, *data;
1135 bool consumed;
1136 u32 frag_size;1139 u32 frag_size;
1137 1140
1138 va = page_address(di->page) + wi->offset;1141 va = page_address(di->page) + wi->offset;
@@ -1144,11 +1147,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 5 unmodified lines
1144 prefetchw(va); /* xdp_frame data area */1147 prefetchw(va); /* xdp_frame data area */
1145 prefetch(data);1148 prefetch(data);
1146 1149
1147 rcu_read_lock();
1148 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);1150 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);
1149 consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp);1151 if (mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp))
1150 rcu_read_unlock();
1151 if (consumed)
1152 return NULL; /* page/packet was consumed by XDP */1152 return NULL; /* page/packet was consumed by XDP */
1153 1153
1154 rx_headroom = xdp.data - xdp.data_hard_start;1154 rx_headroom = xdp.data - xdp.data_hard_start;
@@ -1438,7 +1438,6 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 283 unmodified lines
1438 struct sk_buff *skb;1438 struct sk_buff *skb;
1439 void *va, *data;1439 void *va, *data;
1440 u32 frag_size;1440 u32 frag_size;
1441 bool consumed;
1442 1441
1443 /* Check packet size. Note LRO doesn't use linear SKB */1442 /* Check packet size. Note LRO doesn't use linear SKB */
1444 if (unlikely(cqe_bcnt > rq->hw_mtu)) {1443 if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -1455,11 +1454,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 10 unmodified lines
1455 prefetchw(va); /* xdp_frame data area */1454 prefetchw(va); /* xdp_frame data area */
1456 prefetch(data);1455 prefetch(data);
1457 1456
1458 rcu_read_lock();
1459 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);1457 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
1460 consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp);1458 if (mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp)) {
1461 rcu_read_unlock();
1462 if (consumed) {
1463 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))1459 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))
1464 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */1460 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
1465 return NULL; /* page/packet was consumed by XDP */1461 return NULL; /* page/packet was consumed by XDP */
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c+12−0
@@ -54,6 +54,18 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv) · 53 unmodified lines
54 return total;54 return total;
55}55}
56 56
57void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv)
58{
59 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
60 const unsigned int num_stats_grps = stats_grps_num(priv);
61 int i;
62
63 for (i = num_stats_grps - 1; i >= 0; i--)
64 if (stats_grps[i]->update_stats &&
65 stats_grps[i]->update_stats_mask & MLX5E_NDO_UPDATE_STATS)
66 stats_grps[i]->update_stats(priv);
67}
68
57void mlx5e_stats_update(struct mlx5e_priv *priv)69void mlx5e_stats_update(struct mlx5e_priv *priv)
58{70{
59 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;71 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+3−0
@@ -103,6 +103,7 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv); · 102 unmodified lines
103void mlx5e_stats_update(struct mlx5e_priv *priv);103void mlx5e_stats_update(struct mlx5e_priv *priv);
104void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);104void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);
105void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data);105void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data);
106void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv);
106 107
107/* Concrete NIC Stats */108/* Concrete NIC Stats */
108 109
@@ -119,6 +120,7 @@ struct mlx5e_sw_stats { · 10 unmodified lines
119 u64 tx_nop;120 u64 tx_nop;
120 u64 rx_lro_packets;121 u64 rx_lro_packets;
121 u64 rx_lro_bytes;122 u64 rx_lro_bytes;
123 u64 rx_mcast_packets;
122 u64 rx_ecn_mark;124 u64 rx_ecn_mark;
123 u64 rx_removed_vlan_packets;125 u64 rx_removed_vlan_packets;
124 u64 rx_csum_unnecessary;126 u64 rx_csum_unnecessary;
@@ -298,6 +300,7 @@ struct mlx5e_rq_stats { · 173 unmodified lines
298 u64 csum_none;300 u64 csum_none;
299 u64 lro_packets;301 u64 lro_packets;
300 u64 lro_bytes;302 u64 lro_bytes;
303 u64 mcast_packets;
301 u64 ecn_mark;304 u64 ecn_mark;
302 u64 removed_vlan_packets;305 u64 removed_vlan_packets;
303 u64 xdp_drop;306 u64 xdp_drop;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+26−19
@@ -1290,11 +1290,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 1289 unmodified lines
1290 1290
1291 mlx5e_put_flow_tunnel_id(flow);1291 mlx5e_put_flow_tunnel_id(flow);
1292 1292
1293 if (flow_flag_test(flow, NOT_READY)) {1293 if (flow_flag_test(flow, NOT_READY))
1294 remove_unready_flow(flow);1294 remove_unready_flow(flow);
1295 kvfree(attr->parse_attr);
1296 return;
1297 }
1298 1295
1299 if (mlx5e_is_offloaded_flow(flow)) {1296 if (mlx5e_is_offloaded_flow(flow)) {
1300 if (flow_flag_test(flow, SLOW))1297 if (flow_flag_test(flow, SLOW))
@@ -1315,6 +1312,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 14 unmodified lines
1315 }1312 }
1316 kvfree(attr->parse_attr);1313 kvfree(attr->parse_attr);
1317 1314
1315 mlx5_tc_ct_match_del(priv, &flow->esw_attr->ct_attr);
1316
1318 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)1317 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
1319 mlx5e_detach_mod_hdr(priv, flow);1318 mlx5e_detach_mod_hdr(priv, flow);
1320 1319
@@ -2625,6 +2624,22 @@ static struct mlx5_fields fields[] = { · 1304 unmodified lines
2625 OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest, 0, udp_dport),2624 OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest, 0, udp_dport),
2626};2625};
2627 2626
2627static unsigned long mask_to_le(unsigned long mask, int size)
2628{
2629 __be32 mask_be32;
2630 __be16 mask_be16;
2631
2632 if (size == 32) {
2633 mask_be32 = (__force __be32)(mask);
2634 mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
2635 } else if (size == 16) {
2636 mask_be32 = (__force __be32)(mask);
2637 mask_be16 = *(__be16 *)&mask_be32;
2638 mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
2639 }
2640
2641 return mask;
2642}
2628static int offload_pedit_fields(struct mlx5e_priv *priv,2643static int offload_pedit_fields(struct mlx5e_priv *priv,
2629 int namespace,2644 int namespace,
2630 struct pedit_headers_action *hdrs,2645 struct pedit_headers_action *hdrs,
@@ -2638,9 +2653,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 7 unmodified lines
2638 u32 *s_masks_p, *a_masks_p, s_mask, a_mask;2653 u32 *s_masks_p, *a_masks_p, s_mask, a_mask;
2639 struct mlx5e_tc_mod_hdr_acts *mod_acts;2654 struct mlx5e_tc_mod_hdr_acts *mod_acts;
2640 struct mlx5_fields *f;2655 struct mlx5_fields *f;
2641 unsigned long mask;2656 unsigned long mask, field_mask;
2642 __be32 mask_be32;
2643 __be16 mask_be16;
2644 int err;2657 int err;
2645 u8 cmd;2658 u8 cmd;
2646 2659
@@ -2706,14 +2719,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 59 unmodified lines
2706 if (skip)2719 if (skip)
2707 continue;2720 continue;
2708 2721
2709 if (f->field_bsize == 32) {2722 mask = mask_to_le(mask, f->field_bsize);
2710 mask_be32 = (__force __be32)(mask);
2711 mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
2712 } else if (f->field_bsize == 16) {
2713 mask_be32 = (__force __be32)(mask);
2714 mask_be16 = *(__be16 *)&mask_be32;
2715 mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
2716 }
2717 2723
2718 first = find_first_bit(&mask, f->field_bsize);2724 first = find_first_bit(&mask, f->field_bsize);
2719 next_z = find_next_zero_bit(&mask, f->field_bsize, first);2725 next_z = find_next_zero_bit(&mask, f->field_bsize, first);
@@ -2744,9 +2750,10 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 24 unmodified lines
2744 if (cmd == MLX5_ACTION_TYPE_SET) {2750 if (cmd == MLX5_ACTION_TYPE_SET) {
2745 int start;2751 int start;
2746 2752
2753 field_mask = mask_to_le(f->field_mask, f->field_bsize);
2754
2747 /* if field is bit sized it can start not from first bit */2755 /* if field is bit sized it can start not from first bit */
2748 start = find_first_bit((unsigned long *)&f->field_mask,2756 start = find_first_bit(&field_mask, f->field_bsize);
2749 f->field_bsize);
2750 2757
2751 MLX5_SET(set_action_in, action, offset, first - start);2758 MLX5_SET(set_action_in, action, offset, first - start);
2752 /* length is num of bits to be written, zero means length of 32 */2759 /* length is num of bits to be written, zero means length of 32 */
@@ -4402,8 +4409,8 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv, · 1649 unmodified lines
4402 goto err_free;4409 goto err_free;
4403 4410
4404 /* actions validation depends on parsing the ct matches first */4411 /* actions validation depends on parsing the ct matches first */
4405 err = mlx5_tc_ct_parse_match(priv, &parse_attr->spec, f,4412 err = mlx5_tc_ct_match_add(priv, &parse_attr->spec, f,
4406 &flow->esw_attr->ct_attr, extack);4413 &flow->esw_attr->ct_attr, extack);
4407 if (err)4414 if (err)
4408 goto err_free;4415 goto err_free;
4409 4416
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c+13−4
@@ -121,13 +121,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 120 unmodified lines
121 struct mlx5e_xdpsq *xsksq = &c->xsksq;121 struct mlx5e_xdpsq *xsksq = &c->xsksq;
122 struct mlx5e_rq *xskrq = &c->xskrq;122 struct mlx5e_rq *xskrq = &c->xskrq;
123 struct mlx5e_rq *rq = &c->rq;123 struct mlx5e_rq *rq = &c->rq;
124 bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
125 bool aff_change = false;124 bool aff_change = false;
126 bool busy_xsk = false;125 bool busy_xsk = false;
127 bool busy = false;126 bool busy = false;
128 int work_done = 0;127 int work_done = 0;
128 bool xsk_open;
129 int i;129 int i;
130 130
131 rcu_read_lock();
132
133 xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
134
131 ch_stats->poll++;135 ch_stats->poll++;
132 136
133 for (i = 0; i < c->num_tc; i++)137 for (i = 0; i < c->num_tc; i++)
@@ -167,8 +171,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 33 unmodified lines
167 busy |= busy_xsk;171 busy |= busy_xsk;
168 172
169 if (busy) {173 if (busy) {
170 if (likely(mlx5e_channel_no_affinity_change(c)))174 if (likely(mlx5e_channel_no_affinity_change(c))) {
171 return budget;175 work_done = budget;
176 goto out;
177 }
172 ch_stats->aff_change++;178 ch_stats->aff_change++;
173 aff_change = true;179 aff_change = true;
174 if (budget && work_done == budget)180 if (budget && work_done == budget)
@@ -176,7 +182,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 1 unmodified line
176 }182 }
177 183
178 if (unlikely(!napi_complete_done(napi, work_done)))184 if (unlikely(!napi_complete_done(napi, work_done)))
179 return work_done;185 goto out;
180 186
181 ch_stats->arm++;187 ch_stats->arm++;
182 188
@@ -203,6 +209,9 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 20 unmodified lines
203 ch_stats->force_irq++;209 ch_stats->force_irq++;
204 }210 }
205 211
212out:
213 rcu_read_unlock();
214
206 return work_done;215 return work_done;
207}216}
208 217
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+28−24
@@ -1219,35 +1219,37 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw) · 1218 unmodified lines
1219 }1219 }
1220 esw->fdb_table.offloads.send_to_vport_grp = g;1220 esw->fdb_table.offloads.send_to_vport_grp = g;
1221 1221
1222 /* create peer esw miss group */1222 if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) {
1223 memset(flow_group_in, 0, inlen);1223 /* create peer esw miss group */
1224 memset(flow_group_in, 0, inlen);
1224 1225
1225 esw_set_flow_group_source_port(esw, flow_group_in);1226 esw_set_flow_group_source_port(esw, flow_group_in);
1226 1227
1227 if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {1228 if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
1228 match_criteria = MLX5_ADDR_OF(create_flow_group_in,1229 match_criteria = MLX5_ADDR_OF(create_flow_group_in,
1229 flow_group_in,1230 flow_group_in,
1230 match_criteria);1231 match_criteria);
1231 1232
1232 MLX5_SET_TO_ONES(fte_match_param, match_criteria,1233 MLX5_SET_TO_ONES(fte_match_param, match_criteria,
1233 misc_parameters.source_eswitch_owner_vhca_id);1234 misc_parameters.source_eswitch_owner_vhca_id);
1234 1235
1235 MLX5_SET(create_flow_group_in, flow_group_in,1236 MLX5_SET(create_flow_group_in, flow_group_in,
1236 source_eswitch_owner_vhca_id_valid, 1);1237 source_eswitch_owner_vhca_id_valid, 1);
1237 }1238 }
1238 1239
1239 MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);1240 MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
1240 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,1241 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
1241 ix + esw->total_vports - 1);1242 ix + esw->total_vports - 1);
1242 ix += esw->total_vports;1243 ix += esw->total_vports;
1243 1244
1244 g = mlx5_create_flow_group(fdb, flow_group_in);1245 g = mlx5_create_flow_group(fdb, flow_group_in);
1245 if (IS_ERR(g)) {1246 if (IS_ERR(g)) {
1246 err = PTR_ERR(g);1247 err = PTR_ERR(g);
1247 esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);1248 esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
1248 goto peer_miss_err;1249 goto peer_miss_err;
1250 }
1251 esw->fdb_table.offloads.peer_miss_grp = g;
1249 }1252 }
1250 esw->fdb_table.offloads.peer_miss_grp = g;
1251 1253
1252 /* create miss group */1254 /* create miss group */
1253 memset(flow_group_in, 0, inlen);1255 memset(flow_group_in, 0, inlen);
@@ -1281,7 +1283,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw) · 27 unmodified lines
1281miss_rule_err:1283miss_rule_err:
1282 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);1284 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
1283miss_err:1285miss_err:
1284 mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);1286 if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
1287 mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
1285peer_miss_err:1288peer_miss_err:
1286 mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);1289 mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
1287send_vport_err:1290send_vport_err:
@@ -1305,7 +1308,8 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw) · 17 unmodified lines
1305 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi);1308 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi);
1306 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni);1309 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni);
1307 mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);1310 mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
1308 mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);1311 if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
1312 mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
1309 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);1313 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
1310 1314
1311 mlx5_esw_chains_destroy(esw);1315 mlx5_esw_chains_destroy(esw);
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+4−4
@@ -654,7 +654,7 @@ static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft, · 653 unmodified lines
654 fte->action = *flow_act;654 fte->action = *flow_act;
655 fte->flow_context = spec->flow_context;655 fte->flow_context = spec->flow_context;
656 656
657 tree_init_node(&fte->node, NULL, del_sw_fte);657 tree_init_node(&fte->node, del_hw_fte, del_sw_fte);
658 658
659 return fte;659 return fte;
660}660}
@@ -1792,7 +1792,6 @@ skip_search: · 1131 unmodified lines
1792 up_write_ref_node(&g->node, false);1792 up_write_ref_node(&g->node, false);
1793 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);1793 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
1794 up_write_ref_node(&fte->node, false);1794 up_write_ref_node(&fte->node, false);
1795 tree_put_node(&fte->node, false);
1796 return rule;1795 return rule;
1797 }1796 }
1798 rule = ERR_PTR(-ENOENT);1797 rule = ERR_PTR(-ENOENT);
@@ -1891,7 +1890,6 @@ search_again_locked: · 92 unmodified lines
1891 up_write_ref_node(&g->node, false);1890 up_write_ref_node(&g->node, false);
1892 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);1891 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
1893 up_write_ref_node(&fte->node, false);1892 up_write_ref_node(&fte->node, false);
1894 tree_put_node(&fte->node, false);
1895 tree_put_node(&g->node, false);1893 tree_put_node(&g->node, false);
1896 return rule;1894 return rule;
1897 1895
@@ -2001,7 +1999,9 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 103 unmodified lines
2001 up_write_ref_node(&fte->node, false);1999 up_write_ref_node(&fte->node, false);
2002 } else {2000 } else {
2003 del_hw_fte(&fte->node);2001 del_hw_fte(&fte->node);
2004 up_write(&fte->node.lock);2002 /* Avoid double call to del_hw_fte */
2003 fte->node.del_hw_func = NULL;
2004 up_write_ref_node(&fte->node, false);
2005 tree_put_node(&fte->node, false);2005 tree_put_node(&fte->node, false);
2006 }2006 }
2007 kfree(handle);2007 kfree(handle);
drivers/net/ethernet/mscc/ocelot.c+15−9
@@ -421,10 +421,15 @@ int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port, · 420 unmodified lines
421 421
422 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&422 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
423 ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {423 ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
424 spin_lock(&ocelot_port->ts_id_lock);
425
424 shinfo->tx_flags |= SKBTX_IN_PROGRESS;426 shinfo->tx_flags |= SKBTX_IN_PROGRESS;
425 /* Store timestamp ID in cb[0] of sk_buff */427 /* Store timestamp ID in cb[0] of sk_buff */
426 skb->cb[0] = ocelot_port->ts_id % 4;428 skb->cb[0] = ocelot_port->ts_id;
429 ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4;
427 skb_queue_tail(&ocelot_port->tx_skbs, skb);430 skb_queue_tail(&ocelot_port->tx_skbs, skb);
431
432 spin_unlock(&ocelot_port->ts_id_lock);
428 return 0;433 return 0;
429 }434 }
430 return -ENODATA;435 return -ENODATA;
@@ -1300,6 +1305,7 @@ void ocelot_init_port(struct ocelot *ocelot, int port) · 869 unmodified lines
1300 struct ocelot_port *ocelot_port = ocelot->ports[port];1305 struct ocelot_port *ocelot_port = ocelot->ports[port];
1301 1306
1302 skb_queue_head_init(&ocelot_port->tx_skbs);1307 skb_queue_head_init(&ocelot_port->tx_skbs);
1308 spin_lock_init(&ocelot_port->ts_id_lock);
1303 1309
1304 /* Basic L2 initialization */1310 /* Basic L2 initialization */
1305 1311
@@ -1544,18 +1550,18 @@ EXPORT_SYMBOL(ocelot_init); · 238 unmodified lines
1544 1550
1545void ocelot_deinit(struct ocelot *ocelot)1551void ocelot_deinit(struct ocelot *ocelot)
1546{1552{
1547 struct ocelot_port *port;
1548 int i;
1549
1550 cancel_delayed_work(&ocelot->stats_work);1553 cancel_delayed_work(&ocelot->stats_work);
1551 destroy_workqueue(ocelot->stats_queue);1554 destroy_workqueue(ocelot->stats_queue);
1552 mutex_destroy(&ocelot->stats_lock);1555 mutex_destroy(&ocelot->stats_lock);
1553
1554 for (i = 0; i < ocelot->num_phys_ports; i++) {
1555 port = ocelot->ports[i];
1556 skb_queue_purge(&port->tx_skbs);
1557 }
1558}1556}
1559EXPORT_SYMBOL(ocelot_deinit);1557EXPORT_SYMBOL(ocelot_deinit);
1560 1558
1559void ocelot_deinit_port(struct ocelot *ocelot, int port)
1560{
1561 struct ocelot_port *ocelot_port = ocelot->ports[port];
1562
1563 skb_queue_purge(&ocelot_port->tx_skbs);
1564}
1565EXPORT_SYMBOL(ocelot_deinit_port);
1566
1561MODULE_LICENSE("Dual MIT/GPL");1567MODULE_LICENSE("Dual MIT/GPL");
drivers/net/ethernet/mscc/ocelot_net.c+6−6
@@ -330,6 +330,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 329 unmodified lines
330 u8 grp = 0; /* Send everything on CPU group 0 */330 u8 grp = 0; /* Send everything on CPU group 0 */
331 unsigned int i, count, last;331 unsigned int i, count, last;
332 int port = priv->chip_port;332 int port = priv->chip_port;
333 bool do_tstamp;
333 334
334 val = ocelot_read(ocelot, QS_INJ_STATUS);335 val = ocelot_read(ocelot, QS_INJ_STATUS);
335 if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||336 if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||
@@ -344,10 +345,12 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 8 unmodified lines
344 info.vid = skb_vlan_tag_get(skb);345 info.vid = skb_vlan_tag_get(skb);
345 346
346 /* Check if timestamping is needed */347 /* Check if timestamping is needed */
348 do_tstamp = (ocelot_port_add_txtstamp_skb(ocelot_port, skb) == 0);
349
347 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) {350 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) {
348 info.rew_op = ocelot_port->ptp_cmd;351 info.rew_op = ocelot_port->ptp_cmd;
349 if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)352 if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
350 info.rew_op |= (ocelot_port->ts_id % 4) << 3;353 info.rew_op |= skb->cb[0] << 3;
351 }354 }
352 355
353 ocelot_gen_ifh(ifh, &info);356 ocelot_gen_ifh(ifh, &info);
@@ -380,12 +383,9 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) · 26 unmodified lines
380 dev->stats.tx_packets++;383 dev->stats.tx_packets++;
381 dev->stats.tx_bytes += skb->len;384 dev->stats.tx_bytes += skb->len;
382 385
383 if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) {386 if (!do_tstamp)
384 ocelot_port->ts_id++;387 dev_kfree_skb_any(skb);
385 return NETDEV_TX_OK;
386 }
387 388
388 dev_kfree_skb_any(skb);
389 return NETDEV_TX_OK;389 return NETDEV_TX_OK;
390}390}
391 391
drivers/net/ethernet/mscc/ocelot_vsc7514.c+145−104
@@ -806,17 +806,17 @@ static const struct vcap_field vsc7514_vcap_is2_keys[] = { · 805 unmodified lines
806 [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1},806 [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1},
807 /* IP4_TCP_UDP (TYPE=100) */807 /* IP4_TCP_UDP (TYPE=100) */
808 [VCAP_IS2_HK_TCP] = {124, 1},808 [VCAP_IS2_HK_TCP] = {124, 1},
809 [VCAP_IS2_HK_L4_SPORT] = {125, 16},809 [VCAP_IS2_HK_L4_DPORT] = {125, 16},
810 [VCAP_IS2_HK_L4_DPORT] = {141, 16},810 [VCAP_IS2_HK_L4_SPORT] = {141, 16},
811 [VCAP_IS2_HK_L4_RNG] = {157, 8},811 [VCAP_IS2_HK_L4_RNG] = {157, 8},
812 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1},812 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1},
813 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1},813 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1},
814 [VCAP_IS2_HK_L4_URG] = {167, 1},814 [VCAP_IS2_HK_L4_FIN] = {167, 1},
815 [VCAP_IS2_HK_L4_ACK] = {168, 1},815 [VCAP_IS2_HK_L4_SYN] = {168, 1},
816 [VCAP_IS2_HK_L4_PSH] = {169, 1},816 [VCAP_IS2_HK_L4_RST] = {169, 1},
817 [VCAP_IS2_HK_L4_RST] = {170, 1},817 [VCAP_IS2_HK_L4_PSH] = {170, 1},
818 [VCAP_IS2_HK_L4_SYN] = {171, 1},818 [VCAP_IS2_HK_L4_ACK] = {171, 1},
819 [VCAP_IS2_HK_L4_FIN] = {172, 1},819 [VCAP_IS2_HK_L4_URG] = {172, 1},
820 [VCAP_IS2_HK_L4_1588_DOM] = {173, 8},820 [VCAP_IS2_HK_L4_1588_DOM] = {173, 8},
821 [VCAP_IS2_HK_L4_1588_VER] = {181, 4},821 [VCAP_IS2_HK_L4_1588_VER] = {181, 4},
822 /* IP4_OTHER (TYPE=101) */822 /* IP4_OTHER (TYPE=101) */
@@ -896,11 +896,137 @@ static struct ptp_clock_info ocelot_ptp_clock_info = { · 73 unmodified lines
896 .enable = ocelot_ptp_enable,896 .enable = ocelot_ptp_enable,
897};897};
898 898
899static void mscc_ocelot_release_ports(struct ocelot *ocelot)
900{
901 int port;
902
903 for (port = 0; port < ocelot->num_phys_ports; port++) {
904 struct ocelot_port_private *priv;
905 struct ocelot_port *ocelot_port;
906
907 ocelot_port = ocelot->ports[port];
908 if (!ocelot_port)
909 continue;
910
911 ocelot_deinit_port(ocelot, port);
912
913 priv = container_of(ocelot_port, struct ocelot_port_private,
914 port);
915
916 unregister_netdev(priv->dev);
917 free_netdev(priv->dev);
918 }
919}
920
921static int mscc_ocelot_init_ports(struct platform_device *pdev,
922 struct device_node *ports)
923{
924 struct ocelot *ocelot = platform_get_drvdata(pdev);
925 struct device_node *portnp;
926 int err;
927
928 ocelot->ports = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports,
929 sizeof(struct ocelot_port *), GFP_KERNEL);
930 if (!ocelot->ports)
931 return -ENOMEM;
932
933 /* No NPI port */
934 ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
935 OCELOT_TAG_PREFIX_NONE);
936
937 for_each_available_child_of_node(ports, portnp) {
938 struct ocelot_port_private *priv;
939 struct ocelot_port *ocelot_port;
940 struct device_node *phy_node;
941 phy_interface_t phy_mode;
942 struct phy_device *phy;
943 struct regmap *target;
944 struct resource *res;
945 struct phy *serdes;
946 char res_name[8];
947 u32 port;
948
949 if (of_property_read_u32(portnp, "reg", &port))
950 continue;
951
952 snprintf(res_name, sizeof(res_name), "port%d", port);
953
954 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
955 res_name);
956 target = ocelot_regmap_init(ocelot, res);
957 if (IS_ERR(target))
958 continue;
959
960 phy_node = of_parse_phandle(portnp, "phy-handle", 0);
961 if (!phy_node)
962 continue;
963
964 phy = of_phy_find_device(phy_node);
965 of_node_put(phy_node);
966 if (!phy)
967 continue;
968
969 err = ocelot_probe_port(ocelot, port, target, phy);
970 if (err) {
971 of_node_put(portnp);
972 return err;
973 }
974
975 ocelot_port = ocelot->ports[port];
976 priv = container_of(ocelot_port, struct ocelot_port_private,
977 port);
978
979 of_get_phy_mode(portnp, &phy_mode);
980
981 ocelot_port->phy_mode = phy_mode;
982
983 switch (ocelot_port->phy_mode) {
984 case PHY_INTERFACE_MODE_NA:
985 continue;
986 case PHY_INTERFACE_MODE_SGMII:
987 break;
988 case PHY_INTERFACE_MODE_QSGMII:
989 /* Ensure clock signals and speed is set on all
990 * QSGMII links
991 */
992 ocelot_port_writel(ocelot_port,
993 DEV_CLOCK_CFG_LINK_SPEED
994 (OCELOT_SPEED_1000),
995 DEV_CLOCK_CFG);
996 break;
997 default:
998 dev_err(ocelot->dev,
999 "invalid phy mode for port%d, (Q)SGMII only\n",
1000 port);
1001 of_node_put(portnp);
1002 return -EINVAL;
1003 }
1004
1005 serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
1006 if (IS_ERR(serdes)) {
1007 err = PTR_ERR(serdes);
1008 if (err == -EPROBE_DEFER)
1009 dev_dbg(ocelot->dev, "deferring probe\n");
1010 else
1011 dev_err(ocelot->dev,
1012 "missing SerDes phys for port%d\n",
1013 port);
1014
1015 of_node_put(portnp);
1016 return err;
1017 }
1018
1019 priv->serdes = serdes;
1020 }
1021
1022 return 0;
1023}
1024
899static int mscc_ocelot_probe(struct platform_device *pdev)1025static int mscc_ocelot_probe(struct platform_device *pdev)
900{1026{
901 struct device_node *np = pdev->dev.of_node;1027 struct device_node *np = pdev->dev.of_node;
902 struct device_node *ports, *portnp;
903 int err, irq_xtr, irq_ptp_rdy;1028 int err, irq_xtr, irq_ptp_rdy;
1029 struct device_node *ports;
904 struct ocelot *ocelot;1030 struct ocelot *ocelot;
905 struct regmap *hsio;1031 struct regmap *hsio;
906 unsigned int i;1032 unsigned int i;
@@ -985,20 +1111,24 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 78 unmodified lines
985 1111
986 ports = of_get_child_by_name(np, "ethernet-ports");1112 ports = of_get_child_by_name(np, "ethernet-ports");
987 if (!ports) {1113 if (!ports) {
988 dev_err(&pdev->dev, "no ethernet-ports child node found\n");1114 dev_err(ocelot->dev, "no ethernet-ports child node found\n");
989 return -ENODEV;1115 return -ENODEV;
990 }1116 }
991 1117
992 ocelot->num_phys_ports = of_get_child_count(ports);1118 ocelot->num_phys_ports = of_get_child_count(ports);
993 1119
994 ocelot->ports = devm_kcalloc(&pdev->dev, ocelot->num_phys_ports,
995 sizeof(struct ocelot_port *), GFP_KERNEL);
996
997 ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys;1120 ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys;
998 ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;1121 ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;
999 ocelot->vcap = vsc7514_vcap_props;1122 ocelot->vcap = vsc7514_vcap_props;
1000 1123
1001 ocelot_init(ocelot);1124 err = ocelot_init(ocelot);
1125 if (err)
1126 goto out_put_ports;
1127
1128 err = mscc_ocelot_init_ports(pdev, ports);
1129 if (err)
1130 goto out_put_ports;
1131
1002 if (ocelot->ptp) {1132 if (ocelot->ptp) {
1003 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);1133 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
1004 if (err) {1134 if (err) {
@@ -1008,96 +1138,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 3 unmodified lines
1008 }1138 }
1009 }1139 }
1010 1140
1011 /* No NPI port */
1012 ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
1013 OCELOT_TAG_PREFIX_NONE);
1014
1015 for_each_available_child_of_node(ports, portnp) {
1016 struct ocelot_port_private *priv;
1017 struct ocelot_port *ocelot_port;
1018 struct device_node *phy_node;
1019 phy_interface_t phy_mode;
1020 struct phy_device *phy;
1021 struct regmap *target;
1022 struct resource *res;
1023 struct phy *serdes;
1024 char res_name[8];
1025 u32 port;
1026
1027 if (of_property_read_u32(portnp, "reg", &port))
1028 continue;
1029
1030 snprintf(res_name, sizeof(res_name), "port%d", port);
1031
1032 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
1033 res_name);
1034 target = ocelot_regmap_init(ocelot, res);
1035 if (IS_ERR(target))
1036 continue;
1037
1038 phy_node = of_parse_phandle(portnp, "phy-handle", 0);
1039 if (!phy_node)
1040 continue;
1041
1042 phy = of_phy_find_device(phy_node);
1043 of_node_put(phy_node);
1044 if (!phy)
1045 continue;
1046
1047 err = ocelot_probe_port(ocelot, port, target, phy);
1048 if (err) {
1049 of_node_put(portnp);
1050 goto out_put_ports;
1051 }
1052
1053 ocelot_port = ocelot->ports[port];
1054 priv = container_of(ocelot_port, struct ocelot_port_private,
1055 port);
1056
1057 of_get_phy_mode(portnp, &phy_mode);
1058
1059 ocelot_port->phy_mode = phy_mode;
1060
1061 switch (ocelot_port->phy_mode) {
1062 case PHY_INTERFACE_MODE_NA:
1063 continue;
1064 case PHY_INTERFACE_MODE_SGMII:
1065 break;
1066 case PHY_INTERFACE_MODE_QSGMII:
1067 /* Ensure clock signals and speed is set on all
1068 * QSGMII links
1069 */
1070 ocelot_port_writel(ocelot_port,
1071 DEV_CLOCK_CFG_LINK_SPEED
1072 (OCELOT_SPEED_1000),
1073 DEV_CLOCK_CFG);
1074 break;
1075 default:
1076 dev_err(ocelot->dev,
1077 "invalid phy mode for port%d, (Q)SGMII only\n",
1078 port);
1079 of_node_put(portnp);
1080 err = -EINVAL;
1081 goto out_put_ports;
1082 }
1083
1084 serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
1085 if (IS_ERR(serdes)) {
1086 err = PTR_ERR(serdes);
1087 if (err == -EPROBE_DEFER)
1088 dev_dbg(ocelot->dev, "deferring probe\n");
1089 else
1090 dev_err(ocelot->dev,
1091 "missing SerDes phys for port%d\n",
1092 port);
1093
1094 of_node_put(portnp);
1095 goto out_put_ports;
1096 }
1097
1098 priv->serdes = serdes;
1099 }
1100
1101 register_netdevice_notifier(&ocelot_netdevice_nb);1141 register_netdevice_notifier(&ocelot_netdevice_nb);
1102 register_switchdev_notifier(&ocelot_switchdev_nb);1142 register_switchdev_notifier(&ocelot_switchdev_nb);
1103 register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);1143 register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
@@ -1114,6 +1154,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev) · 10 unmodified lines
1114 struct ocelot *ocelot = platform_get_drvdata(pdev);1154 struct ocelot *ocelot = platform_get_drvdata(pdev);
1115 1155
1116 ocelot_deinit_timestamp(ocelot);1156 ocelot_deinit_timestamp(ocelot);
1157 mscc_ocelot_release_ports(ocelot);
1117 ocelot_deinit(ocelot);1158 ocelot_deinit(ocelot);
1118 unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);1159 unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
1119 unregister_switchdev_notifier(&ocelot_switchdev_nb);1160 unregister_switchdev_notifier(&ocelot_switchdev_nb);
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c+2−2
@@ -829,8 +829,8 @@ nfp_port_get_fecparam(struct net_device *netdev, · 828 unmodified lines
829 struct nfp_eth_table_port *eth_port;829 struct nfp_eth_table_port *eth_port;
830 struct nfp_port *port;830 struct nfp_port *port;
831 831
832 param->active_fec = ETHTOOL_FEC_NONE_BIT;832 param->active_fec = ETHTOOL_FEC_NONE;
833 param->fec = ETHTOOL_FEC_NONE_BIT;833 param->fec = ETHTOOL_FEC_NONE;
834 834
835 port = nfp_port_from_netdev(netdev);835 port = nfp_port_from_netdev(netdev);
836 eth_port = nfp_port_get_eth_port(port);836 eth_port = nfp_port_get_eth_port(port);
drivers/net/ethernet/qlogic/qed/qed_dev.c+10−1
@@ -4253,7 +4253,8 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 4252 unmodified lines
4253 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |4253 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
4254 BIT(QED_MF_LLH_PROTO_CLSS) |4254 BIT(QED_MF_LLH_PROTO_CLSS) |
4255 BIT(QED_MF_LL2_NON_UNICAST) |4255 BIT(QED_MF_LL2_NON_UNICAST) |
4256 BIT(QED_MF_INTER_PF_SWITCH);4256 BIT(QED_MF_INTER_PF_SWITCH) |
4257 BIT(QED_MF_DISABLE_ARFS);
4257 break;4258 break;
4258 case NVM_CFG1_GLOB_MF_MODE_DEFAULT:4259 case NVM_CFG1_GLOB_MF_MODE_DEFAULT:
4259 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |4260 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
@@ -4266,6 +4267,14 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 6 unmodified lines
4266 4267
4267 DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",4268 DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
4268 cdev->mf_bits);4269 cdev->mf_bits);
4270
4271 /* In CMT the PF is unknown when the GFS block processes the
4272 * packet. Therefore cannot use searcher as it has a per PF
4273 * database, and thus ARFS must be disabled.
4274 *
4275 */
4276 if (QED_IS_CMT(cdev))
4277 cdev->mf_bits |= BIT(QED_MF_DISABLE_ARFS);
4269 }4278 }
4270 4279
4271 DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",4280 DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
drivers/net/ethernet/qlogic/qed/qed_l2.c+3−0
@@ -1980,6 +1980,9 @@ void qed_arfs_mode_configure(struct qed_hwfn *p_hwfn, · 1979 unmodified lines
1980 struct qed_ptt *p_ptt,1980 struct qed_ptt *p_ptt,
1981 struct qed_arfs_config_params *p_cfg_params)1981 struct qed_arfs_config_params *p_cfg_params)
1982{1982{
1983 if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits))
1984 return;
1985
1983 if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) {1986 if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) {
1984 qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,1987 qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,
1985 p_cfg_params->tcp,1988 p_cfg_params->tcp,
drivers/net/ethernet/qlogic/qed/qed_main.c+2−0
@@ -444,6 +444,8 @@ int qed_fill_dev_info(struct qed_dev *cdev, · 443 unmodified lines
444 dev_info->fw_eng = FW_ENGINEERING_VERSION;444 dev_info->fw_eng = FW_ENGINEERING_VERSION;
445 dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH,445 dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH,
446 &cdev->mf_bits);446 &cdev->mf_bits);
447 if (!test_bit(QED_MF_DISABLE_ARFS, &cdev->mf_bits))
448 dev_info->b_arfs_capable = true;
447 dev_info->tx_switching = true;449 dev_info->tx_switching = true;
448 450
449 if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)451 if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)
drivers/net/ethernet/qlogic/qed/qed_sriov.c+1−0
@@ -71,6 +71,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf) · 70 unmodified lines
71 p_ramrod->personality = PERSONALITY_ETH;71 p_ramrod->personality = PERSONALITY_ETH;
72 break;72 break;
73 case QED_PCI_ETH_ROCE:73 case QED_PCI_ETH_ROCE:
74 case QED_PCI_ETH_IWARP:
74 p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;75 p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
75 break;76 break;
76 default:77 default:
drivers/net/ethernet/qlogic/qede/qede_filter.c+3−0
@@ -311,6 +311,9 @@ int qede_alloc_arfs(struct qede_dev *edev) · 310 unmodified lines
311{311{
312 int i;312 int i;
313 313
314 if (!edev->dev_info.common.b_arfs_capable)
315 return -EINVAL;
316
314 edev->arfs = vzalloc(sizeof(*edev->arfs));317 edev->arfs = vzalloc(sizeof(*edev->arfs));
315 if (!edev->arfs)318 if (!edev->arfs)
316 return -ENOMEM;319 return -ENOMEM;
drivers/net/ethernet/qlogic/qede/qede_main.c+5−6
@@ -804,7 +804,7 @@ static void qede_init_ndev(struct qede_dev *edev) · 803 unmodified lines
804 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |804 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
805 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC;805 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC;
806 806
807 if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1)807 if (edev->dev_info.common.b_arfs_capable)
808 hw_features |= NETIF_F_NTUPLE;808 hw_features |= NETIF_F_NTUPLE;
809 809
810 if (edev->dev_info.common.vxlan_enable ||810 if (edev->dev_info.common.vxlan_enable ||
@@ -2274,7 +2274,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode, · 1463 unmodified lines
2274 qede_vlan_mark_nonconfigured(edev);2274 qede_vlan_mark_nonconfigured(edev);
2275 edev->ops->fastpath_stop(edev->cdev);2275 edev->ops->fastpath_stop(edev->cdev);
2276 2276
2277 if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {2277 if (edev->dev_info.common.b_arfs_capable) {
2278 qede_poll_for_freeing_arfs_filters(edev);2278 qede_poll_for_freeing_arfs_filters(edev);
2279 qede_free_arfs(edev);2279 qede_free_arfs(edev);
2280 }2280 }
@@ -2341,10 +2341,9 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, · 60 unmodified lines
2341 if (rc)2341 if (rc)
2342 goto err2;2342 goto err2;
2343 2343
2344 if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {2344 if (qede_alloc_arfs(edev)) {
2345 rc = qede_alloc_arfs(edev);2345 edev->ndev->features &= ~NETIF_F_NTUPLE;
2346 if (rc)2346 edev->dev_info.common.b_arfs_capable = false;
2347 DP_NOTICE(edev, "aRFS memory allocation failed\n");
2348 }2347 }
2349 2348
2350 qede_napi_add_enable(edev);2349 qede_napi_add_enable(edev);
drivers/net/ethernet/sfc/ef100.c+1−0
@@ -490,6 +490,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev, · 489 unmodified lines
490 if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) {490 if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) {
491 netif_err(efx, probe, efx->net_dev,491 netif_err(efx, probe, efx->net_dev,
492 "Func control window overruns BAR\n");492 "Func control window overruns BAR\n");
493 rc = -EIO;
493 goto fail;494 goto fail;
494 }495 }
495 496
drivers/net/ethernet/ti/cpsw_new.c+53−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/phy.h>17#include <linux/phy.h>
18#include <linux/phy/phy.h>18#include <linux/phy/phy.h>
19#include <linux/delay.h>19#include <linux/delay.h>
20#include <linux/pinctrl/consumer.h>
20#include <linux/pm_runtime.h>21#include <linux/pm_runtime.h>
21#include <linux/gpio/consumer.h>22#include <linux/gpio/consumer.h>
22#include <linux/of.h>23#include <linux/of.h>
@@ -2070,9 +2071,61 @@ static int cpsw_remove(struct platform_device *pdev) · 2047 unmodified lines
2070 return 0;2071 return 0;
2071}2072}
2072 2073
2074static int __maybe_unused cpsw_suspend(struct device *dev)
2075{
2076 struct cpsw_common *cpsw = dev_get_drvdata(dev);
2077 int i;
2078
2079 rtnl_lock();
2080
2081 for (i = 0; i < cpsw->data.slaves; i++) {
2082 struct net_device *ndev = cpsw->slaves[i].ndev;
2083
2084 if (!(ndev && netif_running(ndev)))
2085 continue;
2086
2087 cpsw_ndo_stop(ndev);
2088 }
2089
2090 rtnl_unlock();
2091
2092 /* Select sleep pin state */
2093 pinctrl_pm_select_sleep_state(dev);
2094
2095 return 0;
2096}
2097
2098static int __maybe_unused cpsw_resume(struct device *dev)
2099{
2100 struct cpsw_common *cpsw = dev_get_drvdata(dev);
2101 int i;
2102
2103 /* Select default pin state */
2104 pinctrl_pm_select_default_state(dev);
2105
2106 /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */
2107 rtnl_lock();
2108
2109 for (i = 0; i < cpsw->data.slaves; i++) {
2110 struct net_device *ndev = cpsw->slaves[i].ndev;
2111
2112 if (!(ndev && netif_running(ndev)))
2113 continue;
2114
2115 cpsw_ndo_open(ndev);
2116 }
2117
2118 rtnl_unlock();
2119
2120 return 0;
2121}
2122
2123static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
2124
2073static struct platform_driver cpsw_driver = {2125static struct platform_driver cpsw_driver = {
2074 .driver = {2126 .driver = {
2075 .name = "cpsw-switch",2127 .name = "cpsw-switch",
2128 .pm = &cpsw_pm_ops,
2076 .of_match_table = cpsw_of_mtable,2129 .of_match_table = cpsw_of_mtable,
2077 },2130 },
2078 .probe = cpsw_probe,2131 .probe = cpsw_probe,
drivers/net/geneve.c+27−10
@@ -777,7 +777,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb, · 776 unmodified lines
777 struct net_device *dev,777 struct net_device *dev,
778 struct geneve_sock *gs4,778 struct geneve_sock *gs4,
779 struct flowi4 *fl4,779 struct flowi4 *fl4,
780 const struct ip_tunnel_info *info)780 const struct ip_tunnel_info *info,
781 __be16 dport, __be16 sport)
781{782{
782 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);783 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
783 struct geneve_dev *geneve = netdev_priv(dev);784 struct geneve_dev *geneve = netdev_priv(dev);
@@ -793,6 +794,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb, · 9 unmodified lines
793 fl4->flowi4_proto = IPPROTO_UDP;794 fl4->flowi4_proto = IPPROTO_UDP;
794 fl4->daddr = info->key.u.ipv4.dst;795 fl4->daddr = info->key.u.ipv4.dst;
795 fl4->saddr = info->key.u.ipv4.src;796 fl4->saddr = info->key.u.ipv4.src;
797 fl4->fl4_dport = dport;
798 fl4->fl4_sport = sport;
796 799
797 tos = info->key.tos;800 tos = info->key.tos;
798 if ((tos == 1) && !geneve->cfg.collect_md) {801 if ((tos == 1) && !geneve->cfg.collect_md) {
@@ -827,7 +830,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, · 28 unmodified lines
827 struct net_device *dev,830 struct net_device *dev,
828 struct geneve_sock *gs6,831 struct geneve_sock *gs6,
829 struct flowi6 *fl6,832 struct flowi6 *fl6,
830 const struct ip_tunnel_info *info)833 const struct ip_tunnel_info *info,
834 __be16 dport, __be16 sport)
831{835{
832 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);836 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
833 struct geneve_dev *geneve = netdev_priv(dev);837 struct geneve_dev *geneve = netdev_priv(dev);
@@ -843,6 +847,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, · 9 unmodified lines
843 fl6->flowi6_proto = IPPROTO_UDP;847 fl6->flowi6_proto = IPPROTO_UDP;
844 fl6->daddr = info->key.u.ipv6.dst;848 fl6->daddr = info->key.u.ipv6.dst;
845 fl6->saddr = info->key.u.ipv6.src;849 fl6->saddr = info->key.u.ipv6.src;
850 fl6->fl6_dport = dport;
851 fl6->fl6_sport = sport;
852
846 prio = info->key.tos;853 prio = info->key.tos;
847 if ((prio == 1) && !geneve->cfg.collect_md) {854 if ((prio == 1) && !geneve->cfg.collect_md) {
848 prio = ip_tunnel_get_dsfield(ip_hdr(skb), skb);855 prio = ip_tunnel_get_dsfield(ip_hdr(skb), skb);
@@ -889,7 +896,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 40 unmodified lines
889 __be16 sport;896 __be16 sport;
890 int err;897 int err;
891 898
892 rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);899 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
900 rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
901 geneve->cfg.info.key.tp_dst, sport);
893 if (IS_ERR(rt))902 if (IS_ERR(rt))
894 return PTR_ERR(rt);903 return PTR_ERR(rt);
895 904
@@ -919,7 +928,6 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 23 unmodified lines
919 return -EMSGSIZE;928 return -EMSGSIZE;
920 }929 }
921 930
922 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
923 if (geneve->cfg.collect_md) {931 if (geneve->cfg.collect_md) {
924 tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);932 tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
925 ttl = key->ttl;933 ttl = key->ttl;
@@ -974,7 +982,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 48 unmodified lines
974 __be16 sport;982 __be16 sport;
975 int err;983 int err;
976 984
977 dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);985 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
986 dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
987 geneve->cfg.info.key.tp_dst, sport);
978 if (IS_ERR(dst))988 if (IS_ERR(dst))
979 return PTR_ERR(dst);989 return PTR_ERR(dst);
980 990
@@ -1003,7 +1013,6 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 22 unmodified lines
1003 return -EMSGSIZE;1013 return -EMSGSIZE;
1004 }1014 }
1005 1015
1006 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
1007 if (geneve->cfg.collect_md) {1016 if (geneve->cfg.collect_md) {
1008 prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);1017 prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
1009 ttl = key->ttl;1018 ttl = key->ttl;
@@ -1085,13 +1094,18 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 75 unmodified lines
1085{1094{
1086 struct ip_tunnel_info *info = skb_tunnel_info(skb);1095 struct ip_tunnel_info *info = skb_tunnel_info(skb);
1087 struct geneve_dev *geneve = netdev_priv(dev);1096 struct geneve_dev *geneve = netdev_priv(dev);
1097 __be16 sport;
1088 1098
1089 if (ip_tunnel_info_af(info) == AF_INET) {1099 if (ip_tunnel_info_af(info) == AF_INET) {
1090 struct rtable *rt;1100 struct rtable *rt;
1091 struct flowi4 fl4;1101 struct flowi4 fl4;
1102
1092 struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);1103 struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);
1104 sport = udp_flow_src_port(geneve->net, skb,
1105 1, USHRT_MAX, true);
1093 1106
1094 rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);1107 rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
1108 geneve->cfg.info.key.tp_dst, sport);
1095 if (IS_ERR(rt))1109 if (IS_ERR(rt))
1096 return PTR_ERR(rt);1110 return PTR_ERR(rt);
1097 1111
@@ -1101,9 +1115,13 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 3 unmodified lines
1101 } else if (ip_tunnel_info_af(info) == AF_INET6) {1115 } else if (ip_tunnel_info_af(info) == AF_INET6) {
1102 struct dst_entry *dst;1116 struct dst_entry *dst;
1103 struct flowi6 fl6;1117 struct flowi6 fl6;
1118
1104 struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);1119 struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);
1120 sport = udp_flow_src_port(geneve->net, skb,
1121 1, USHRT_MAX, true);
1105 1122
1106 dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);1123 dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
1124 geneve->cfg.info.key.tp_dst, sport);
1107 if (IS_ERR(dst))1125 if (IS_ERR(dst))
1108 return PTR_ERR(dst);1126 return PTR_ERR(dst);
1109 1127
@@ -1114,8 +1132,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 4 unmodified lines
1114 return -EINVAL;1132 return -EINVAL;
1115 }1133 }
1116 1134
1117 info->key.tp_src = udp_flow_src_port(geneve->net, skb,1135 info->key.tp_src = sport;
1118 1, USHRT_MAX, true);
1119 info->key.tp_dst = geneve->cfg.info.key.tp_dst;1136 info->key.tp_dst = geneve->cfg.info.key.tp_dst;
1120 return 0;1137 return 0;
1121}1138}
drivers/net/hyperv/hyperv_net.h+7−0
@@ -847,6 +847,10 @@ struct nvsp_message { · 846 unmodified lines
847 847
848#define NETVSC_XDP_HDRM 256848#define NETVSC_XDP_HDRM 256
849 849
850#define NETVSC_XFER_HEADER_SIZE(rng_cnt) \
851 (offsetof(struct vmtransfer_page_packet_header, ranges) + \
852 (rng_cnt) * sizeof(struct vmtransfer_page_range))
853
850struct multi_send_data {854struct multi_send_data {
851 struct sk_buff *skb; /* skb containing the pkt */855 struct sk_buff *skb; /* skb containing the pkt */
852 struct hv_netvsc_packet *pkt; /* netvsc pkt pending */856 struct hv_netvsc_packet *pkt; /* netvsc pkt pending */
@@ -974,6 +978,9 @@ struct net_device_context { · 121 unmodified lines
974 /* Serial number of the VF to team with */978 /* Serial number of the VF to team with */
975 u32 vf_serial;979 u32 vf_serial;
976 980
981 /* Is the current data path through the VF NIC? */
982 bool data_path_is_vf;
983
977 /* Used to temporarily save the config info across hibernation */984 /* Used to temporarily save the config info across hibernation */
978 struct netvsc_device_info *saved_netvsc_dev_info;985 struct netvsc_device_info *saved_netvsc_dev_info;
979};986};
drivers/net/hyperv/netvsc.c+111−13
@@ -388,6 +388,15 @@ static int netvsc_init_buf(struct hv_device *device, · 387 unmodified lines
388 net_device->recv_section_size = resp->sections[0].sub_alloc_size;388 net_device->recv_section_size = resp->sections[0].sub_alloc_size;
389 net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;389 net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;
390 390
391 /* Ensure buffer will not overflow */
392 if (net_device->recv_section_size < NETVSC_MTU_MIN || (u64)net_device->recv_section_size *
393 (u64)net_device->recv_section_cnt > (u64)buf_size) {
394 netdev_err(ndev, "invalid recv_section_size %u\n",
395 net_device->recv_section_size);
396 ret = -EINVAL;
397 goto cleanup;
398 }
399
391 /* Setup receive completion ring.400 /* Setup receive completion ring.
392 * Add 1 to the recv_section_cnt because at least one entry in a401 * Add 1 to the recv_section_cnt because at least one entry in a
393 * ring buffer has to be empty.402 * ring buffer has to be empty.
@@ -460,6 +469,12 @@ static int netvsc_init_buf(struct hv_device *device, · 66 unmodified lines
460 /* Parse the response */469 /* Parse the response */
461 net_device->send_section_size = init_packet->msg.470 net_device->send_section_size = init_packet->msg.
462 v1_msg.send_send_buf_complete.section_size;471 v1_msg.send_send_buf_complete.section_size;
472 if (net_device->send_section_size < NETVSC_MTU_MIN) {
473 netdev_err(ndev, "invalid send_section_size %u\n",
474 net_device->send_section_size);
475 ret = -EINVAL;
476 goto cleanup;
477 }
463 478
464 /* Section count is simply the size divided by the section size. */479 /* Section count is simply the size divided by the section size. */
465 net_device->send_section_cnt = buf_size / net_device->send_section_size;480 net_device->send_section_cnt = buf_size / net_device->send_section_size;
@@ -731,12 +746,49 @@ static void netvsc_send_completion(struct net_device *ndev, · 265 unmodified lines
731 int budget)746 int budget)
732{747{
733 const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);748 const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
749 u32 msglen = hv_pkt_datalen(desc);
750
751 /* Ensure packet is big enough to read header fields */
752 if (msglen < sizeof(struct nvsp_message_header)) {
753 netdev_err(ndev, "nvsp_message length too small: %u\n", msglen);
754 return;
755 }
734 756
735 switch (nvsp_packet->hdr.msg_type) {757 switch (nvsp_packet->hdr.msg_type) {
736 case NVSP_MSG_TYPE_INIT_COMPLETE:758 case NVSP_MSG_TYPE_INIT_COMPLETE:
759 if (msglen < sizeof(struct nvsp_message_header) +
760 sizeof(struct nvsp_message_init_complete)) {
761 netdev_err(ndev, "nvsp_msg length too small: %u\n",
762 msglen);
763 return;
764 }
765 fallthrough;
766
737 case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:767 case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
768 if (msglen < sizeof(struct nvsp_message_header) +
769 sizeof(struct nvsp_1_message_send_receive_buffer_complete)) {
770 netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
771 msglen);
772 return;
773 }
774 fallthrough;
775
738 case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:776 case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
777 if (msglen < sizeof(struct nvsp_message_header) +
778 sizeof(struct nvsp_1_message_send_send_buffer_complete)) {
779 netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
780 msglen);
781 return;
782 }
783 fallthrough;
784
739 case NVSP_MSG5_TYPE_SUBCHANNEL:785 case NVSP_MSG5_TYPE_SUBCHANNEL:
786 if (msglen < sizeof(struct nvsp_message_header) +
787 sizeof(struct nvsp_5_subchannel_complete)) {
788 netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
789 msglen);
790 return;
791 }
740 /* Copy the response back */792 /* Copy the response back */
741 memcpy(&net_device->channel_init_pkt, nvsp_packet,793 memcpy(&net_device->channel_init_pkt, nvsp_packet,
742 sizeof(struct nvsp_message));794 sizeof(struct nvsp_message));
@@ -1117,19 +1169,28 @@ static void enq_receive_complete(struct net_device *ndev, · 374 unmodified lines
1117static int netvsc_receive(struct net_device *ndev,1169static int netvsc_receive(struct net_device *ndev,
1118 struct netvsc_device *net_device,1170 struct netvsc_device *net_device,
1119 struct netvsc_channel *nvchan,1171 struct netvsc_channel *nvchan,
1120 const struct vmpacket_descriptor *desc,1172 const struct vmpacket_descriptor *desc)
1121 const struct nvsp_message *nvsp)
1122{1173{
1123 struct net_device_context *net_device_ctx = netdev_priv(ndev);1174 struct net_device_context *net_device_ctx = netdev_priv(ndev);
1124 struct vmbus_channel *channel = nvchan->channel;1175 struct vmbus_channel *channel = nvchan->channel;
1125 const struct vmtransfer_page_packet_header *vmxferpage_packet1176 const struct vmtransfer_page_packet_header *vmxferpage_packet
1126 = container_of(desc, const struct vmtransfer_page_packet_header, d);1177 = container_of(desc, const struct vmtransfer_page_packet_header, d);
1178 const struct nvsp_message *nvsp = hv_pkt_data(desc);
1179 u32 msglen = hv_pkt_datalen(desc);
1127 u16 q_idx = channel->offermsg.offer.sub_channel_index;1180 u16 q_idx = channel->offermsg.offer.sub_channel_index;
1128 char *recv_buf = net_device->recv_buf;1181 char *recv_buf = net_device->recv_buf;
1129 u32 status = NVSP_STAT_SUCCESS;1182 u32 status = NVSP_STAT_SUCCESS;
1130 int i;1183 int i;
1131 int count = 0;1184 int count = 0;
1132 1185
1186 /* Ensure packet is big enough to read header fields */
1187 if (msglen < sizeof(struct nvsp_message_header)) {
1188 netif_err(net_device_ctx, rx_err, ndev,
1189 "invalid nvsp header, length too small: %u\n",
1190 msglen);
1191 return 0;
1192 }
1193
1133 /* Make sure this is a valid nvsp packet */1194 /* Make sure this is a valid nvsp packet */
1134 if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) {1195 if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) {
1135 netif_err(net_device_ctx, rx_err, ndev,1196 netif_err(net_device_ctx, rx_err, ndev,
@@ -1138,6 +1199,14 @@ static int netvsc_receive(struct net_device *ndev, · 2 unmodified lines
1138 return 0;1199 return 0;
1139 }1200 }
1140 1201
1202 /* Validate xfer page pkt header */
1203 if ((desc->offset8 << 3) < sizeof(struct vmtransfer_page_packet_header)) {
1204 netif_err(net_device_ctx, rx_err, ndev,
1205 "Invalid xfer page pkt, offset too small: %u\n",
1206 desc->offset8 << 3);
1207 return 0;
1208 }
1209
1141 if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) {1210 if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) {
1142 netif_err(net_device_ctx, rx_err, ndev,1211 netif_err(net_device_ctx, rx_err, ndev,
1143 "Invalid xfer page set id - expecting %x got %x\n",1212 "Invalid xfer page set id - expecting %x got %x\n",
@@ -1148,6 +1217,14 @@ static int netvsc_receive(struct net_device *ndev, · 4 unmodified lines
1148 1217
1149 count = vmxferpage_packet->range_cnt;1218 count = vmxferpage_packet->range_cnt;
1150 1219
1220 /* Check count for a valid value */
1221 if (NETVSC_XFER_HEADER_SIZE(count) > desc->offset8 << 3) {
1222 netif_err(net_device_ctx, rx_err, ndev,
1223 "Range count is not valid: %d\n",
1224 count);
1225 return 0;
1226 }
1227
1151 /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */1228 /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
1152 for (i = 0; i < count; i++) {1229 for (i = 0; i < count; i++) {
1153 u32 offset = vmxferpage_packet->ranges[i].byte_offset;1230 u32 offset = vmxferpage_packet->ranges[i].byte_offset;
@@ -1155,7 +1232,8 @@ static int netvsc_receive(struct net_device *ndev, · 1 unmodified line
1155 void *data;1232 void *data;
1156 int ret;1233 int ret;
1157 1234
1158 if (unlikely(offset + buflen > net_device->recv_buf_size)) {1235 if (unlikely(offset > net_device->recv_buf_size ||
1236 buflen > net_device->recv_buf_size - offset)) {
1159 nvchan->rsc.cnt = 0;1237 nvchan->rsc.cnt = 0;
1160 status = NVSP_STAT_FAIL;1238 status = NVSP_STAT_FAIL;
1161 netif_err(net_device_ctx, rx_err, ndev,1239 netif_err(net_device_ctx, rx_err, ndev,
@@ -1194,6 +1272,13 @@ static void netvsc_send_table(struct net_device *ndev, · 32 unmodified lines
1194 u32 count, offset, *tab;1272 u32 count, offset, *tab;
1195 int i;1273 int i;
1196 1274
1275 /* Ensure packet is big enough to read send_table fields */
1276 if (msglen < sizeof(struct nvsp_message_header) +
1277 sizeof(struct nvsp_5_send_indirect_table)) {
1278 netdev_err(ndev, "nvsp_v5_msg length too small: %u\n", msglen);
1279 return;
1280 }
1281
1197 count = nvmsg->msg.v5_msg.send_table.count;1282 count = nvmsg->msg.v5_msg.send_table.count;
1198 offset = nvmsg->msg.v5_msg.send_table.offset;1283 offset = nvmsg->msg.v5_msg.send_table.offset;
1199 1284
@@ -1225,10 +1310,18 @@ static void netvsc_send_table(struct net_device *ndev, · 25 unmodified lines
1225}1310}
1226 1311
1227static void netvsc_send_vf(struct net_device *ndev,1312static void netvsc_send_vf(struct net_device *ndev,
1228 const struct nvsp_message *nvmsg)1313 const struct nvsp_message *nvmsg,
1314 u32 msglen)
1229{1315{
1230 struct net_device_context *net_device_ctx = netdev_priv(ndev);1316 struct net_device_context *net_device_ctx = netdev_priv(ndev);
1231 1317
1318 /* Ensure packet is big enough to read its fields */
1319 if (msglen < sizeof(struct nvsp_message_header) +
1320 sizeof(struct nvsp_4_send_vf_association)) {
1321 netdev_err(ndev, "nvsp_v4_msg length too small: %u\n", msglen);
1322 return;
1323 }
1324
1232 net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;1325 net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
1233 net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;1326 net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
1234 netdev_info(ndev, "VF slot %u %s\n",1327 netdev_info(ndev, "VF slot %u %s\n",
@@ -1238,16 +1331,24 @@ static void netvsc_send_vf(struct net_device *ndev, · 3 unmodified lines
1238 1331
1239static void netvsc_receive_inband(struct net_device *ndev,1332static void netvsc_receive_inband(struct net_device *ndev,
1240 struct netvsc_device *nvscdev,1333 struct netvsc_device *nvscdev,
1241 const struct nvsp_message *nvmsg,1334 const struct vmpacket_descriptor *desc)
1242 u32 msglen)
1243{1335{
1336 const struct nvsp_message *nvmsg = hv_pkt_data(desc);
1337 u32 msglen = hv_pkt_datalen(desc);
1338
1339 /* Ensure packet is big enough to read header fields */
1340 if (msglen < sizeof(struct nvsp_message_header)) {
1341 netdev_err(ndev, "inband nvsp_message length too small: %u\n", msglen);
1342 return;
1343 }
1344
1244 switch (nvmsg->hdr.msg_type) {1345 switch (nvmsg->hdr.msg_type) {
1245 case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE:1346 case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE:
1246 netvsc_send_table(ndev, nvscdev, nvmsg, msglen);1347 netvsc_send_table(ndev, nvscdev, nvmsg, msglen);
1247 break;1348 break;
1248 1349
1249 case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION:1350 case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION:
1250 netvsc_send_vf(ndev, nvmsg);1351 netvsc_send_vf(ndev, nvmsg, msglen);
1251 break;1352 break;
1252 }1353 }
1253}1354}
@@ -1261,23 +1362,20 @@ static int netvsc_process_raw_pkt(struct hv_device *device, · 7 unmodified lines
1261{1362{
1262 struct vmbus_channel *channel = nvchan->channel;1363 struct vmbus_channel *channel = nvchan->channel;
1263 const struct nvsp_message *nvmsg = hv_pkt_data(desc);1364 const struct nvsp_message *nvmsg = hv_pkt_data(desc);
1264 u32 msglen = hv_pkt_datalen(desc);
1265 1365
1266 trace_nvsp_recv(ndev, channel, nvmsg);1366 trace_nvsp_recv(ndev, channel, nvmsg);
1267 1367
1268 switch (desc->type) {1368 switch (desc->type) {
1269 case VM_PKT_COMP:1369 case VM_PKT_COMP:
1270 netvsc_send_completion(ndev, net_device, channel,1370 netvsc_send_completion(ndev, net_device, channel, desc, budget);
1271 desc, budget);
1272 break;1371 break;
1273 1372
1274 case VM_PKT_DATA_USING_XFER_PAGES:1373 case VM_PKT_DATA_USING_XFER_PAGES:
1275 return netvsc_receive(ndev, net_device, nvchan,1374 return netvsc_receive(ndev, net_device, nvchan, desc);
1276 desc, nvmsg);
1277 break;1375 break;
1278 1376
1279 case VM_PKT_DATA_INBAND:1377 case VM_PKT_DATA_INBAND:
1280 netvsc_receive_inband(ndev, net_device, nvmsg, msglen);1378 netvsc_receive_inband(ndev, net_device, desc);
1281 break;1379 break;
1282 1380
1283 default:1381 default:
drivers/net/hyperv/netvsc_drv.c+29−6
@@ -748,6 +748,13 @@ void netvsc_linkstatus_callback(struct net_device *net, · 747 unmodified lines
748 struct netvsc_reconfig *event;748 struct netvsc_reconfig *event;
749 unsigned long flags;749 unsigned long flags;
750 750
751 /* Ensure the packet is big enough to access its fields */
752 if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(struct rndis_indicate_status)) {
753 netdev_err(net, "invalid rndis_indicate_status packet, len: %u\n",
754 resp->msg_len);
755 return;
756 }
757
751 /* Update the physical link speed when changing to another vSwitch */758 /* Update the physical link speed when changing to another vSwitch */
752 if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {759 if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {
753 u32 speed;760 u32 speed;
@@ -2366,7 +2373,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 1612 unmodified lines
2366 return NOTIFY_OK;2373 return NOTIFY_OK;
2367}2374}
2368 2375
2369/* VF up/down change detected, schedule to change data path */2376/* Change the data path when VF UP/DOWN/CHANGE are detected.
2377 *
2378 * Typically a UP or DOWN event is followed by a CHANGE event, so
2379 * net_device_ctx->data_path_is_vf is used to cache the current data path
2380 * to avoid the duplicate call of netvsc_switch_datapath() and the duplicate
2381 * message.
2382 *
2383 * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network
2384 * interface, there is only the CHANGE event and no UP or DOWN event.
2385 */
2370static int netvsc_vf_changed(struct net_device *vf_netdev)2386static int netvsc_vf_changed(struct net_device *vf_netdev)
2371{2387{
2372 struct net_device_context *net_device_ctx;2388 struct net_device_context *net_device_ctx;
@@ -2383,6 +2399,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev) · 10 unmodified lines
2383 if (!netvsc_dev)2399 if (!netvsc_dev)
2384 return NOTIFY_DONE;2400 return NOTIFY_DONE;
2385 2401
2402 if (net_device_ctx->data_path_is_vf == vf_is_up)
2403 return NOTIFY_OK;
2404 net_device_ctx->data_path_is_vf = vf_is_up;
2405
2386 netvsc_switch_datapath(ndev, vf_is_up);2406 netvsc_switch_datapath(ndev, vf_is_up);
2387 netdev_info(ndev, "Data path switched %s VF: %s\n",2407 netdev_info(ndev, "Data path switched %s VF: %s\n",
2388 vf_is_up ? "to" : "from", vf_netdev->name);2408 vf_is_up ? "to" : "from", vf_netdev->name);
@@ -2587,8 +2607,8 @@ static int netvsc_remove(struct hv_device *dev) · 198 unmodified lines
2587static int netvsc_suspend(struct hv_device *dev)2607static int netvsc_suspend(struct hv_device *dev)
2588{2608{
2589 struct net_device_context *ndev_ctx;2609 struct net_device_context *ndev_ctx;
2590 struct net_device *vf_netdev, *net;
2591 struct netvsc_device *nvdev;2610 struct netvsc_device *nvdev;
2611 struct net_device *net;
2592 int ret;2612 int ret;
2593 2613
2594 net = hv_get_drvdata(dev);2614 net = hv_get_drvdata(dev);
@@ -2604,10 +2624,6 @@ static int netvsc_suspend(struct hv_device *dev) · 9 unmodified lines
2604 goto out;2624 goto out;
2605 }2625 }
2606 2626
2607 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
2608 if (vf_netdev)
2609 netvsc_unregister_vf(vf_netdev);
2610
2611 /* Save the current config info */2627 /* Save the current config info */
2612 ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);2628 ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
2613 2629
@@ -2628,6 +2644,12 @@ static int netvsc_resume(struct hv_device *dev) · 14 unmodified lines
2628 rtnl_lock();2644 rtnl_lock();
2629 2645
2630 net_device_ctx = netdev_priv(net);2646 net_device_ctx = netdev_priv(net);
2647
2648 /* Reset the data path to the netvsc NIC before re-opening the vmbus
2649 * channel. Later netvsc_netdev_event() will switch the data path to
2650 * the VF upon the UP or CHANGE event.
2651 */
2652 net_device_ctx->data_path_is_vf = false;
2631 device_info = net_device_ctx->saved_netvsc_dev_info;2653 device_info = net_device_ctx->saved_netvsc_dev_info;
2632 2654
2633 ret = netvsc_attach(net, device_info);2655 ret = netvsc_attach(net, device_info);
@@ -2695,6 +2717,7 @@ static int netvsc_netdev_event(struct notifier_block *this, · 61 unmodified lines
2695 return netvsc_unregister_vf(event_dev);2717 return netvsc_unregister_vf(event_dev);
2696 case NETDEV_UP:2718 case NETDEV_UP:
2697 case NETDEV_DOWN:2719 case NETDEV_DOWN:
2720 case NETDEV_CHANGE:
2698 return netvsc_vf_changed(event_dev);2721 return netvsc_vf_changed(event_dev);
2699 default:2722 default:
2700 return NOTIFY_DONE;2723 return NOTIFY_DONE;
drivers/net/hyperv/rndis_filter.c+66−7
@@ -275,6 +275,16 @@ static void rndis_filter_receive_response(struct net_device *ndev, · 274 unmodified lines
275 return;275 return;
276 }276 }
277 277
278 /* Ensure the packet is big enough to read req_id. Req_id is the 1st
279 * field in any request/response message, so the payload should have at
280 * least sizeof(u32) bytes
281 */
282 if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(u32)) {
283 netdev_err(ndev, "rndis msg_len too small: %u\n",
284 resp->msg_len);
285 return;
286 }
287
278 spin_lock_irqsave(&dev->request_lock, flags);288 spin_lock_irqsave(&dev->request_lock, flags);
279 list_for_each_entry(request, &dev->req_list, list_ent) {289 list_for_each_entry(request, &dev->req_list, list_ent) {
280 /*290 /*
@@ -331,8 +341,9 @@ static void rndis_filter_receive_response(struct net_device *ndev, · 50 unmodified lines
331 * Get the Per-Packet-Info with the specified type341 * Get the Per-Packet-Info with the specified type
332 * return NULL if not found.342 * return NULL if not found.
333 */343 */
334static inline void *rndis_get_ppi(struct rndis_packet *rpkt,344static inline void *rndis_get_ppi(struct net_device *ndev,
335 u32 type, u8 internal)345 struct rndis_packet *rpkt,
346 u32 rpkt_len, u32 type, u8 internal)
336{347{
337 struct rndis_per_packet_info *ppi;348 struct rndis_per_packet_info *ppi;
338 int len;349 int len;
@@ -340,11 +351,36 @@ static inline void *rndis_get_ppi(struct rndis_packet *rpkt, · 1 unmodified line
340 if (rpkt->per_pkt_info_offset == 0)351 if (rpkt->per_pkt_info_offset == 0)
341 return NULL;352 return NULL;
342 353
354 /* Validate info_offset and info_len */
355 if (rpkt->per_pkt_info_offset < sizeof(struct rndis_packet) ||
356 rpkt->per_pkt_info_offset > rpkt_len) {
357 netdev_err(ndev, "Invalid per_pkt_info_offset: %u\n",
358 rpkt->per_pkt_info_offset);
359 return NULL;
360 }
361
362 if (rpkt->per_pkt_info_len > rpkt_len - rpkt->per_pkt_info_offset) {
363 netdev_err(ndev, "Invalid per_pkt_info_len: %u\n",
364 rpkt->per_pkt_info_len);
365 return NULL;
366 }
367
343 ppi = (struct rndis_per_packet_info *)((ulong)rpkt +368 ppi = (struct rndis_per_packet_info *)((ulong)rpkt +
344 rpkt->per_pkt_info_offset);369 rpkt->per_pkt_info_offset);
345 len = rpkt->per_pkt_info_len;370 len = rpkt->per_pkt_info_len;
346 371
347 while (len > 0) {372 while (len > 0) {
373 /* Validate ppi_offset and ppi_size */
374 if (ppi->size > len) {
375 netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size);
376 continue;
377 }
378
379 if (ppi->ppi_offset >= ppi->size) {
380 netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset);
381 continue;
382 }
383
348 if (ppi->type == type && ppi->internal == internal)384 if (ppi->type == type && ppi->internal == internal)
349 return (void *)((ulong)ppi + ppi->ppi_offset);385 return (void *)((ulong)ppi + ppi->ppi_offset);
350 len -= ppi->size;386 len -= ppi->size;
@@ -388,14 +424,29 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 37 unmodified lines
388 const struct ndis_pkt_8021q_info *vlan;424 const struct ndis_pkt_8021q_info *vlan;
389 const struct rndis_pktinfo_id *pktinfo_id;425 const struct rndis_pktinfo_id *pktinfo_id;
390 const u32 *hash_info;426 const u32 *hash_info;
391 u32 data_offset;427 u32 data_offset, rpkt_len;
392 void *data;428 void *data;
393 bool rsc_more = false;429 bool rsc_more = false;
394 int ret;430 int ret;
395 431
432 /* Ensure data_buflen is big enough to read header fields */
433 if (data_buflen < RNDIS_HEADER_SIZE + sizeof(struct rndis_packet)) {
434 netdev_err(ndev, "invalid rndis pkt, data_buflen too small: %u\n",
435 data_buflen);
436 return NVSP_STAT_FAIL;
437 }
438
439 /* Validate rndis_pkt offset */
440 if (rndis_pkt->data_offset >= data_buflen - RNDIS_HEADER_SIZE) {
441 netdev_err(ndev, "invalid rndis packet offset: %u\n",
442 rndis_pkt->data_offset);
443 return NVSP_STAT_FAIL;
444 }
445
396 /* Remove the rndis header and pass it back up the stack */446 /* Remove the rndis header and pass it back up the stack */
397 data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;447 data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
398 448
449 rpkt_len = data_buflen - RNDIS_HEADER_SIZE;
399 data_buflen -= data_offset;450 data_buflen -= data_offset;
400 451
401 /*452 /*
@@ -410,13 +461,13 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 8 unmodified lines
410 return NVSP_STAT_FAIL;461 return NVSP_STAT_FAIL;
411 }462 }
412 463
413 vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO, 0);464 vlan = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, IEEE_8021Q_INFO, 0);
414 465
415 csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0);466 csum_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, TCPIP_CHKSUM_PKTINFO, 0);
416 467
417 hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0);468 hash_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, NBL_HASH_VALUE, 0);
418 469
419 pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1);470 pktinfo_id = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, RNDIS_PKTINFO_ID, 1);
420 471
421 data = (void *)msg + data_offset;472 data = (void *)msg + data_offset;
422 473
@@ -474,6 +525,14 @@ int rndis_filter_receive(struct net_device *ndev, · 51 unmodified lines
474 if (netif_msg_rx_status(net_device_ctx))525 if (netif_msg_rx_status(net_device_ctx))
475 dump_rndis_message(ndev, rndis_msg);526 dump_rndis_message(ndev, rndis_msg);
476 527
528 /* Validate incoming rndis_message packet */
529 if (buflen < RNDIS_HEADER_SIZE || rndis_msg->msg_len < RNDIS_HEADER_SIZE ||
530 buflen < rndis_msg->msg_len) {
531 netdev_err(ndev, "Invalid rndis_msg (buflen: %u, msg_len: %u)\n",
532 buflen, rndis_msg->msg_len);
533 return NVSP_STAT_FAIL;
534 }
535
477 switch (rndis_msg->ndis_msg_type) {536 switch (rndis_msg->ndis_msg_type) {
478 case RNDIS_MSG_PACKET:537 case RNDIS_MSG_PACKET:
479 return rndis_filter_receive_data(ndev, net_dev, nvchan,538 return rndis_filter_receive_data(ndev, net_dev, nvchan,
drivers/net/ieee802154/adf7242.c+3−1
@@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp) · 881 unmodified lines
882 int ret;882 int ret;
883 u8 lqi, len_u8, *data;883 u8 lqi, len_u8, *data;
884 884
885 adf7242_read_reg(lp, 0, &len_u8);885 ret = adf7242_read_reg(lp, 0, &len_u8);
886 if (ret)
887 return ret;
886 888
887 len = len_u8;889 len = len_u8;
888 890
drivers/net/ieee802154/ca8210.c+1−0
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv) · 2924 unmodified lines
2925 );2925 );
2926 if (!priv->irq_workqueue) {2926 if (!priv->irq_workqueue) {
2927 dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");2927 dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
2928 destroy_workqueue(priv->mlme_workqueue);
2928 return -ENOMEM;2929 return -ENOMEM;
2929 }2930 }
2930 2931
drivers/net/ipa/ipa_table.c+2−2
@@ -521,7 +521,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) · 520 unmodified lines
521 val = ioread32(endpoint->ipa->reg_virt + offset);521 val = ioread32(endpoint->ipa->reg_virt + offset);
522 522
523 /* Zero all filter-related fields, preserving the rest */523 /* Zero all filter-related fields, preserving the rest */
524 u32_replace_bits(val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);524 u32p_replace_bits(&val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);
525 525
526 iowrite32(val, endpoint->ipa->reg_virt + offset);526 iowrite32(val, endpoint->ipa->reg_virt + offset);
527}527}
@@ -573,7 +573,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) · 45 unmodified lines
573 val = ioread32(ipa->reg_virt + offset);573 val = ioread32(ipa->reg_virt + offset);
574 574
575 /* Zero all route-related fields, preserving the rest */575 /* Zero all route-related fields, preserving the rest */
576 u32_replace_bits(val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);576 u32p_replace_bits(&val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
577 577
578 iowrite32(val, ipa->reg_virt + offset);578 iowrite32(val, ipa->reg_virt + offset);
579}579}
drivers/net/phy/phy.c+1−1
@@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev) · 995 unmodified lines
996{996{
997 struct net_device *dev = phydev->attached_dev;997 struct net_device *dev = phydev->attached_dev;
998 998
999 if (!phy_is_started(phydev)) {999 if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) {
1000 WARN(1, "called from state %s\n",1000 WARN(1, "called from state %s\n",
1001 phy_state_to_str(phydev->state));1001 phy_state_to_str(phydev->state));
1002 return;1002 return;
drivers/net/phy/phy_device.c+6−5
@@ -1143,10 +1143,6 @@ int phy_init_hw(struct phy_device *phydev) · 1142 unmodified lines
1143 if (ret < 0)1143 if (ret < 0)
1144 return ret;1144 return ret;
1145 1145
1146 ret = phy_disable_interrupts(phydev);
1147 if (ret)
1148 return ret;
1149
1150 if (phydev->drv->config_init)1146 if (phydev->drv->config_init)
1151 ret = phydev->drv->config_init(phydev);1147 ret = phydev->drv->config_init(phydev);
1152 1148
@@ -1423,6 +1419,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 270 unmodified lines
1423 if (err)1419 if (err)
1424 goto error;1420 goto error;
1425 1421
1422 err = phy_disable_interrupts(phydev);
1423 if (err)
1424 return err;
1425
1426 phy_resume(phydev);1426 phy_resume(phydev);
1427 phy_led_triggers_register(phydev);1427 phy_led_triggers_register(phydev);
1428 1428
@@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev) · 253 unmodified lines
1682 1682
1683 phy_led_triggers_unregister(phydev);1683 phy_led_triggers_unregister(phydev);
1684 1684
1685 module_put(phydev->mdio.dev.driver->owner);1685 if (phydev->mdio.dev.driver)
1686 module_put(phydev->mdio.dev.driver->owner);
1686 1687
1687 /* If the device had no specific driver before (i.e. - it1688 /* If the device had no specific driver before (i.e. - it
1688 * was using the generic driver), we unbind the device1689 * was using the generic driver), we unbind the device
drivers/net/usb/rndis_host.c+1−1
@@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) · 200 unmodified lines
201 dev_dbg(&info->control->dev,201 dev_dbg(&info->control->dev,
202 "rndis response error, code %d\n", retval);202 "rndis response error, code %d\n", retval);
203 }203 }
204 msleep(20);204 msleep(40);
205 }205 }
206 dev_dbg(&info->control->dev, "rndis response timeout\n");206 dev_dbg(&info->control->dev, "rndis response timeout\n");
207 return -ETIMEDOUT;207 return -ETIMEDOUT;
drivers/net/wan/hdlc_cisco.c+1−0
@@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, · 117 unmodified lines
118 skb_put(skb, sizeof(struct cisco_packet));118 skb_put(skb, sizeof(struct cisco_packet));
119 skb->priority = TC_PRIO_CONTROL;119 skb->priority = TC_PRIO_CONTROL;
120 skb->dev = dev;120 skb->dev = dev;
121 skb->protocol = htons(ETH_P_HDLC);
121 skb_reset_network_header(skb);122 skb_reset_network_header(skb);
122 123
123 dev_queue_xmit(skb);124 dev_queue_xmit(skb);
drivers/net/wan/hdlc_fr.c+5−1
@@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) · 432 unmodified lines
433 if (pvc->state.fecn) /* TX Congestion counter */433 if (pvc->state.fecn) /* TX Congestion counter */
434 dev->stats.tx_compressed++;434 dev->stats.tx_compressed++;
435 skb->dev = pvc->frad;435 skb->dev = pvc->frad;
436 skb->protocol = htons(ETH_P_HDLC);
437 skb_reset_network_header(skb);
436 dev_queue_xmit(skb);438 dev_queue_xmit(skb);
437 return NETDEV_TX_OK;439 return NETDEV_TX_OK;
438 }440 }
@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) · 116 unmodified lines
555 skb_put(skb, i);557 skb_put(skb, i);
556 skb->priority = TC_PRIO_CONTROL;558 skb->priority = TC_PRIO_CONTROL;
557 skb->dev = dev;559 skb->dev = dev;
560 skb->protocol = htons(ETH_P_HDLC);
558 skb_reset_network_header(skb);561 skb_reset_network_header(skb);
559 562
560 dev_queue_xmit(skb);563 dev_queue_xmit(skb);
@@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev) · 480 unmodified lines
1041{1044{
1042 dev->type = ARPHRD_DLCI;1045 dev->type = ARPHRD_DLCI;
1043 dev->flags = IFF_POINTOPOINT;1046 dev->flags = IFF_POINTOPOINT;
1044 dev->hard_header_len = 10;1047 dev->hard_header_len = 0;
1045 dev->addr_len = 2;1048 dev->addr_len = 2;
1046 netif_keep_dst(dev);1049 netif_keep_dst(dev);
1047}1050}
@@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 45 unmodified lines
1093 dev->mtu = HDLC_MAX_MTU;1096 dev->mtu = HDLC_MAX_MTU;
1094 dev->min_mtu = 68;1097 dev->min_mtu = 68;
1095 dev->max_mtu = HDLC_MAX_MTU;1098 dev->max_mtu = HDLC_MAX_MTU;
1099 dev->needed_headroom = 10;
1096 dev->priv_flags |= IFF_NO_QUEUE;1100 dev->priv_flags |= IFF_NO_QUEUE;
1097 dev->ml_priv = pvc;1101 dev->ml_priv = pvc;
1098 1102
drivers/net/wan/hdlc_ppp.c+12−5
@@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, · 250 unmodified lines
251 251
252 skb->priority = TC_PRIO_CONTROL;252 skb->priority = TC_PRIO_CONTROL;
253 skb->dev = dev;253 skb->dev = dev;
254 skb->protocol = htons(ETH_P_HDLC);
254 skb_reset_network_header(skb);255 skb_reset_network_header(skb);
255 skb_queue_tail(&tx_queue, skb);256 skb_queue_tail(&tx_queue, skb);
256}257}
@@ -383,11 +384,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 126 unmodified lines
383 }384 }
384 385
385 for (opt = data; len; len -= opt[1], opt += opt[1]) {386 for (opt = data; len; len -= opt[1], opt += opt[1]) {
386 if (len < 2 || len < opt[1]) {387 if (len < 2 || opt[1] < 2 || len < opt[1])
387 dev->stats.rx_errors++;388 goto err_out;
388 kfree(out);
389 return; /* bad packet, drop silently */
390 }
391 389
392 if (pid == PID_LCP)390 if (pid == PID_LCP)
393 switch (opt[0]) {391 switch (opt[0]) {
@@ -395,6 +393,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 1 unmodified line
395 continue; /* MRU always OK and > 1500 bytes? */393 continue; /* MRU always OK and > 1500 bytes? */
396 394
397 case LCP_OPTION_ACCM: /* async control character map */395 case LCP_OPTION_ACCM: /* async control character map */
396 if (opt[1] < sizeof(valid_accm))
397 goto err_out;
398 if (!memcmp(opt, valid_accm,398 if (!memcmp(opt, valid_accm,
399 sizeof(valid_accm)))399 sizeof(valid_accm)))
400 continue;400 continue;
@@ -406,6 +406,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 5 unmodified lines
406 }406 }
407 break;407 break;
408 case LCP_OPTION_MAGIC:408 case LCP_OPTION_MAGIC:
409 if (len < 6)
410 goto err_out;
409 if (opt[1] != 6 || (!opt[2] && !opt[3] &&411 if (opt[1] != 6 || (!opt[2] && !opt[3] &&
410 !opt[4] && !opt[5]))412 !opt[4] && !opt[5]))
411 break; /* reject invalid magic number */413 break; /* reject invalid magic number */
@@ -424,6 +426,11 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 12 unmodified lines
424 ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data);426 ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data);
425 427
426 kfree(out);428 kfree(out);
429 return;
430
431err_out:
432 dev->stats.rx_errors++;
433 kfree(out);
427}434}
428 435
429static int ppp_rx(struct sk_buff *skb)436static int ppp_rx(struct sk_buff *skb)
drivers/net/wan/lapbether.c+2−2
@@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 197 unmodified lines
198 struct net_device *dev;198 struct net_device *dev;
199 int size = skb->len;199 int size = skb->len;
200 200
201 skb->protocol = htons(ETH_P_X25);
202
203 ptr = skb_push(skb, 2);201 ptr = skb_push(skb, 2);
204 202
205 *ptr++ = size % 256;203 *ptr++ = size % 256;
@@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 4 unmodified lines
210 208
211 skb->dev = dev = lapbeth->ethdev;209 skb->dev = dev = lapbeth->ethdev;
212 210
211 skb->protocol = htons(ETH_P_DEC);
212
213 skb_reset_network_header(skb);213 skb_reset_network_header(skb);
214 214
215 dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);215 dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
drivers/net/wireguard/noise.c+1−4
@@ -87,15 +87,12 @@ static void handshake_zero(struct noise_handshake *handshake) · 86 unmodified lines
87 87
88void wg_noise_handshake_clear(struct noise_handshake *handshake)88void wg_noise_handshake_clear(struct noise_handshake *handshake)
89{89{
90 down_write(&handshake->lock);
90 wg_index_hashtable_remove(91 wg_index_hashtable_remove(
91 handshake->entry.peer->device->index_hashtable,92 handshake->entry.peer->device->index_hashtable,
92 &handshake->entry);93 &handshake->entry);
93 down_write(&handshake->lock);
94 handshake_zero(handshake);94 handshake_zero(handshake);
95 up_write(&handshake->lock);95 up_write(&handshake->lock);
96 wg_index_hashtable_remove(
97 handshake->entry.peer->device->index_hashtable,
98 &handshake->entry);
99}96}
100 97
101static struct noise_keypair *keypair_create(struct wg_peer *peer)98static struct noise_keypair *keypair_create(struct wg_peer *peer)
drivers/net/wireguard/peerlookup.c+8−3
@@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, · 166 unmodified lines
167 struct index_hashtable_entry *old,167 struct index_hashtable_entry *old,
168 struct index_hashtable_entry *new)168 struct index_hashtable_entry *new)
169{169{
170 if (unlikely(hlist_unhashed(&old->index_hash)))170 bool ret;
171 return false;171
172 spin_lock_bh(&table->lock);172 spin_lock_bh(&table->lock);
173 ret = !hlist_unhashed(&old->index_hash);
174 if (unlikely(!ret))
175 goto out;
176
173 new->index = old->index;177 new->index = old->index;
174 hlist_replace_rcu(&old->index_hash, &new->index_hash);178 hlist_replace_rcu(&old->index_hash, &new->index_hash);
175 179
@@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, · 4 unmodified lines
180 * simply gets dropped, which isn't terrible.184 * simply gets dropped, which isn't terrible.
181 */185 */
182 INIT_HLIST_NODE(&old->index_hash);186 INIT_HLIST_NODE(&old->index_hash);
187out:
183 spin_unlock_bh(&table->lock);188 spin_unlock_bh(&table->lock);
184 return true;189 return ret;
185}190}
186 191
187void wg_index_hashtable_remove(struct index_hashtable *table,192void wg_index_hashtable_remove(struct index_hashtable *table,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c+9−3
@@ -664,9 +664,15 @@ static void pkt_align(struct sk_buff *p, int len, int align) · 663 unmodified lines
664/* To check if there's window offered */664/* To check if there's window offered */
665static bool data_ok(struct brcmf_sdio *bus)665static bool data_ok(struct brcmf_sdio *bus)
666{666{
667 /* Reserve TXCTL_CREDITS credits for txctl */667 u8 tx_rsv = 0;
668 return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS &&668
669 ((bus->tx_max - bus->tx_seq) & 0x80) == 0;669 /* Reserve TXCTL_CREDITS credits for txctl when it is ready to send */
670 if (bus->ctrl_frame_stat)
671 tx_rsv = TXCTL_CREDITS;
672
673 return (bus->tx_max - bus->tx_seq - tx_rsv) != 0 &&
674 ((bus->tx_max - bus->tx_seq - tx_rsv) & 0x80) == 0;
675
670}676}
671 677
672/* To check if there's window offered */678/* To check if there's window offered */
drivers/net/wireless/marvell/mwifiex/fw.h+1−1
@@ -954,7 +954,7 @@ struct mwifiex_tkip_param { · 953 unmodified lines
954struct mwifiex_aes_param {954struct mwifiex_aes_param {
955 u8 pn[WPA_PN_SIZE];955 u8 pn[WPA_PN_SIZE];
956 __le16 key_len;956 __le16 key_len;
957 u8 key[WLAN_KEY_LEN_CCMP];957 u8 key[WLAN_KEY_LEN_CCMP_256];
958} __packed;958} __packed;
959 959
960struct mwifiex_wapi_param {960struct mwifiex_wapi_param {
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c+2−2
@@ -619,7 +619,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, · 618 unmodified lines
619 key_v2 = &resp->params.key_material_v2;619 key_v2 = &resp->params.key_material_v2;
620 620
621 len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len);621 len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len);
622 if (len > WLAN_KEY_LEN_CCMP)622 if (len > sizeof(key_v2->key_param_set.key_params.aes.key))
623 return -EINVAL;623 return -EINVAL;
624 624
625 if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {625 if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
@@ -635,7 +635,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, · 9 unmodified lines
635 return 0;635 return 0;
636 636
637 memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,637 memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
638 WLAN_KEY_LEN_CCMP);638 sizeof(key_v2->key_param_set.key_params.aes.key));
639 priv->aes_key_v2.key_param_set.key_params.aes.key_len =639 priv->aes_key_v2.key_param_set.key_params.aes.key_len =
640 cpu_to_le16(len);640 cpu_to_le16(len);
641 memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,641 memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c+2−1
@@ -2128,7 +2128,8 @@ static int mt7615_load_n9(struct mt7615_dev *dev, const char *name) · 2127 unmodified lines
2128 sizeof(dev->mt76.hw->wiphy->fw_version),2128 sizeof(dev->mt76.hw->wiphy->fw_version),
2129 "%.10s-%.15s", hdr->fw_ver, hdr->build_date);2129 "%.10s-%.15s", hdr->fw_ver, hdr->build_date);
2130 2130
2131 if (!strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {2131 if (!is_mt7615(&dev->mt76) &&
2132 !strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {
2132 dev->fw_ver = MT7615_FIRMWARE_V2;2133 dev->fw_ver = MT7615_FIRMWARE_V2;
2133 dev->mcu_ops = &sta_update_ops;2134 dev->mcu_ops = &sta_update_ops;
2134 } else {2135 } else {
drivers/net/wireless/mediatek/mt76/mt7915/init.c+6−2
@@ -699,8 +699,12 @@ void mt7915_unregister_device(struct mt7915_dev *dev) · 698 unmodified lines
699 spin_lock_bh(&dev->token_lock);699 spin_lock_bh(&dev->token_lock);
700 idr_for_each_entry(&dev->token, txwi, id) {700 idr_for_each_entry(&dev->token, txwi, id) {
701 mt7915_txp_skb_unmap(&dev->mt76, txwi);701 mt7915_txp_skb_unmap(&dev->mt76, txwi);
702 if (txwi->skb)702 if (txwi->skb) {
703 dev_kfree_skb_any(txwi->skb);703 struct ieee80211_hw *hw;
704
705 hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb);
706 ieee80211_free_txskb(hw, txwi->skb);
707 }
704 mt76_put_txwi(&dev->mt76, txwi);708 mt76_put_txwi(&dev->mt76, txwi);
705 }709 }
706 spin_unlock_bh(&dev->token_lock);710 spin_unlock_bh(&dev->token_lock);
drivers/net/wireless/mediatek/mt76/mt7915/mac.c+1−1
@@ -841,7 +841,7 @@ mt7915_tx_complete_status(struct mt76_dev *mdev, struct sk_buff *skb, · 840 unmodified lines
841 if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK))841 if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK))
842 mt7915_tx_status(sta, hw, info, NULL);842 mt7915_tx_status(sta, hw, info, NULL);
843 843
844 dev_kfree_skb(skb);844 ieee80211_free_txskb(hw, skb);
845}845}
846 846
847void mt7915_txp_skb_unmap(struct mt76_dev *dev,847void mt7915_txp_skb_unmap(struct mt76_dev *dev,
drivers/net/wireless/ti/wlcore/cmd.h+0−1
@@ -458,7 +458,6 @@ enum wl1271_cmd_key_type { · 457 unmodified lines
458 KEY_TKIP = 2,458 KEY_TKIP = 2,
459 KEY_AES = 3,459 KEY_AES = 3,
460 KEY_GEM = 4,460 KEY_GEM = 4,
461 KEY_IGTK = 5,
462};461};
463 462
464struct wl1271_cmd_set_keys {463struct wl1271_cmd_set_keys {
drivers/net/wireless/ti/wlcore/main.c+0−4
@@ -3559,9 +3559,6 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, · 3558 unmodified lines
3559 case WL1271_CIPHER_SUITE_GEM:3559 case WL1271_CIPHER_SUITE_GEM:
3560 key_type = KEY_GEM;3560 key_type = KEY_GEM;
3561 break;3561 break;
3562 case WLAN_CIPHER_SUITE_AES_CMAC:
3563 key_type = KEY_IGTK;
3564 break;
3565 default:3562 default:
3566 wl1271_error("Unknown key algo 0x%x", key_conf->cipher);3563 wl1271_error("Unknown key algo 0x%x", key_conf->cipher);
3567 3564
@@ -6231,7 +6228,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) · 2663 unmodified lines
6231 WLAN_CIPHER_SUITE_TKIP,6228 WLAN_CIPHER_SUITE_TKIP,
6232 WLAN_CIPHER_SUITE_CCMP,6229 WLAN_CIPHER_SUITE_CCMP,
6233 WL1271_CIPHER_SUITE_GEM,6230 WL1271_CIPHER_SUITE_GEM,
6234 WLAN_CIPHER_SUITE_AES_CMAC,
6235 };6231 };
6236 6232
6237 /* The tx descriptor buffer */6233 /* The tx descriptor buffer */
drivers/s390/net/qeth_l2_main.c+1−1
@@ -284,11 +284,11 @@ static void qeth_l2_stop_card(struct qeth_card *card) · 283 unmodified lines
284 284
285 if (card->state == CARD_STATE_SOFTSETUP) {285 if (card->state == CARD_STATE_SOFTSETUP) {
286 qeth_clear_ipacmd_list(card);286 qeth_clear_ipacmd_list(card);
287 qeth_drain_output_queues(card);
288 card->state = CARD_STATE_DOWN;287 card->state = CARD_STATE_DOWN;
289 }288 }
290 289
291 qeth_qdio_clear_card(card, 0);290 qeth_qdio_clear_card(card, 0);
291 qeth_drain_output_queues(card);
292 qeth_clear_working_pool_list(card);292 qeth_clear_working_pool_list(card);
293 flush_workqueue(card->event_wq);293 flush_workqueue(card->event_wq);
294 qeth_flush_local_addrs(card);294 qeth_flush_local_addrs(card);
drivers/s390/net/qeth_l3_main.c+1−1
@@ -1168,11 +1168,11 @@ static void qeth_l3_stop_card(struct qeth_card *card) · 1167 unmodified lines
1168 if (card->state == CARD_STATE_SOFTSETUP) {1168 if (card->state == CARD_STATE_SOFTSETUP) {
1169 qeth_l3_clear_ip_htable(card, 1);1169 qeth_l3_clear_ip_htable(card, 1);
1170 qeth_clear_ipacmd_list(card);1170 qeth_clear_ipacmd_list(card);
1171 qeth_drain_output_queues(card);
1172 card->state = CARD_STATE_DOWN;1171 card->state = CARD_STATE_DOWN;
1173 }1172 }
1174 1173
1175 qeth_qdio_clear_card(card, 0);1174 qeth_qdio_clear_card(card, 0);
1175 qeth_drain_output_queues(card);
1176 qeth_clear_working_pool_list(card);1176 qeth_clear_working_pool_list(card);
1177 flush_workqueue(card->event_wq);1177 flush_workqueue(card->event_wq);
1178 qeth_flush_local_addrs(card);1178 qeth_flush_local_addrs(card);
include/linux/netdev_features.h+1−1
@@ -193,7 +193,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) · 192 unmodified lines
193#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \193#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
194 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))194 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
195 195
196/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be196/* List of IP checksum features. Note that NETIF_F_HW_CSUM should not be
197 * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--197 * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
198 * this would be contradictory198 * this would be contradictory
199 */199 */
include/linux/netdevice.h+2−0
@@ -1784,6 +1784,7 @@ enum netdev_priv_flags { · 1783 unmodified lines
1784 * the watchdog (see dev_watchdog())1784 * the watchdog (see dev_watchdog())
1785 * @watchdog_timer: List of timers1785 * @watchdog_timer: List of timers
1786 *1786 *
1787 * @proto_down_reason: reason a netdev interface is held down
1787 * @pcpu_refcnt: Number of references to this device1788 * @pcpu_refcnt: Number of references to this device
1788 * @todo_list: Delayed register/unregister1789 * @todo_list: Delayed register/unregister
1789 * @link_watch_list: XXX: need comments on this one1790 * @link_watch_list: XXX: need comments on this one
@@ -1848,6 +1849,7 @@ enum netdev_priv_flags { · 58 unmodified lines
1848 * @udp_tunnel_nic_info: static structure describing the UDP tunnel1849 * @udp_tunnel_nic_info: static structure describing the UDP tunnel
1849 * offload capabilities of the device1850 * offload capabilities of the device
1850 * @udp_tunnel_nic: UDP tunnel offload state1851 * @udp_tunnel_nic: UDP tunnel offload state
1852 * @xdp_state: stores info on attached XDP BPF programs
1851 *1853 *
1852 * FIXME: cleanup struct net_device such that network protocol info1854 * FIXME: cleanup struct net_device such that network protocol info
1853 * moves out.1855 * moves out.
include/linux/qed/qed_if.h+1−0
@@ -623,6 +623,7 @@ struct qed_dev_info { · 622 unmodified lines
623#define QED_MFW_VERSION_3_OFFSET 24623#define QED_MFW_VERSION_3_OFFSET 24
624 624
625 u32 flash_size;625 u32 flash_size;
626 bool b_arfs_capable;
626 bool b_inter_pf_switch;627 bool b_inter_pf_switch;
627 bool tx_switching;628 bool tx_switching;
628 bool rdma_supported;629 bool rdma_supported;
include/linux/skbuff.h+4−3
@@ -3223,8 +3223,9 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len) · 3222 unmodified lines
3223 * is untouched. Otherwise it is extended. Returns zero on3223 * is untouched. Otherwise it is extended. Returns zero on
3224 * success. The skb is freed on error if @free_on_error is true.3224 * success. The skb is freed on error if @free_on_error is true.
3225 */3225 */
3226static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,3226static inline int __must_check __skb_put_padto(struct sk_buff *skb,
3227 bool free_on_error)3227 unsigned int len,
3228 bool free_on_error)
3228{3229{
3229 unsigned int size = skb->len;3230 unsigned int size = skb->len;
3230 3231
@@ -3247,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len, · 16 unmodified lines
3247 * is untouched. Otherwise it is extended. Returns zero on3248 * is untouched. Otherwise it is extended. Returns zero on
3248 * success. The skb is freed on error.3249 * success. The skb is freed on error.
3249 */3250 */
3250static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)3251static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len)
3251{3252{
3252 return __skb_put_padto(skb, len, true);3253 return __skb_put_padto(skb, len, true);
3253}3254}
include/net/flow.h+1−0
@@ -116,6 +116,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, · 115 unmodified lines
116 fl4->saddr = saddr;116 fl4->saddr = saddr;
117 fl4->fl4_dport = dport;117 fl4->fl4_dport = dport;
118 fl4->fl4_sport = sport;118 fl4->fl4_sport = sport;
119 fl4->flowi4_multipath_hash = 0;
119}120}
120 121
121/* Reset some input parameters after previous lookup */122/* Reset some input parameters after previous lookup */
include/net/netlink.h+0−2
@@ -726,7 +726,6 @@ static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, · 725 unmodified lines
726 * @hdrlen: length of family specific header726 * @hdrlen: length of family specific header
727 * @tb: destination array with maxtype+1 elements727 * @tb: destination array with maxtype+1 elements
728 * @maxtype: maximum attribute type to be expected728 * @maxtype: maximum attribute type to be expected
729 * @validate: validation strictness
730 * @extack: extended ACK report struct729 * @extack: extended ACK report struct
731 *730 *
732 * See nla_parse()731 * See nla_parse()
@@ -824,7 +823,6 @@ static inline int nla_validate_deprecated(const struct nlattr *head, int len, · 91 unmodified lines
824 * @len: length of attribute stream823 * @len: length of attribute stream
825 * @maxtype: maximum attribute type to be expected824 * @maxtype: maximum attribute type to be expected
826 * @policy: validation policy825 * @policy: validation policy
827 * @validate: validation strictness
828 * @extack: extended ACK report struct826 * @extack: extended ACK report struct
829 *827 *
830 * Validates all attributes in the specified attribute stream against the828 * Validates all attributes in the specified attribute stream against the
include/net/netns/nftables.h+1−0
@@ -8,6 +8,7 @@ struct netns_nftables { · 7 unmodified lines
8 struct list_head tables;8 struct list_head tables;
9 struct list_head commit_list;9 struct list_head commit_list;
10 struct list_head module_list;10 struct list_head module_list;
11 struct list_head notify_list;
11 struct mutex commit_mutex;12 struct mutex commit_mutex;
12 unsigned int base_seq;13 unsigned int base_seq;
13 u8 gencursor;14 u8 gencursor;
include/net/sctp/structs.h+5−3
@@ -226,12 +226,14 @@ struct sctp_sock { · 225 unmodified lines
226 data_ready_signalled:1;226 data_ready_signalled:1;
227 227
228 atomic_t pd_mode;228 atomic_t pd_mode;
229
230 /* Fields after this point will be skipped on copies, like on accept
231 * and peeloff operations
232 */
233
229 /* Receive to here while partial delivery is in effect. */234 /* Receive to here while partial delivery is in effect. */
230 struct sk_buff_head pd_lobby;235 struct sk_buff_head pd_lobby;
231 236
232 /* These must be the last fields, as they will skipped on copies,
233 * like on accept and peeloff operations
234 */
235 struct list_head auto_asconf_list;237 struct list_head auto_asconf_list;
236 int do_auto_asconf;238 int do_auto_asconf;
237};239};
include/net/vxlan.h+3−0
@@ -121,6 +121,9 @@ struct vxlanhdr_gbp { · 120 unmodified lines
121#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)121#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
122#define VXLAN_GBP_ID_MASK (0xFFFF)122#define VXLAN_GBP_ID_MASK (0xFFFF)
123 123
124#define VXLAN_GBP_MASK (VXLAN_GBP_DONT_LEARN | VXLAN_GBP_POLICY_APPLIED | \
125 VXLAN_GBP_ID_MASK)
126
124/*127/*
125 * VXLAN Generic Protocol Extension (VXLAN_F_GPE):128 * VXLAN Generic Protocol Extension (VXLAN_F_GPE):
126 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+129 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
include/soc/mscc/ocelot.h+2−0
@@ -566,6 +566,7 @@ struct ocelot_port { · 565 unmodified lines
566 u8 ptp_cmd;566 u8 ptp_cmd;
567 struct sk_buff_head tx_skbs;567 struct sk_buff_head tx_skbs;
568 u8 ts_id;568 u8 ts_id;
569 spinlock_t ts_id_lock;
569 570
570 phy_interface_t phy_mode;571 phy_interface_t phy_mode;
571 572
@@ -677,6 +678,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, · 105 unmodified lines
677int ocelot_init(struct ocelot *ocelot);678int ocelot_init(struct ocelot *ocelot);
678void ocelot_deinit(struct ocelot *ocelot);679void ocelot_deinit(struct ocelot *ocelot);
679void ocelot_init_port(struct ocelot *ocelot, int port);680void ocelot_init_port(struct ocelot *ocelot, int port);
681void ocelot_deinit_port(struct ocelot *ocelot, int port);
680 682
681/* DSA callbacks */683/* DSA callbacks */
682void ocelot_port_enable(struct ocelot *ocelot, int port,684void ocelot_port_enable(struct ocelot *ocelot, int port,
include/uapi/linux/ethtool_netlink.h+1−0
@@ -79,6 +79,7 @@ enum { · 78 unmodified lines
79 ETHTOOL_MSG_TSINFO_GET_REPLY,79 ETHTOOL_MSG_TSINFO_GET_REPLY,
80 ETHTOOL_MSG_CABLE_TEST_NTF,80 ETHTOOL_MSG_CABLE_TEST_NTF,
81 ETHTOOL_MSG_CABLE_TEST_TDR_NTF,81 ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
82 ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
82 83
83 /* add new constants above here */84 /* add new constants above here */
84 __ETHTOOL_MSG_KERNEL_CNT,85 __ETHTOOL_MSG_KERNEL_CNT,
kernel/bpf/hashtab.c+4−11
@@ -1622,7 +1622,6 @@ struct bpf_iter_seq_hash_map_info { · 1621 unmodified lines
1622 struct bpf_map *map;1622 struct bpf_map *map;
1623 struct bpf_htab *htab;1623 struct bpf_htab *htab;
1624 void *percpu_value_buf; // non-zero means percpu hash1624 void *percpu_value_buf; // non-zero means percpu hash
1625 unsigned long flags;
1626 u32 bucket_id;1625 u32 bucket_id;
1627 u32 skip_elems;1626 u32 skip_elems;
1628};1627};
@@ -1632,7 +1631,6 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 3 unmodified lines
1632 struct htab_elem *prev_elem)1631 struct htab_elem *prev_elem)
1633{1632{
1634 const struct bpf_htab *htab = info->htab;1633 const struct bpf_htab *htab = info->htab;
1635 unsigned long flags = info->flags;
1636 u32 skip_elems = info->skip_elems;1634 u32 skip_elems = info->skip_elems;
1637 u32 bucket_id = info->bucket_id;1635 u32 bucket_id = info->bucket_id;
1638 struct hlist_nulls_head *head;1636 struct hlist_nulls_head *head;
@@ -1656,19 +1654,18 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 17 unmodified lines
1656 1654
1657 /* not found, unlock and go to the next bucket */1655 /* not found, unlock and go to the next bucket */
1658 b = &htab->buckets[bucket_id++];1656 b = &htab->buckets[bucket_id++];
1659 htab_unlock_bucket(htab, b, flags);1657 rcu_read_unlock();
1660 skip_elems = 0;1658 skip_elems = 0;
1661 }1659 }
1662 1660
1663 for (i = bucket_id; i < htab->n_buckets; i++) {1661 for (i = bucket_id; i < htab->n_buckets; i++) {
1664 b = &htab->buckets[i];1662 b = &htab->buckets[i];
1665 flags = htab_lock_bucket(htab, b);1663 rcu_read_lock();
1666 1664
1667 count = 0;1665 count = 0;
1668 head = &b->head;1666 head = &b->head;
1669 hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) {1667 hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) {
1670 if (count >= skip_elems) {1668 if (count >= skip_elems) {
1671 info->flags = flags;
1672 info->bucket_id = i;1669 info->bucket_id = i;
1673 info->skip_elems = count;1670 info->skip_elems = count;
1674 return elem;1671 return elem;
@@ -1676,7 +1673,7 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 1 unmodified line
1676 count++;1673 count++;
1677 }1674 }
1678 1675
1679 htab_unlock_bucket(htab, b, flags);1676 rcu_read_unlock();
1680 skip_elems = 0;1677 skip_elems = 0;
1681 }1678 }
1682 1679
@@ -1754,14 +1751,10 @@ static int bpf_hash_map_seq_show(struct seq_file *seq, void *v) · 71 unmodified lines
1754 1751
1755static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v)1752static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v)
1756{1753{
1757 struct bpf_iter_seq_hash_map_info *info = seq->private;
1758
1759 if (!v)1754 if (!v)
1760 (void)__bpf_hash_map_seq_show(seq, NULL);1755 (void)__bpf_hash_map_seq_show(seq, NULL);
1761 else1756 else
1762 htab_unlock_bucket(info->htab,1757 rcu_read_unlock();
1763 &info->htab->buckets[info->bucket_id],
1764 info->flags);
1765}1758}
1766 1759
1767static int bpf_iter_init_hash_map(void *priv_data,1760static int bpf_iter_init_hash_map(void *priv_data,
kernel/bpf/inode.c+3−1
@@ -226,10 +226,12 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos) · 225 unmodified lines
226 else226 else
227 prev_key = key;227 prev_key = key;
228 228
229 rcu_read_lock();
229 if (map->ops->map_get_next_key(map, prev_key, key)) {230 if (map->ops->map_get_next_key(map, prev_key, key)) {
230 map_iter(m)->done = true;231 map_iter(m)->done = true;
231 return NULL;232 key = NULL;
232 }233 }
234 rcu_read_unlock();
233 return key;235 return key;
234}236}
235 237
lib/test_rhashtable.c+1−1
@@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries) · 433 unmodified lines
434 } else {434 } else {
435 if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d",435 if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d",
436 err, -ENOENT))436 err, -ENOENT))
437 continue;437 continue;
438 }438 }
439 }439 }
440 440
net/batman-adv/bridge_loop_avoidance.c+117−28
@@ -25,6 +25,7 @@ · 24 unmodified lines
25#include <linux/lockdep.h>25#include <linux/lockdep.h>
26#include <linux/netdevice.h>26#include <linux/netdevice.h>
27#include <linux/netlink.h>27#include <linux/netlink.h>
28#include <linux/preempt.h>
28#include <linux/rculist.h>29#include <linux/rculist.h>
29#include <linux/rcupdate.h>30#include <linux/rcupdate.h>
30#include <linux/seq_file.h>31#include <linux/seq_file.h>
@@ -83,11 +84,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) · 52 unmodified lines
83 */84 */
84static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)85static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
85{86{
86 const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;87 const struct batadv_bla_backbone_gw *gw;
87 u32 hash = 0;88 u32 hash = 0;
88 89
89 hash = jhash(&claim->addr, sizeof(claim->addr), hash);90 gw = (struct batadv_bla_backbone_gw *)data;
90 hash = jhash(&claim->vid, sizeof(claim->vid), hash);91 hash = jhash(&gw->orig, sizeof(gw->orig), hash);
92 hash = jhash(&gw->vid, sizeof(gw->vid), hash);
91 93
92 return hash % size;94 return hash % size;
93}95}
@@ -1579,13 +1581,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv) · 1485 unmodified lines
1579}1581}
1580 1582
1581/**1583/**
1582 * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.1584 * batadv_bla_check_duplist() - Check if a frame is in the broadcast dup.
1583 * @bat_priv: the bat priv with all the soft interface information1585 * @bat_priv: the bat priv with all the soft interface information
1584 * @skb: contains the bcast_packet to be checked1586 * @skb: contains the multicast packet to be checked
1587 * @payload_ptr: pointer to position inside the head buffer of the skb
1588 * marking the start of the data to be CRC'ed
1589 * @orig: originator mac address, NULL if unknown
1585 *1590 *
1586 * check if it is on our broadcast list. Another gateway might1591 * Check if it is on our broadcast list. Another gateway might have sent the
1587 * have sent the same packet because it is connected to the same backbone,1592 * same packet because it is connected to the same backbone, so we have to
1588 * so we have to remove this duplicate.1593 * remove this duplicate.
1589 *1594 *
1590 * This is performed by checking the CRC, which will tell us1595 * This is performed by checking the CRC, which will tell us
1591 * with a good chance that it is the same packet. If it is furthermore1596 * with a good chance that it is the same packet. If it is furthermore
@@ -1594,19 +1599,17 @@ int batadv_bla_init(struct batadv_priv *bat_priv) · 2 unmodified lines
1594 *1599 *
1595 * Return: true if a packet is in the duplicate list, false otherwise.1600 * Return: true if a packet is in the duplicate list, false otherwise.
1596 */1601 */
1597bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,1602static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv,
1598 struct sk_buff *skb)1603 struct sk_buff *skb, u8 *payload_ptr,
1604 const u8 *orig)
1599{1605{
1600 int i, curr;
1601 __be32 crc;
1602 struct batadv_bcast_packet *bcast_packet;
1603 struct batadv_bcast_duplist_entry *entry;1606 struct batadv_bcast_duplist_entry *entry;
1604 bool ret = false;1607 bool ret = false;
1605 1608 int i, curr;
1606 bcast_packet = (struct batadv_bcast_packet *)skb->data;1609 __be32 crc;
1607 1610
1608 /* calculate the crc ... */1611 /* calculate the crc ... */
1609 crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1));1612 crc = batadv_skb_crc32(skb, payload_ptr);
1610 1613
1611 spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);1614 spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);
1612 1615
@@ -1625,8 +1628,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, · 12 unmodified lines
1625 if (entry->crc != crc)1628 if (entry->crc != crc)
1626 continue;1629 continue;
1627 1630
1628 if (batadv_compare_eth(entry->orig, bcast_packet->orig))1631 /* are the originators both known and not anonymous? */
1629 continue;1632 if (orig && !is_zero_ether_addr(orig) &&
1633 !is_zero_ether_addr(entry->orig)) {
1634 /* If known, check if the new frame came from
1635 * the same originator:
1636 * We are safe to take identical frames from the
1637 * same orig, if known, as multiplications in
1638 * the mesh are detected via the (orig, seqno) pair.
1639 * So we can be a bit more liberal here and allow
1640 * identical frames from the same orig which the source
1641 * host might have sent multiple times on purpose.
1642 */
1643 if (batadv_compare_eth(entry->orig, orig))
1644 continue;
1645 }
1630 1646
1631 /* this entry seems to match: same crc, not too old,1647 /* this entry seems to match: same crc, not too old,
1632 * and from another gw. therefore return true to forbid it.1648 * and from another gw. therefore return true to forbid it.
@@ -1642,7 +1658,14 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, · 9 unmodified lines
1642 entry = &bat_priv->bla.bcast_duplist[curr];1658 entry = &bat_priv->bla.bcast_duplist[curr];
1643 entry->crc = crc;1659 entry->crc = crc;
1644 entry->entrytime = jiffies;1660 entry->entrytime = jiffies;
1645 ether_addr_copy(entry->orig, bcast_packet->orig);1661
1662 /* known originator */
1663 if (orig)
1664 ether_addr_copy(entry->orig, orig);
1665 /* anonymous originator */
1666 else
1667 eth_zero_addr(entry->orig);
1668
1646 bat_priv->bla.bcast_duplist_curr = curr;1669 bat_priv->bla.bcast_duplist_curr = curr;
1647 1670
1648out:1671out:
@@ -1651,6 +1674,48 @@ out: · 2 unmodified lines
1651 return ret;1674 return ret;
1652}1675}
1653 1676
1677/**
1678 * batadv_bla_check_ucast_duplist() - Check if a frame is in the broadcast dup.
1679 * @bat_priv: the bat priv with all the soft interface information
1680 * @skb: contains the multicast packet to be checked, decapsulated from a
1681 * unicast_packet
1682 *
1683 * Check if it is on our broadcast list. Another gateway might have sent the
1684 * same packet because it is connected to the same backbone, so we have to
1685 * remove this duplicate.
1686 *
1687 * Return: true if a packet is in the duplicate list, false otherwise.
1688 */
1689static bool batadv_bla_check_ucast_duplist(struct batadv_priv *bat_priv,
1690 struct sk_buff *skb)
1691{
1692 return batadv_bla_check_duplist(bat_priv, skb, (u8 *)skb->data, NULL);
1693}
1694
1695/**
1696 * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
1697 * @bat_priv: the bat priv with all the soft interface information
1698 * @skb: contains the bcast_packet to be checked
1699 *
1700 * Check if it is on our broadcast list. Another gateway might have sent the
1701 * same packet because it is connected to the same backbone, so we have to
1702 * remove this duplicate.
1703 *
1704 * Return: true if a packet is in the duplicate list, false otherwise.
1705 */
1706bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
1707 struct sk_buff *skb)
1708{
1709 struct batadv_bcast_packet *bcast_packet;
1710 u8 *payload_ptr;
1711
1712 bcast_packet = (struct batadv_bcast_packet *)skb->data;
1713 payload_ptr = (u8 *)(bcast_packet + 1);
1714
1715 return batadv_bla_check_duplist(bat_priv, skb, payload_ptr,
1716 bcast_packet->orig);
1717}
1718
1654/**1719/**
1655 * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for1720 * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for
1656 * the VLAN identified by vid.1721 * the VLAN identified by vid.
@@ -1812,7 +1877,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, · 155 unmodified lines
1812 * @bat_priv: the bat priv with all the soft interface information1877 * @bat_priv: the bat priv with all the soft interface information
1813 * @skb: the frame to be checked1878 * @skb: the frame to be checked
1814 * @vid: the VLAN ID of the frame1879 * @vid: the VLAN ID of the frame
1815 * @is_bcast: the packet came in a broadcast packet type.1880 * @packet_type: the batman packet type this frame came in
1816 *1881 *
1817 * batadv_bla_rx avoidance checks if:1882 * batadv_bla_rx avoidance checks if:
1818 * * we have to race for a claim1883 * * we have to race for a claim
@@ -1824,7 +1889,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, · 5 unmodified lines
1824 * further process the skb.1889 * further process the skb.
1825 */1890 */
1826bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,1891bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
1827 unsigned short vid, bool is_bcast)1892 unsigned short vid, int packet_type)
1828{1893{
1829 struct batadv_bla_backbone_gw *backbone_gw;1894 struct batadv_bla_backbone_gw *backbone_gw;
1830 struct ethhdr *ethhdr;1895 struct ethhdr *ethhdr;
@@ -1846,9 +1911,32 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 15 unmodified lines
1846 goto handled;1911 goto handled;
1847 1912
1848 if (unlikely(atomic_read(&bat_priv->bla.num_requests)))1913 if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
1849 /* don't allow broadcasts while requests are in flight */1914 /* don't allow multicast packets while requests are in flight */
1850 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)1915 if (is_multicast_ether_addr(ethhdr->h_dest))
1851 goto handled;1916 /* Both broadcast flooding or multicast-via-unicasts
1917 * delivery might send to multiple backbone gateways
1918 * sharing the same LAN and therefore need to coordinate
1919 * which backbone gateway forwards into the LAN,
1920 * by claiming the payload source address.
1921 *
1922 * Broadcast flooding and multicast-via-unicasts
1923 * delivery use the following two batman packet types.
1924 * Note: explicitly exclude BATADV_UNICAST_4ADDR,
1925 * as the DHCP gateway feature will send explicitly
1926 * to only one BLA gateway, so the claiming process
1927 * should be avoided there.
1928 */
1929 if (packet_type == BATADV_BCAST ||
1930 packet_type == BATADV_UNICAST)
1931 goto handled;
1932
1933 /* potential duplicates from foreign BLA backbone gateways via
1934 * multicast-in-unicast packets
1935 */
1936 if (is_multicast_ether_addr(ethhdr->h_dest) &&
1937 packet_type == BATADV_UNICAST &&
1938 batadv_bla_check_ucast_duplist(bat_priv, skb))
1939 goto handled;
1852 1940
1853 ether_addr_copy(search_claim.addr, ethhdr->h_source);1941 ether_addr_copy(search_claim.addr, ethhdr->h_source);
1854 search_claim.vid = vid;1942 search_claim.vid = vid;
@@ -1883,13 +1971,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 28 unmodified lines
1883 goto allow;1971 goto allow;
1884 }1972 }
1885 1973
1886 /* if it is a broadcast ... */1974 /* if it is a multicast ... */
1887 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {1975 if (is_multicast_ether_addr(ethhdr->h_dest) &&
1976 (packet_type == BATADV_BCAST || packet_type == BATADV_UNICAST)) {
1888 /* ... drop it. the responsible gateway is in charge.1977 /* ... drop it. the responsible gateway is in charge.
1889 *1978 *
1890 * We need to check is_bcast because with the gateway1979 * We need to check packet type because with the gateway
1891 * feature, broadcasts (like DHCP requests) may be sent1980 * feature, broadcasts (like DHCP requests) may be sent
1892 * using a unicast packet type.1981 * using a unicast 4 address packet type. See comment above.
1893 */1982 */
1894 goto handled;1983 goto handled;
1895 } else {1984 } else {
net/batman-adv/bridge_loop_avoidance.h+2−2
@@ -35,7 +35,7 @@ static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac) · 34 unmodified lines
35 35
36#ifdef CONFIG_BATMAN_ADV_BLA36#ifdef CONFIG_BATMAN_ADV_BLA
37bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,37bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
38 unsigned short vid, bool is_bcast);38 unsigned short vid, int packet_type);
39bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,39bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
40 unsigned short vid);40 unsigned short vid);
41bool batadv_bla_is_backbone_gw(struct sk_buff *skb,41bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
@@ -66,7 +66,7 @@ bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr, · 24 unmodified lines
66 66
67static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,67static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
68 struct sk_buff *skb, unsigned short vid,68 struct sk_buff *skb, unsigned short vid,
69 bool is_bcast)69 int packet_type)
70{70{
71 return false;71 return false;
72}72}
net/batman-adv/multicast.c+36−10
@@ -51,6 +51,7 @@ · 50 unmodified lines
51#include <uapi/linux/batadv_packet.h>51#include <uapi/linux/batadv_packet.h>
52#include <uapi/linux/batman_adv.h>52#include <uapi/linux/batman_adv.h>
53 53
54#include "bridge_loop_avoidance.h"
54#include "hard-interface.h"55#include "hard-interface.h"
55#include "hash.h"56#include "hash.h"
56#include "log.h"57#include "log.h"
@@ -1434,6 +1435,35 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 1377 unmodified lines
1434 return BATADV_FORW_ALL;1435 return BATADV_FORW_ALL;
1435}1436}
1436 1437
1438/**
1439 * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
1440 * @bat_priv: the bat priv with all the soft interface information
1441 * @skb: the multicast packet to send
1442 * @vid: the vlan identifier
1443 * @orig_node: the originator to send the packet to
1444 *
1445 * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
1446 */
1447int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
1448 struct sk_buff *skb,
1449 unsigned short vid,
1450 struct batadv_orig_node *orig_node)
1451{
1452 /* Avoid sending multicast-in-unicast packets to other BLA
1453 * gateways - they already got the frame from the LAN side
1454 * we share with them.
1455 * TODO: Refactor to take BLA into account earlier, to avoid
1456 * reducing the mcast_fanout count.
1457 */
1458 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) {
1459 dev_kfree_skb(skb);
1460 return NET_XMIT_SUCCESS;
1461 }
1462
1463 return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
1464 orig_node, vid);
1465}
1466
1437/**1467/**
1438 * batadv_mcast_forw_tt() - forwards a packet to multicast listeners1468 * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
1439 * @bat_priv: the bat priv with all the soft interface information1469 * @bat_priv: the bat priv with all the soft interface information
@@ -1471,8 +1501,8 @@ batadv_mcast_forw_tt(struct batadv_priv *bat_priv, struct sk_buff *skb, · 31 unmodified lines
1471 break;1501 break;
1472 }1502 }
1473 1503
1474 batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,1504 batadv_mcast_forw_send_orig(bat_priv, newskb, vid,
1475 orig_entry->orig_node, vid);1505 orig_entry->orig_node);
1476 }1506 }
1477 rcu_read_unlock();1507 rcu_read_unlock();
1478 1508
@@ -1513,8 +1543,7 @@ batadv_mcast_forw_want_all_ipv4(struct batadv_priv *bat_priv, · 34 unmodified lines
1513 break;1543 break;
1514 }1544 }
1515 1545
1516 batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,1546 batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
1517 orig_node, vid);
1518 }1547 }
1519 rcu_read_unlock();1548 rcu_read_unlock();
1520 return ret;1549 return ret;
@@ -1551,8 +1580,7 @@ batadv_mcast_forw_want_all_ipv6(struct batadv_priv *bat_priv, · 30 unmodified lines
1551 break;1580 break;
1552 }1581 }
1553 1582
1554 batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,1583 batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
1555 orig_node, vid);
1556 }1584 }
1557 rcu_read_unlock();1585 rcu_read_unlock();
1558 return ret;1586 return ret;
@@ -1618,8 +1646,7 @@ batadv_mcast_forw_want_all_rtr4(struct batadv_priv *bat_priv, · 59 unmodified lines
1618 break;1646 break;
1619 }1647 }
1620 1648
1621 batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,1649 batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
1622 orig_node, vid);
1623 }1650 }
1624 rcu_read_unlock();1651 rcu_read_unlock();
1625 return ret;1652 return ret;
@@ -1656,8 +1683,7 @@ batadv_mcast_forw_want_all_rtr6(struct batadv_priv *bat_priv, · 30 unmodified lines
1656 break;1683 break;
1657 }1684 }
1658 1685
1659 batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,1686 batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
1660 orig_node, vid);
1661 }1687 }
1662 rcu_read_unlock();1688 rcu_read_unlock();
1663 return ret;1689 return ret;
net/batman-adv/multicast.h+15−0
@@ -46,6 +46,11 @@ enum batadv_forw_mode · 45 unmodified lines
46batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,46batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
47 struct batadv_orig_node **mcast_single_orig);47 struct batadv_orig_node **mcast_single_orig);
48 48
49int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
50 struct sk_buff *skb,
51 unsigned short vid,
52 struct batadv_orig_node *orig_node);
53
49int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,54int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
50 unsigned short vid);55 unsigned short vid);
51 56
@@ -71,6 +76,16 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 19 unmodified lines
71 return BATADV_FORW_ALL;76 return BATADV_FORW_ALL;
72}77}
73 78
79static inline int
80batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
81 struct sk_buff *skb,
82 unsigned short vid,
83 struct batadv_orig_node *orig_node)
84{
85 kfree_skb(skb);
86 return NET_XMIT_DROP;
87}
88
74static inline int89static inline int
75batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,90batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
76 unsigned short vid)91 unsigned short vid)
net/batman-adv/routing.c+4−0
@@ -826,6 +826,10 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, · 825 unmodified lines
826 vid = batadv_get_vid(skb, hdr_len);826 vid = batadv_get_vid(skb, hdr_len);
827 ethhdr = (struct ethhdr *)(skb->data + hdr_len);827 ethhdr = (struct ethhdr *)(skb->data + hdr_len);
828 828
829 /* do not reroute multicast frames in a unicast header */
830 if (is_multicast_ether_addr(ethhdr->h_dest))
831 return true;
832
829 /* check if the destination client was served by this node and it is now833 /* check if the destination client was served by this node and it is now
830 * roaming. In this case, it means that the node has got a ROAM_ADV834 * roaming. In this case, it means that the node has got a ROAM_ADV
831 * message and that it knows the new destination in the mesh to re-route835 * message and that it knows the new destination in the mesh to re-route
net/batman-adv/soft-interface.c+5−6
@@ -364,9 +364,8 @@ send: · 363 unmodified lines
364 goto dropped;364 goto dropped;
365 ret = batadv_send_skb_via_gw(bat_priv, skb, vid);365 ret = batadv_send_skb_via_gw(bat_priv, skb, vid);
366 } else if (mcast_single_orig) {366 } else if (mcast_single_orig) {
367 ret = batadv_send_skb_unicast(bat_priv, skb,367 ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
368 BATADV_UNICAST, 0,368 mcast_single_orig);
369 mcast_single_orig, vid);
370 } else if (forw_mode == BATADV_FORW_SOME) {369 } else if (forw_mode == BATADV_FORW_SOME) {
371 ret = batadv_mcast_forw_send(bat_priv, skb, vid);370 ret = batadv_mcast_forw_send(bat_priv, skb, vid);
372 } else {371 } else {
@@ -425,10 +424,10 @@ void batadv_interface_rx(struct net_device *soft_iface, · 52 unmodified lines
425 struct vlan_ethhdr *vhdr;424 struct vlan_ethhdr *vhdr;
426 struct ethhdr *ethhdr;425 struct ethhdr *ethhdr;
427 unsigned short vid;426 unsigned short vid;
428 bool is_bcast;427 int packet_type;
429 428
430 batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;429 batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;
431 is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST);430 packet_type = batadv_bcast_packet->packet_type;
432 431
433 skb_pull_rcsum(skb, hdr_size);432 skb_pull_rcsum(skb, hdr_size);
434 skb_reset_mac_header(skb);433 skb_reset_mac_header(skb);
@@ -471,7 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 36 unmodified lines
471 /* Let the bridge loop avoidance check the packet. If will470 /* Let the bridge loop avoidance check the packet. If will
472 * not handle it, we can safely push it up.471 * not handle it, we can safely push it up.
473 */472 */
474 if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))473 if (batadv_bla_rx(bat_priv, skb, vid, packet_type))
475 goto out;474 goto out;
476 475
477 if (orig_node)476 if (orig_node)
net/bridge/br_vlan.c+17−10
@@ -1288,11 +1288,13 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v, · 1287 unmodified lines
1288 }1288 }
1289}1289}
1290 1290
1291static int __br_vlan_get_pvid(const struct net_device *dev,1291int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
1292 struct net_bridge_port *p, u16 *p_pvid)
1293{1292{
1294 struct net_bridge_vlan_group *vg;1293 struct net_bridge_vlan_group *vg;
1294 struct net_bridge_port *p;
1295 1295
1296 ASSERT_RTNL();
1297 p = br_port_get_check_rtnl(dev);
1296 if (p)1298 if (p)
1297 vg = nbp_vlan_group(p);1299 vg = nbp_vlan_group(p);
1298 else if (netif_is_bridge_master(dev))1300 else if (netif_is_bridge_master(dev))
@@ -1303,18 +1305,23 @@ static int __br_vlan_get_pvid(const struct net_device *dev, · 4 unmodified lines
1303 *p_pvid = br_get_pvid(vg);1305 *p_pvid = br_get_pvid(vg);
1304 return 0;1306 return 0;
1305}1307}
1306
1307int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
1308{
1309 ASSERT_RTNL();
1310
1311 return __br_vlan_get_pvid(dev, br_port_get_check_rtnl(dev), p_pvid);
1312}
1313EXPORT_SYMBOL_GPL(br_vlan_get_pvid);1308EXPORT_SYMBOL_GPL(br_vlan_get_pvid);
1314 1309
1315int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)1310int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
1316{1311{
1317 return __br_vlan_get_pvid(dev, br_port_get_check_rcu(dev), p_pvid);1312 struct net_bridge_vlan_group *vg;
1313 struct net_bridge_port *p;
1314
1315 p = br_port_get_check_rcu(dev);
1316 if (p)
1317 vg = nbp_vlan_group_rcu(p);
1318 else if (netif_is_bridge_master(dev))
1319 vg = br_vlan_group_rcu(netdev_priv(dev));
1320 else
1321 return -EINVAL;
1322
1323 *p_pvid = br_get_pvid(vg);
1324 return 0;
1318}1325}
1319EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu);1326EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu);
1320 1327
net/core/dev.c+1−1
@@ -8647,7 +8647,7 @@ int dev_get_port_parent_id(struct net_device *dev, · 8646 unmodified lines
8647 if (!first.id_len)8647 if (!first.id_len)
8648 first = *ppid;8648 first = *ppid;
8649 else if (memcmp(&first, ppid, sizeof(*ppid)))8649 else if (memcmp(&first, ppid, sizeof(*ppid)))
8650 return -ENODATA;8650 return -EOPNOTSUPP;
8651 }8651 }
8652 8652
8653 return err;8653 return err;
net/core/dst.c+1−1
@@ -144,7 +144,7 @@ static void dst_destroy_rcu(struct rcu_head *head) · 143 unmodified lines
144 144
145/* Operations to mark dst as DEAD and clean up the net device referenced145/* Operations to mark dst as DEAD and clean up the net device referenced
146 * by dst:146 * by dst:
147 * 1. put the dst under loopback interface and discard all tx/rx packets147 * 1. put the dst under blackhole interface and discard all tx/rx packets
148 * on this route.148 * on this route.
149 * 2. release the net_device149 * 2. release the net_device
150 * This function should be called when removing routes from the fib tree150 * This function should be called when removing routes from the fib tree
net/core/fib_rules.c+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
16#include <net/ip_tunnels.h>16#include <net/ip_tunnels.h>
17#include <linux/indirect_call_wrapper.h>17#include <linux/indirect_call_wrapper.h>
18 18
19#ifdef CONFIG_IPV6_MULTIPLE_TABLES19#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES)
20#ifdef CONFIG_IP_MULTIPLE_TABLES20#ifdef CONFIG_IP_MULTIPLE_TABLES
21#define INDIRECT_CALL_MT(f, f2, f1, ...) \21#define INDIRECT_CALL_MT(f, f2, f1, ...) \
22 INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__)22 INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__)
net/core/filter.c+10−9
@@ -4838,6 +4838,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params, · 4837 unmodified lines
4838 fl4.saddr = params->ipv4_src;4838 fl4.saddr = params->ipv4_src;
4839 fl4.fl4_sport = params->sport;4839 fl4.fl4_sport = params->sport;
4840 fl4.fl4_dport = params->dport;4840 fl4.fl4_dport = params->dport;
4841 fl4.flowi4_multipath_hash = 0;
4841 4842
4842 if (flags & BPF_FIB_LOOKUP_DIRECT) {4843 if (flags & BPF_FIB_LOOKUP_DIRECT) {
4843 u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN;4844 u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN;
@@ -7065,8 +7066,6 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig, · 2221 unmodified lines
7065 bool indirect = BPF_MODE(orig->code) == BPF_IND;7066 bool indirect = BPF_MODE(orig->code) == BPF_IND;
7066 struct bpf_insn *insn = insn_buf;7067 struct bpf_insn *insn = insn_buf;
7067 7068
7068 /* We're guaranteed here that CTX is in R6. */
7069 *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
7070 if (!indirect) {7069 if (!indirect) {
7071 *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm);7070 *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm);
7072 } else {7071 } else {
@@ -7074,6 +7073,8 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig, · 1 unmodified line
7074 if (orig->imm)7073 if (orig->imm)
7075 *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm);7074 *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm);
7076 }7075 }
7076 /* We're guaranteed here that CTX is in R6. */
7077 *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
7077 7078
7078 switch (BPF_SIZE(orig->code)) {7079 switch (BPF_SIZE(orig->code)) {
7079 case BPF_B:7080 case BPF_B:
@@ -9522,7 +9523,7 @@ BPF_CALL_1(bpf_skc_to_tcp6_sock, struct sock *, sk) · 2442 unmodified lines
9522 * trigger an explicit type generation here.9523 * trigger an explicit type generation here.
9523 */9524 */
9524 BTF_TYPE_EMIT(struct tcp6_sock);9525 BTF_TYPE_EMIT(struct tcp6_sock);
9525 if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&9526 if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&
9526 sk->sk_family == AF_INET6)9527 sk->sk_family == AF_INET6)
9527 return (unsigned long)sk;9528 return (unsigned long)sk;
9528 9529
@@ -9540,7 +9541,7 @@ const struct bpf_func_proto bpf_skc_to_tcp6_sock_proto = { · 11 unmodified lines
9540 9541
9541BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk)9542BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk)
9542{9543{
9543 if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)9544 if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
9544 return (unsigned long)sk;9545 return (unsigned long)sk;
9545 9546
9546 return (unsigned long)NULL;9547 return (unsigned long)NULL;
@@ -9558,12 +9559,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_sock_proto = { · 11 unmodified lines
9558BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)9559BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)
9559{9560{
9560#ifdef CONFIG_INET9561#ifdef CONFIG_INET
9561 if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)9562 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
9562 return (unsigned long)sk;9563 return (unsigned long)sk;
9563#endif9564#endif
9564 9565
9565#if IS_BUILTIN(CONFIG_IPV6)9566#if IS_BUILTIN(CONFIG_IPV6)
9566 if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)9567 if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
9567 return (unsigned long)sk;9568 return (unsigned long)sk;
9568#endif9569#endif
9569 9570
@@ -9582,12 +9583,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = { · 12 unmodified lines
9582BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)9583BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
9583{9584{
9584#ifdef CONFIG_INET9585#ifdef CONFIG_INET
9585 if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)9586 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)
9586 return (unsigned long)sk;9587 return (unsigned long)sk;
9587#endif9588#endif
9588 9589
9589#if IS_BUILTIN(CONFIG_IPV6)9590#if IS_BUILTIN(CONFIG_IPV6)
9590 if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)9591 if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)
9591 return (unsigned long)sk;9592 return (unsigned long)sk;
9592#endif9593#endif
9593 9594
@@ -9609,7 +9610,7 @@ BPF_CALL_1(bpf_skc_to_udp6_sock, struct sock *, sk) · 15 unmodified lines
9609 * trigger an explicit type generation here.9610 * trigger an explicit type generation here.
9610 */9611 */
9611 BTF_TYPE_EMIT(struct udp6_sock);9612 BTF_TYPE_EMIT(struct udp6_sock);
9612 if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&9613 if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&
9613 sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6)9614 sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6)
9614 return (unsigned long)sk;9615 return (unsigned long)sk;
9615 9616
net/core/net_namespace.c+11−11
@@ -251,10 +251,10 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) · 250 unmodified lines
251 if (refcount_read(&net->count) == 0)251 if (refcount_read(&net->count) == 0)
252 return NETNSA_NSID_NOT_ASSIGNED;252 return NETNSA_NSID_NOT_ASSIGNED;
253 253
254 spin_lock(&net->nsid_lock);254 spin_lock_bh(&net->nsid_lock);
255 id = __peernet2id(net, peer);255 id = __peernet2id(net, peer);
256 if (id >= 0) {256 if (id >= 0) {
257 spin_unlock(&net->nsid_lock);257 spin_unlock_bh(&net->nsid_lock);
258 return id;258 return id;
259 }259 }
260 260
@@ -264,12 +264,12 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) · 3 unmodified lines
264 * just been idr_remove()'d from there in cleanup_net().264 * just been idr_remove()'d from there in cleanup_net().
265 */265 */
266 if (!maybe_get_net(peer)) {266 if (!maybe_get_net(peer)) {
267 spin_unlock(&net->nsid_lock);267 spin_unlock_bh(&net->nsid_lock);
268 return NETNSA_NSID_NOT_ASSIGNED;268 return NETNSA_NSID_NOT_ASSIGNED;
269 }269 }
270 270
271 id = alloc_netid(net, peer, -1);271 id = alloc_netid(net, peer, -1);
272 spin_unlock(&net->nsid_lock);272 spin_unlock_bh(&net->nsid_lock);
273 273
274 put_net(peer);274 put_net(peer);
275 if (id < 0)275 if (id < 0)
@@ -534,20 +534,20 @@ static void unhash_nsid(struct net *net, struct net *last) · 258 unmodified lines
534 for_each_net(tmp) {534 for_each_net(tmp) {
535 int id;535 int id;
536 536
537 spin_lock(&tmp->nsid_lock);537 spin_lock_bh(&tmp->nsid_lock);
538 id = __peernet2id(tmp, net);538 id = __peernet2id(tmp, net);
539 if (id >= 0)539 if (id >= 0)
540 idr_remove(&tmp->netns_ids, id);540 idr_remove(&tmp->netns_ids, id);
541 spin_unlock(&tmp->nsid_lock);541 spin_unlock_bh(&tmp->nsid_lock);
542 if (id >= 0)542 if (id >= 0)
543 rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL,543 rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL,
544 GFP_KERNEL);544 GFP_KERNEL);
545 if (tmp == last)545 if (tmp == last)
546 break;546 break;
547 }547 }
548 spin_lock(&net->nsid_lock);548 spin_lock_bh(&net->nsid_lock);
549 idr_destroy(&net->netns_ids);549 idr_destroy(&net->netns_ids);
550 spin_unlock(&net->nsid_lock);550 spin_unlock_bh(&net->nsid_lock);
551}551}
552 552
553static LLIST_HEAD(cleanup_list);553static LLIST_HEAD(cleanup_list);
@@ -760,9 +760,9 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 206 unmodified lines
760 return PTR_ERR(peer);760 return PTR_ERR(peer);
761 }761 }
762 762
763 spin_lock(&net->nsid_lock);763 spin_lock_bh(&net->nsid_lock);
764 if (__peernet2id(net, peer) >= 0) {764 if (__peernet2id(net, peer) >= 0) {
765 spin_unlock(&net->nsid_lock);765 spin_unlock_bh(&net->nsid_lock);
766 err = -EEXIST;766 err = -EEXIST;
767 NL_SET_BAD_ATTR(extack, nla);767 NL_SET_BAD_ATTR(extack, nla);
768 NL_SET_ERR_MSG(extack,768 NL_SET_ERR_MSG(extack,
@@ -771,7 +771,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 2 unmodified lines
771 }771 }
772 772
773 err = alloc_netid(net, peer, nsid);773 err = alloc_netid(net, peer, nsid);
774 spin_unlock(&net->nsid_lock);774 spin_unlock_bh(&net->nsid_lock);
775 if (err >= 0) {775 if (err >= 0) {
776 rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,776 rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,
777 nlh, GFP_KERNEL);777 nlh, GFP_KERNEL);
net/dcb/dcbnl.c+8−0
@@ -1426,6 +1426,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, · 1425 unmodified lines
1426{1426{
1427 const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;1427 const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
1428 struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];1428 struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
1429 int prio;
1429 int err;1430 int err;
1430 1431
1431 if (!ops)1432 if (!ops)
@@ -1475,6 +1476,13 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, · 43 unmodified lines
1475 struct dcbnl_buffer *buffer =1476 struct dcbnl_buffer *buffer =
1476 nla_data(ieee[DCB_ATTR_DCB_BUFFER]);1477 nla_data(ieee[DCB_ATTR_DCB_BUFFER]);
1477 1478
1479 for (prio = 0; prio < ARRAY_SIZE(buffer->prio2buffer); prio++) {
1480 if (buffer->prio2buffer[prio] >= DCBX_MAX_BUFFERS) {
1481 err = -EINVAL;
1482 goto err;
1483 }
1484 }
1485
1478 err = ops->dcbnl_setbuffer(netdev, buffer);1486 err = ops->dcbnl_setbuffer(netdev, buffer);
1479 if (err)1487 if (err)
1480 goto err;1488 goto err;
net/dsa/slave.c+16−2
@@ -1799,15 +1799,27 @@ int dsa_slave_create(struct dsa_port *port) · 1798 unmodified lines
1799 1799
1800 dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);1800 dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);
1801 1801
1802 ret = register_netdev(slave_dev);1802 rtnl_lock();
1803
1804 ret = register_netdevice(slave_dev);
1803 if (ret) {1805 if (ret) {
1804 netdev_err(master, "error %d registering interface %s\n",1806 netdev_err(master, "error %d registering interface %s\n",
1805 ret, slave_dev->name);1807 ret, slave_dev->name);
1808 rtnl_unlock();
1806 goto out_phy;1809 goto out_phy;
1807 }1810 }
1808 1811
1812 ret = netdev_upper_dev_link(master, slave_dev, NULL);
1813
1814 rtnl_unlock();
1815
1816 if (ret)
1817 goto out_unregister;
1818
1809 return 0;1819 return 0;
1810 1820
1821out_unregister:
1822 unregister_netdev(slave_dev);
1811out_phy:1823out_phy:
1812 rtnl_lock();1824 rtnl_lock();
1813 phylink_disconnect_phy(p->dp->pl);1825 phylink_disconnect_phy(p->dp->pl);
@@ -1824,16 +1836,18 @@ out_free: · 10 unmodified lines
1824 1836
1825void dsa_slave_destroy(struct net_device *slave_dev)1837void dsa_slave_destroy(struct net_device *slave_dev)
1826{1838{
1839 struct net_device *master = dsa_slave_to_master(slave_dev);
1827 struct dsa_port *dp = dsa_slave_to_port(slave_dev);1840 struct dsa_port *dp = dsa_slave_to_port(slave_dev);
1828 struct dsa_slave_priv *p = netdev_priv(slave_dev);1841 struct dsa_slave_priv *p = netdev_priv(slave_dev);
1829 1842
1830 netif_carrier_off(slave_dev);1843 netif_carrier_off(slave_dev);
1831 rtnl_lock();1844 rtnl_lock();
1845 netdev_upper_dev_unlink(master, slave_dev);
1846 unregister_netdevice(slave_dev);
1832 phylink_disconnect_phy(dp->pl);1847 phylink_disconnect_phy(dp->pl);
1833 rtnl_unlock();1848 rtnl_unlock();
1834 1849
1835 dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);1850 dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
1836 unregister_netdev(slave_dev);
1837 phylink_destroy(dp->pl);1851 phylink_destroy(dp->pl);
1838 gro_cells_destroy(&p->gcells);1852 gro_cells_destroy(&p->gcells);
1839 free_percpu(p->stats64);1853 free_percpu(p->stats64);
net/dsa/tag_ocelot.c+7−4
@@ -160,11 +160,14 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb, · 159 unmodified lines
160 packing(injection, &qos_class, 19, 17, OCELOT_TAG_LEN, PACK, 0);160 packing(injection, &qos_class, 19, 17, OCELOT_TAG_LEN, PACK, 0);
161 161
162 if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {162 if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
163 struct sk_buff *clone = DSA_SKB_CB(skb)->clone;
164
163 rew_op = ocelot_port->ptp_cmd;165 rew_op = ocelot_port->ptp_cmd;
164 if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {166 /* Retrieve timestamp ID populated inside skb->cb[0] of the
165 rew_op |= (ocelot_port->ts_id % 4) << 3;167 * clone by ocelot_port_add_txtstamp_skb
166 ocelot_port->ts_id++;168 */
167 }169 if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
170 rew_op |= clone->cb[0] << 3;
168 171
169 packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);172 packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
170 }173 }
net/ethtool/tunnels.c+2−2
@@ -200,7 +200,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info) · 199 unmodified lines
200 reply_len = ret + ethnl_reply_header_size();200 reply_len = ret + ethnl_reply_header_size();
201 201
202 rskb = ethnl_reply_init(reply_len, req_info.dev,202 rskb = ethnl_reply_init(reply_len, req_info.dev,
203 ETHTOOL_MSG_TUNNEL_INFO_GET,203 ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
204 ETHTOOL_A_TUNNEL_INFO_HEADER,204 ETHTOOL_A_TUNNEL_INFO_HEADER,
205 info, &reply_payload);205 info, &reply_payload);
206 if (!rskb) {206 if (!rskb) {
@@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb) · 66 unmodified lines
273 goto cont;273 goto cont;
274 274
275 ehdr = ethnl_dump_put(skb, cb,275 ehdr = ethnl_dump_put(skb, cb,
276 ETHTOOL_MSG_TUNNEL_INFO_GET);276 ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY);
277 if (!ehdr) {277 if (!ehdr) {
278 ret = -EMSGSIZE;278 ret = -EMSGSIZE;
279 goto out;279 goto out;
net/hsr/hsr_netlink.c+3−3
@@ -76,7 +76,7 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 75 unmodified lines
76 proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]);76 proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]);
77 77
78 if (proto >= HSR_PROTOCOL_MAX) {78 if (proto >= HSR_PROTOCOL_MAX) {
79 NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol\n");79 NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol");
80 return -EINVAL;80 return -EINVAL;
81 }81 }
82 82
@@ -84,14 +84,14 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 1 unmodified line
84 proto_version = HSR_V0;84 proto_version = HSR_V0;
85 } else {85 } else {
86 if (proto == HSR_PROTOCOL_PRP) {86 if (proto == HSR_PROTOCOL_PRP) {
87 NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported\n");87 NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported");
88 return -EINVAL;88 return -EINVAL;
89 }89 }
90 90
91 proto_version = nla_get_u8(data[IFLA_HSR_VERSION]);91 proto_version = nla_get_u8(data[IFLA_HSR_VERSION]);
92 if (proto_version > HSR_V1) {92 if (proto_version > HSR_V1) {
93 NL_SET_ERR_MSG_MOD(extack,93 NL_SET_ERR_MSG_MOD(extack,
94 "Only HSR version 0/1 supported\n");94 "Only HSR version 0/1 supported");
95 return -EINVAL;95 return -EINVAL;
96 }96 }
97 }97 }
net/ipv4/fib_frontend.c+1−0
@@ -362,6 +362,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, · 361 unmodified lines
362 fl4.flowi4_tun_key.tun_id = 0;362 fl4.flowi4_tun_key.tun_id = 0;
363 fl4.flowi4_flags = 0;363 fl4.flowi4_flags = 0;
364 fl4.flowi4_uid = sock_net_uid(net, NULL);364 fl4.flowi4_uid = sock_net_uid(net, NULL);
365 fl4.flowi4_multipath_hash = 0;
365 366
366 no_addr = idev->ifa_list == NULL;367 no_addr = idev->ifa_list == NULL;
367 368
net/ipv4/inet_diag.c+15−5
@@ -186,8 +186,8 @@ errout: · 185 unmodified lines
186}186}
187EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill);187EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill);
188 188
189static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,189static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
190 struct nlattr **req_nlas)190 struct nlattr **req_nlas)
191{191{
192 struct nlattr *nla;192 struct nlattr *nla;
193 int remaining;193 int remaining;
@@ -195,9 +195,13 @@ static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen, · 1 unmodified line
195 nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) {195 nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) {
196 int type = nla_type(nla);196 int type = nla_type(nla);
197 197
198 if (type == INET_DIAG_REQ_PROTOCOL && nla_len(nla) != sizeof(u32))
199 return -EINVAL;
200
198 if (type < __INET_DIAG_REQ_MAX)201 if (type < __INET_DIAG_REQ_MAX)
199 req_nlas[type] = nla;202 req_nlas[type] = nla;
200 }203 }
204 return 0;
201}205}
202 206
203static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req,207static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req,
@@ -574,7 +578,10 @@ static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb, · 370 unmodified lines
574 int err, protocol;578 int err, protocol;
575 579
576 memset(&dump_data, 0, sizeof(dump_data));580 memset(&dump_data, 0, sizeof(dump_data));
577 inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);581 err = inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);
582 if (err)
583 return err;
584
578 protocol = inet_diag_get_protocol(req, &dump_data);585 protocol = inet_diag_get_protocol(req, &dump_data);
579 586
580 handler = inet_diag_lock_handler(protocol);587 handler = inet_diag_lock_handler(protocol);
@@ -1180,8 +1187,11 @@ static int __inet_diag_dump_start(struct netlink_callback *cb, int hdrlen) · 599 unmodified lines
1180 if (!cb_data)1187 if (!cb_data)
1181 return -ENOMEM;1188 return -ENOMEM;
1182 1189
1183 inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);1190 err = inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
1184 1191 if (err) {
1192 kfree(cb_data);
1193 return err;
1194 }
1185 nla = cb_data->inet_diag_nla_bc;1195 nla = cb_data->inet_diag_nla_bc;
1186 if (nla) {1196 if (nla) {
1187 err = inet_diag_bc_audit(nla, skb);1197 err = inet_diag_bc_audit(nla, skb);
net/ipv4/ip_output.c+2−1
@@ -74,6 +74,7 @@ · 73 unmodified lines
74#include <net/icmp.h>74#include <net/icmp.h>
75#include <net/checksum.h>75#include <net/checksum.h>
76#include <net/inetpeer.h>76#include <net/inetpeer.h>
77#include <net/inet_ecn.h>
77#include <net/lwtunnel.h>78#include <net/lwtunnel.h>
78#include <linux/bpf-cgroup.h>79#include <linux/bpf-cgroup.h>
79#include <linux/igmp.h>80#include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, · 1623 unmodified lines
1703 if (IS_ERR(rt))1704 if (IS_ERR(rt))
1704 return;1705 return;
1705 1706
1706 inet_sk(sk)->tos = arg->tos;1707 inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
1707 1708
1708 sk->sk_protocol = ip_hdr(skb)->protocol;1709 sk->sk_protocol = ip_hdr(skb)->protocol;
1709 sk->sk_bound_dev_if = arg->bound_dev_if;1710 sk->sk_bound_dev_if = arg->bound_dev_if;
net/ipv4/ip_tunnel_core.c+1−0
@@ -554,6 +554,7 @@ static int ip_tun_parse_opts_vxlan(struct nlattr *attr, · 553 unmodified lines
554 554
555 attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP];555 attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP];
556 md->gbp = nla_get_u32(attr);556 md->gbp = nla_get_u32(attr);
557 md->gbp &= VXLAN_GBP_MASK;
557 info->key.tun_flags |= TUNNEL_VXLAN_OPT;558 info->key.tun_flags |= TUNNEL_VXLAN_OPT;
558 }559 }
559 560
net/ipv4/route.c+9−5
@@ -786,8 +786,10 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow · 785 unmodified lines
786 neigh_event_send(n, NULL);786 neigh_event_send(n, NULL);
787 } else {787 } else {
788 if (fib_lookup(net, fl4, &res, 0) == 0) {788 if (fib_lookup(net, fl4, &res, 0) == 0) {
789 struct fib_nh_common *nhc = FIB_RES_NHC(res);789 struct fib_nh_common *nhc;
790 790
791 fib_select_path(net, &res, fl4, skb);
792 nhc = FIB_RES_NHC(res);
791 update_or_create_fnhe(nhc, fl4->daddr, new_gw,793 update_or_create_fnhe(nhc, fl4->daddr, new_gw,
792 0, false,794 0, false,
793 jiffies + ip_rt_gc_timeout);795 jiffies + ip_rt_gc_timeout);
@@ -1013,6 +1015,7 @@ out: kfree_skb(skb); · 219 unmodified lines
1013static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)1015static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
1014{1016{
1015 struct dst_entry *dst = &rt->dst;1017 struct dst_entry *dst = &rt->dst;
1018 struct net *net = dev_net(dst->dev);
1016 u32 old_mtu = ipv4_mtu(dst);1019 u32 old_mtu = ipv4_mtu(dst);
1017 struct fib_result res;1020 struct fib_result res;
1018 bool lock = false;1021 bool lock = false;
@@ -1033,9 +1036,11 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) · 14 unmodified lines
1033 return;1036 return;
1034 1037
1035 rcu_read_lock();1038 rcu_read_lock();
1036 if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) {1039 if (fib_lookup(net, fl4, &res, 0) == 0) {
1037 struct fib_nh_common *nhc = FIB_RES_NHC(res);1040 struct fib_nh_common *nhc;
1038 1041
1042 fib_select_path(net, &res, fl4, NULL);
1043 nhc = FIB_RES_NHC(res);
1039 update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock,1044 update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock,
1040 jiffies + ip_rt_mtu_expires);1045 jiffies + ip_rt_mtu_expires);
1041 }1046 }
@@ -2147,6 +2152,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · 1105 unmodified lines
2147 fl4.daddr = daddr;2152 fl4.daddr = daddr;
2148 fl4.saddr = saddr;2153 fl4.saddr = saddr;
2149 fl4.flowi4_uid = sock_net_uid(net, NULL);2154 fl4.flowi4_uid = sock_net_uid(net, NULL);
2155 fl4.flowi4_multipath_hash = 0;
2150 2156
2151 if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) {2157 if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) {
2152 flkeys = &_flkeys;2158 flkeys = &_flkeys;
@@ -2667,8 +2673,6 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, · 514 unmodified lines
2667 fib_select_path(net, res, fl4, skb);2673 fib_select_path(net, res, fl4, skb);
2668 2674
2669 dev_out = FIB_RES_DEV(*res);2675 dev_out = FIB_RES_DEV(*res);
2670 fl4->flowi4_oif = dev_out->ifindex;
2671
2672 2676
2673make_route:2677make_route:
2674 rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags);2678 rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags);
net/ipv6/Kconfig+1−0
@@ -303,6 +303,7 @@ config IPV6_SEG6_LWTUNNEL · 302 unmodified lines
303config IPV6_SEG6_HMAC303config IPV6_SEG6_HMAC
304 bool "IPv6: Segment Routing HMAC support"304 bool "IPv6: Segment Routing HMAC support"
305 depends on IPV6305 depends on IPV6
306 select CRYPTO
306 select CRYPTO_HMAC307 select CRYPTO_HMAC
307 select CRYPTO_SHA1308 select CRYPTO_SHA1
308 select CRYPTO_SHA256309 select CRYPTO_SHA256
net/ipv6/ip6_fib.c+9−4
@@ -1993,14 +1993,19 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn, · 1992 unmodified lines
1993/* Need to own table->tb6_lock */1993/* Need to own table->tb6_lock */
1994int fib6_del(struct fib6_info *rt, struct nl_info *info)1994int fib6_del(struct fib6_info *rt, struct nl_info *info)
1995{1995{
1996 struct fib6_node *fn = rcu_dereference_protected(rt->fib6_node,
1997 lockdep_is_held(&rt->fib6_table->tb6_lock));
1998 struct fib6_table *table = rt->fib6_table;
1999 struct net *net = info->nl_net;1996 struct net *net = info->nl_net;
2000 struct fib6_info __rcu **rtp;1997 struct fib6_info __rcu **rtp;
2001 struct fib6_info __rcu **rtp_next;1998 struct fib6_info __rcu **rtp_next;
1999 struct fib6_table *table;
2000 struct fib6_node *fn;
2001
2002 if (rt == net->ipv6.fib6_null_entry)
2003 return -ENOENT;
2002 2004
2003 if (!fn || rt == net->ipv6.fib6_null_entry)2005 table = rt->fib6_table;
2006 fn = rcu_dereference_protected(rt->fib6_node,
2007 lockdep_is_held(&table->tb6_lock));
2008 if (!fn)
2004 return -ENOENT;2009 return -ENOENT;
2005 2010
2006 WARN_ON(!(fn->fn_flags & RTN_RTINFO));2011 WARN_ON(!(fn->fn_flags & RTN_RTINFO));
net/ipv6/route.c+1−1
@@ -4202,7 +4202,7 @@ static struct fib6_info *rt6_add_route_info(struct net *net, · 4201 unmodified lines
4202 .fc_nlinfo.nl_net = net,4202 .fc_nlinfo.nl_net = net,
4203 };4203 };
4204 4204
4205 cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO,4205 cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO;
4206 cfg.fc_dst = *prefix;4206 cfg.fc_dst = *prefix;
4207 cfg.fc_gateway = *gwaddr;4207 cfg.fc_gateway = *gwaddr;
4208 4208
net/mac80211/airtime.c+14−6
@@ -560,7 +560,9 @@ static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat, · 559 unmodified lines
560 if (rate->idx < 0 || !rate->count)560 if (rate->idx < 0 || !rate->count)
561 return -1;561 return -1;
562 562
563 if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)563 if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
564 stat->bw = RATE_INFO_BW_160;
565 else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
564 stat->bw = RATE_INFO_BW_80;566 stat->bw = RATE_INFO_BW_80;
565 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)567 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
566 stat->bw = RATE_INFO_BW_40;568 stat->bw = RATE_INFO_BW_40;
@@ -668,20 +670,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, · 101 unmodified lines
668 * This will not be very accurate, but much better than simply670 * This will not be very accurate, but much better than simply
669 * assuming un-aggregated tx in all cases.671 * assuming un-aggregated tx in all cases.
670 */672 */
671 if (duration > 400) /* <= VHT20 MCS2 1S */673 if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
672 agg_shift = 1;674 agg_shift = 1;
673 else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */675 else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
674 agg_shift = 2;676 agg_shift = 2;
675 else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */677 else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
676 agg_shift = 3;678 agg_shift = 3;
677 else679 else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
678 agg_shift = 4;680 agg_shift = 4;
681 else if (stat.encoding != RX_ENC_HE ||
682 duration > 20 * 1024) /* <= HE40 MCS6 2S */
683 agg_shift = 5;
684 else
685 agg_shift = 6;
679 686
680 duration *= len;687 duration *= len;
681 duration /= AVG_PKT_SIZE;688 duration /= AVG_PKT_SIZE;
682 duration /= 1024;689 duration /= 1024;
690 duration += (overhead >> agg_shift);
683 691
684 return duration + (overhead >> agg_shift);692 return max_t(u32, duration, 4);
685 }693 }
686 694
687 if (!conf)695 if (!conf)
net/mac80211/mlme.c+2−1
@@ -4861,6 +4861,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 4860 unmodified lines
4861 struct ieee80211_supported_band *sband;4861 struct ieee80211_supported_band *sband;
4862 struct cfg80211_chan_def chandef;4862 struct cfg80211_chan_def chandef;
4863 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ;4863 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ;
4864 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ;
4864 struct ieee80211_bss *bss = (void *)cbss->priv;4865 struct ieee80211_bss *bss = (void *)cbss->priv;
4865 int ret;4866 int ret;
4866 u32 i;4867 u32 i;
@@ -4879,7 +4880,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 12 unmodified lines
4879 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;4880 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
4880 }4881 }
4881 4882
4882 if (!sband->vht_cap.vht_supported && !is_6ghz) {4883 if (!sband->vht_cap.vht_supported && is_5ghz) {
4883 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;4884 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
4884 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;4885 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
4885 }4886 }
net/mac80211/rx.c+2−1
@@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, · 450 unmodified lines
451 else if (status->bw == RATE_INFO_BW_5)451 else if (status->bw == RATE_INFO_BW_5)
452 channel_flags |= IEEE80211_CHAN_QUARTER;452 channel_flags |= IEEE80211_CHAN_QUARTER;
453 453
454 if (status->band == NL80211_BAND_5GHZ)454 if (status->band == NL80211_BAND_5GHZ ||
455 status->band == NL80211_BAND_6GHZ)
455 channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;456 channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
456 else if (status->encoding != RX_ENC_LEGACY)457 else if (status->encoding != RX_ENC_LEGACY)
457 channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;458 channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
net/mac80211/util.c+4−3
@@ -3353,9 +3353,10 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, · 3352 unmodified lines
3353 he_chandef.center_freq1 =3353 he_chandef.center_freq1 =
3354 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0,3354 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0,
3355 NL80211_BAND_6GHZ);3355 NL80211_BAND_6GHZ);
3356 he_chandef.center_freq2 =3356 if (support_80_80 || support_160)
3357 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,3357 he_chandef.center_freq2 =
3358 NL80211_BAND_6GHZ);3358 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
3359 NL80211_BAND_6GHZ);
3359 }3360 }
3360 3361
3361 if (!cfg80211_chandef_valid(&he_chandef)) {3362 if (!cfg80211_chandef_valid(&he_chandef)) {
net/mac80211/vht.c+4−4
@@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 167 unmodified lines
168 /* take some capabilities as-is */168 /* take some capabilities as-is */
169 cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);169 cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
170 vht_cap->cap = cap_info;170 vht_cap->cap = cap_info;
171 vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |171 vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC |
172 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
173 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
174 IEEE80211_VHT_CAP_RXLDPC |
175 IEEE80211_VHT_CAP_VHT_TXOP_PS |172 IEEE80211_VHT_CAP_VHT_TXOP_PS |
176 IEEE80211_VHT_CAP_HTC_VHT |173 IEEE80211_VHT_CAP_HTC_VHT |
177 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |174 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
@@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 2 unmodified lines
180 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |177 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
181 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;178 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
182 179
180 vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK,
181 own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK);
182
183 /* and some based on our own capabilities */183 /* and some based on our own capabilities */
184 switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {184 switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
185 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:185 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
net/mac802154/tx.c+5−3
@@ -34,11 +34,11 @@ void ieee802154_xmit_worker(struct work_struct *work) · 33 unmodified lines
34 if (res)34 if (res)
35 goto err_tx;35 goto err_tx;
36 36
37 ieee802154_xmit_complete(&local->hw, skb, false);
38
39 dev->stats.tx_packets++;37 dev->stats.tx_packets++;
40 dev->stats.tx_bytes += skb->len;38 dev->stats.tx_bytes += skb->len;
41 39
40 ieee802154_xmit_complete(&local->hw, skb, false);
41
42 return;42 return;
43 43
44err_tx:44err_tx:
@@ -78,6 +78,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 33 unmodified lines
78 78
79 /* async is priority, otherwise sync is fallback */79 /* async is priority, otherwise sync is fallback */
80 if (local->ops->xmit_async) {80 if (local->ops->xmit_async) {
81 unsigned int len = skb->len;
82
81 ret = drv_xmit_async(local, skb);83 ret = drv_xmit_async(local, skb);
82 if (ret) {84 if (ret) {
83 ieee802154_wake_queue(&local->hw);85 ieee802154_wake_queue(&local->hw);
@@ -85,7 +87,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 1 unmodified line
85 }87 }
86 88
87 dev->stats.tx_packets++;89 dev->stats.tx_packets++;
88 dev->stats.tx_bytes += skb->len;90 dev->stats.tx_bytes += len;
89 } else {91 } else {
90 local->tx_skb = skb;92 local->tx_skb = skb;
91 queue_work(local->workqueue, &local->tx_work);93 queue_work(local->workqueue, &local->tx_work);
net/mptcp/pm_netlink.c+16−3
@@ -66,6 +66,16 @@ static bool addresses_equal(const struct mptcp_addr_info *a, · 65 unmodified lines
66 return a->port == b->port;66 return a->port == b->port;
67}67}
68 68
69static bool address_zero(const struct mptcp_addr_info *addr)
70{
71 struct mptcp_addr_info zero;
72
73 memset(&zero, 0, sizeof(zero));
74 zero.family = addr->family;
75
76 return addresses_equal(addr, &zero, false);
77}
78
69static void local_address(const struct sock_common *skc,79static void local_address(const struct sock_common *skc,
70 struct mptcp_addr_info *addr)80 struct mptcp_addr_info *addr)
71{81{
@@ -171,9 +181,9 @@ static void check_work_pending(struct mptcp_sock *msk) · 99 unmodified lines
171 181
172static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)182static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
173{183{
184 struct mptcp_addr_info remote = { 0 };
174 struct sock *sk = (struct sock *)msk;185 struct sock *sk = (struct sock *)msk;
175 struct mptcp_pm_addr_entry *local;186 struct mptcp_pm_addr_entry *local;
176 struct mptcp_addr_info remote;
177 struct pm_nl_pernet *pernet;187 struct pm_nl_pernet *pernet;
178 188
179 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);189 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
@@ -323,10 +333,13 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) · 143 unmodified lines
323 * addr333 * addr
324 */334 */
325 local_address((struct sock_common *)msk, &msk_local);335 local_address((struct sock_common *)msk, &msk_local);
326 local_address((struct sock_common *)msk, &skc_local);336 local_address((struct sock_common *)skc, &skc_local);
327 if (addresses_equal(&msk_local, &skc_local, false))337 if (addresses_equal(&msk_local, &skc_local, false))
328 return 0;338 return 0;
329 339
340 if (address_zero(&skc_local))
341 return 0;
342
330 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);343 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
331 344
332 rcu_read_lock();345 rcu_read_lock();
@@ -341,7 +354,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) · 8 unmodified lines
341 return ret;354 return ret;
342 355
343 /* address not found, add to local list */356 /* address not found, add to local list */
344 entry = kmalloc(sizeof(*entry), GFP_KERNEL);357 entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
345 if (!entry)358 if (!entry)
346 return -ENOMEM;359 return -ENOMEM;
347 360
net/mptcp/subflow.c+5−2
@@ -1063,6 +1063,7 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 1062 unmodified lines
1063 struct mptcp_sock *msk = mptcp_sk(sk);1063 struct mptcp_sock *msk = mptcp_sk(sk);
1064 struct mptcp_subflow_context *subflow;1064 struct mptcp_subflow_context *subflow;
1065 struct sockaddr_storage addr;1065 struct sockaddr_storage addr;
1066 int remote_id = remote->id;
1066 int local_id = loc->id;1067 int local_id = loc->id;
1067 struct socket *sf;1068 struct socket *sf;
1068 struct sock *ssk;1069 struct sock *ssk;
@@ -1107,10 +1108,11 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 38 unmodified lines
1107 goto failed;1108 goto failed;
1108 1109
1109 mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);1110 mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
1110 pr_debug("msk=%p remote_token=%u local_id=%d", msk, remote_token,1111 pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk,
1111 local_id);1112 remote_token, local_id, remote_id);
1112 subflow->remote_token = remote_token;1113 subflow->remote_token = remote_token;
1113 subflow->local_id = local_id;1114 subflow->local_id = local_id;
1115 subflow->remote_id = remote_id;
1114 subflow->request_join = 1;1116 subflow->request_join = 1;
1115 subflow->request_bkup = 1;1117 subflow->request_bkup = 1;
1116 mptcp_info2sockaddr(remote, &addr);1118 mptcp_info2sockaddr(remote, &addr);
@@ -1347,6 +1349,7 @@ static void subflow_ulp_clone(const struct request_sock *req, · 230 unmodified lines
1347 new_ctx->fully_established = 1;1349 new_ctx->fully_established = 1;
1348 new_ctx->backup = subflow_req->backup;1350 new_ctx->backup = subflow_req->backup;
1349 new_ctx->local_id = subflow_req->local_id;1351 new_ctx->local_id = subflow_req->local_id;
1352 new_ctx->remote_id = subflow_req->remote_id;
1350 new_ctx->token = subflow_req->token;1353 new_ctx->token = subflow_req->token;
1351 new_ctx->thmac = subflow_req->thmac;1354 new_ctx->thmac = subflow_req->thmac;
1352 }1355 }
net/netfilter/nf_conntrack_netlink.c+5−17
@@ -851,7 +851,6 @@ static int ctnetlink_done(struct netlink_callback *cb) · 850 unmodified lines
851}851}
852 852
853struct ctnetlink_filter {853struct ctnetlink_filter {
854 u_int32_t cta_flags;
855 u8 family;854 u8 family;
856 855
857 u_int32_t orig_flags;856 u_int32_t orig_flags;
@@ -906,10 +905,6 @@ static int ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 48 unmodified lines
906 struct nf_conntrack_zone *zone,905 struct nf_conntrack_zone *zone,
907 u_int32_t flags);906 u_int32_t flags);
908 907
909/* applied on filters */
910#define CTA_FILTER_F_CTA_MARK (1 << 0)
911#define CTA_FILTER_F_CTA_MARK_MASK (1 << 1)
912
913static struct ctnetlink_filter *908static struct ctnetlink_filter *
914ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)909ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
915{910{
@@ -930,14 +925,10 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family) · 14 unmodified lines
930#ifdef CONFIG_NF_CONNTRACK_MARK925#ifdef CONFIG_NF_CONNTRACK_MARK
931 if (cda[CTA_MARK]) {926 if (cda[CTA_MARK]) {
932 filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK]));927 filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK]));
933 filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK);928 if (cda[CTA_MARK_MASK])
934
935 if (cda[CTA_MARK_MASK]) {
936 filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK]));929 filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK]));
937 filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK_MASK);930 else
938 } else {
939 filter->mark.mask = 0xffffffff;931 filter->mark.mask = 0xffffffff;
940 }
941 } else if (cda[CTA_MARK_MASK]) {932 } else if (cda[CTA_MARK_MASK]) {
942 err = -EINVAL;933 err = -EINVAL;
943 goto err_filter;934 goto err_filter;
@@ -1117,11 +1108,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data) · 173 unmodified lines
1117 }1108 }
1118 1109
1119#ifdef CONFIG_NF_CONNTRACK_MARK1110#ifdef CONFIG_NF_CONNTRACK_MARK
1120 if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) &&1111 if ((ct->mark & filter->mark.mask) != filter->mark.val)
1121 (ct->mark & filter->mark.mask) != filter->mark.val)
1122 goto ignore_entry;
1123 else if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) &&
1124 ct->mark != filter->mark.val)
1125 goto ignore_entry;1112 goto ignore_entry;
1126#endif1113#endif
1127 1114
@@ -1404,7 +1391,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 276 unmodified lines
1404 if (err < 0)1391 if (err < 0)
1405 return err;1392 return err;
1406 1393
1407 1394 if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6)
1395 return -EOPNOTSUPP;
1408 tuple->src.l3num = l3num;1396 tuple->src.l3num = l3num;
1409 1397
1410 if (flags & CTA_FILTER_FLAG(CTA_IP_DST) ||1398 if (flags & CTA_FILTER_FLAG(CTA_IP_DST) ||
net/netfilter/nf_conntrack_proto.c+2−0
@@ -565,6 +565,7 @@ static int nf_ct_netns_inet_get(struct net *net) · 564 unmodified lines
565 int err;565 int err;
566 566
567 err = nf_ct_netns_do_get(net, NFPROTO_IPV4);567 err = nf_ct_netns_do_get(net, NFPROTO_IPV4);
568#if IS_ENABLED(CONFIG_IPV6)
568 if (err < 0)569 if (err < 0)
569 goto err1;570 goto err1;
570 err = nf_ct_netns_do_get(net, NFPROTO_IPV6);571 err = nf_ct_netns_do_get(net, NFPROTO_IPV6);
@@ -575,6 +576,7 @@ static int nf_ct_netns_inet_get(struct net *net) · 4 unmodified lines
575err2:576err2:
576 nf_ct_netns_put(net, NFPROTO_IPV4);577 nf_ct_netns_put(net, NFPROTO_IPV4);
577err1:578err1:
579#endif
578 return err;580 return err;
579}581}
580 582
net/netfilter/nf_tables_api.c+57−13
@@ -684,6 +684,18 @@ nla_put_failure: · 683 unmodified lines
684 return -1;684 return -1;
685}685}
686 686
687struct nftnl_skb_parms {
688 bool report;
689};
690#define NFT_CB(skb) (*(struct nftnl_skb_parms*)&((skb)->cb))
691
692static void nft_notify_enqueue(struct sk_buff *skb, bool report,
693 struct list_head *notify_list)
694{
695 NFT_CB(skb).report = report;
696 list_add_tail(&skb->list, notify_list);
697}
698
687static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)699static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
688{700{
689 struct sk_buff *skb;701 struct sk_buff *skb;
@@ -715,8 +727,7 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event) · 25 unmodified lines
715 goto err;727 goto err;
716 }728 }
717 729
718 nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,730 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
719 ctx->report, GFP_KERNEL);
720 return;731 return;
721err:732err:
722 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);733 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -1468,8 +1479,7 @@ static void nf_tables_chain_notify(const struct nft_ctx *ctx, int event) · 745 unmodified lines
1468 goto err;1479 goto err;
1469 }1480 }
1470 1481
1471 nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,1482 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
1472 ctx->report, GFP_KERNEL);
1473 return;1483 return;
1474err:1484err:
1475 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);1485 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -2807,8 +2817,7 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx, · 1331 unmodified lines
2807 goto err;2817 goto err;
2808 }2818 }
2809 2819
2810 nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,2820 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
2811 ctx->report, GFP_KERNEL);
2812 return;2821 return;
2813err:2822err:
2814 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);2823 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -3837,8 +3846,7 @@ static void nf_tables_set_notify(const struct nft_ctx *ctx, · 1022 unmodified lines
3837 goto err;3846 goto err;
3838 }3847 }
3839 3848
3840 nfnetlink_send(skb, ctx->net, portid, NFNLGRP_NFTABLES, ctx->report,3849 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
3841 gfp_flags);
3842 return;3850 return;
3843err:3851err:
3844 nfnetlink_set_err(ctx->net, portid, NFNLGRP_NFTABLES, -ENOBUFS);3852 nfnetlink_set_err(ctx->net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -4959,8 +4967,7 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx, · 1114 unmodified lines
4959 goto err;4967 goto err;
4960 }4968 }
4961 4969
4962 nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, ctx->report,4970 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
4963 GFP_KERNEL);
4964 return;4971 return;
4965err:4972err:
4966 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);4973 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -6275,7 +6282,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 1308 unmodified lines
6275 goto err;6282 goto err;
6276 }6283 }
6277 6284
6278 nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report, gfp);6285 nft_notify_enqueue(skb, report, &net->nft.notify_list);
6279 return;6286 return;
6280err:6287err:
6281 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);6288 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7085,8 +7092,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx, · 803 unmodified lines
7085 goto err;7092 goto err;
7086 }7093 }
7087 7094
7088 nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,7095 nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
7089 ctx->report, GFP_KERNEL);
7090 return;7096 return;
7091err:7097err:
7092 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);7098 nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7695,6 +7701,41 @@ static void nf_tables_commit_release(struct net *net) · 602 unmodified lines
7695 mutex_unlock(&net->nft.commit_mutex);7701 mutex_unlock(&net->nft.commit_mutex);
7696}7702}
7697 7703
7704static void nft_commit_notify(struct net *net, u32 portid)
7705{
7706 struct sk_buff *batch_skb = NULL, *nskb, *skb;
7707 unsigned char *data;
7708 int len;
7709
7710 list_for_each_entry_safe(skb, nskb, &net->nft.notify_list, list) {
7711 if (!batch_skb) {
7712new_batch:
7713 batch_skb = skb;
7714 len = NLMSG_GOODSIZE - skb->len;
7715 list_del(&skb->list);
7716 continue;
7717 }
7718 len -= skb->len;
7719 if (len > 0 && NFT_CB(skb).report == NFT_CB(batch_skb).report) {
7720 data = skb_put(batch_skb, skb->len);
7721 memcpy(data, skb->data, skb->len);
7722 list_del(&skb->list);
7723 kfree_skb(skb);
7724 continue;
7725 }
7726 nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
7727 NFT_CB(batch_skb).report, GFP_KERNEL);
7728 goto new_batch;
7729 }
7730
7731 if (batch_skb) {
7732 nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
7733 NFT_CB(batch_skb).report, GFP_KERNEL);
7734 }
7735
7736 WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
7737}
7738
7698static int nf_tables_commit(struct net *net, struct sk_buff *skb)7739static int nf_tables_commit(struct net *net, struct sk_buff *skb)
7699{7740{
7700 struct nft_trans *trans, *next;7741 struct nft_trans *trans, *next;
@@ -7897,6 +7938,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 196 unmodified lines
7897 }7938 }
7898 }7939 }
7899 7940
7941 nft_commit_notify(net, NETLINK_CB(skb).portid);
7900 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);7942 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);
7901 nf_tables_commit_release(net);7943 nf_tables_commit_release(net);
7902 7944
@@ -8721,6 +8763,7 @@ static int __net_init nf_tables_init_net(struct net *net) · 818 unmodified lines
8721 INIT_LIST_HEAD(&net->nft.tables);8763 INIT_LIST_HEAD(&net->nft.tables);
8722 INIT_LIST_HEAD(&net->nft.commit_list);8764 INIT_LIST_HEAD(&net->nft.commit_list);
8723 INIT_LIST_HEAD(&net->nft.module_list);8765 INIT_LIST_HEAD(&net->nft.module_list);
8766 INIT_LIST_HEAD(&net->nft.notify_list);
8724 mutex_init(&net->nft.commit_mutex);8767 mutex_init(&net->nft.commit_mutex);
8725 net->nft.base_seq = 1;8768 net->nft.base_seq = 1;
8726 net->nft.validate_state = NFT_VALIDATE_SKIP;8769 net->nft.validate_state = NFT_VALIDATE_SKIP;
@@ -8737,6 +8780,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 10 unmodified lines
8737 mutex_unlock(&net->nft.commit_mutex);8780 mutex_unlock(&net->nft.commit_mutex);
8738 WARN_ON_ONCE(!list_empty(&net->nft.tables));8781 WARN_ON_ONCE(!list_empty(&net->nft.tables));
8739 WARN_ON_ONCE(!list_empty(&net->nft.module_list));8782 WARN_ON_ONCE(!list_empty(&net->nft.module_list));
8783 WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
8740}8784}
8741 8785
8742static struct pernet_operations nf_tables_net_ops = {8786static struct pernet_operations nf_tables_net_ops = {
net/netfilter/nft_meta.c+2−2
@@ -147,11 +147,11 @@ nft_meta_get_eval_skugid(enum nft_meta_keys key, · 146 unmodified lines
147 147
148 switch (key) {148 switch (key) {
149 case NFT_META_SKUID:149 case NFT_META_SKUID:
150 *dest = from_kuid_munged(&init_user_ns,150 *dest = from_kuid_munged(sock_net(sk)->user_ns,
151 sock->file->f_cred->fsuid);151 sock->file->f_cred->fsuid);
152 break;152 break;
153 case NFT_META_SKGID:153 case NFT_META_SKGID:
154 *dest = from_kgid_munged(&init_user_ns,154 *dest = from_kgid_munged(sock_net(sk)->user_ns,
155 sock->file->f_cred->fsgid);155 sock->file->f_cred->fsgid);
156 break;156 break;
157 default:157 default:
net/qrtr/qrtr.c+11−10
@@ -332,8 +332,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 331 unmodified lines
332{332{
333 struct qrtr_hdr_v1 *hdr;333 struct qrtr_hdr_v1 *hdr;
334 size_t len = skb->len;334 size_t len = skb->len;
335 int rc = -ENODEV;335 int rc, confirm_rx;
336 int confirm_rx;
337 336
338 confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);337 confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);
339 if (confirm_rx < 0) {338 if (confirm_rx < 0) {
@@ -357,15 +356,17 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 17 unmodified lines
357 hdr->size = cpu_to_le32(len);356 hdr->size = cpu_to_le32(len);
358 hdr->confirm_rx = !!confirm_rx;357 hdr->confirm_rx = !!confirm_rx;
359 358
360 skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));359 rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
361
362 mutex_lock(&node->ep_lock);
363 if (node->ep)
364 rc = node->ep->xmit(node->ep, skb);
365 else
366 kfree_skb(skb);
367 mutex_unlock(&node->ep_lock);
368 360
361 if (!rc) {
362 mutex_lock(&node->ep_lock);
363 rc = -ENODEV;
364 if (node->ep)
365 rc = node->ep->xmit(node->ep, skb);
366 else
367 kfree_skb(skb);
368 mutex_unlock(&node->ep_lock);
369 }
369 /* Need to ensure that a subsequent message carries the otherwise lost370 /* Need to ensure that a subsequent message carries the otherwise lost
370 * confirm_rx flag if we dropped this one */371 * confirm_rx flag if we dropped this one */
371 if (rc && confirm_rx)372 if (rc && confirm_rx)
net/sched/act_ife.c+34−10
@@ -436,6 +436,25 @@ static void tcf_ife_cleanup(struct tc_action *a) · 435 unmodified lines
436 kfree_rcu(p, rcu);436 kfree_rcu(p, rcu);
437}437}
438 438
439static int load_metalist(struct nlattr **tb, bool rtnl_held)
440{
441 int i;
442
443 for (i = 1; i < max_metacnt; i++) {
444 if (tb[i]) {
445 void *val = nla_data(tb[i]);
446 int len = nla_len(tb[i]);
447 int rc;
448
449 rc = load_metaops_and_vet(i, val, len, rtnl_held);
450 if (rc != 0)
451 return rc;
452 }
453 }
454
455 return 0;
456}
457
439static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,458static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
440 bool exists, bool rtnl_held)459 bool exists, bool rtnl_held)
441{460{
@@ -449,10 +468,6 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, · 7 unmodified lines
449 val = nla_data(tb[i]);468 val = nla_data(tb[i]);
450 len = nla_len(tb[i]);469 len = nla_len(tb[i]);
451 470
452 rc = load_metaops_and_vet(i, val, len, rtnl_held);
453 if (rc != 0)
454 return rc;
455
456 rc = add_metainfo(ife, i, val, len, exists);471 rc = add_metainfo(ife, i, val, len, exists);
457 if (rc)472 if (rc)
458 return rc;473 return rc;
@@ -509,6 +524,21 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 50 unmodified lines
509 if (!p)524 if (!p)
510 return -ENOMEM;525 return -ENOMEM;
511 526
527 if (tb[TCA_IFE_METALST]) {
528 err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
529 tb[TCA_IFE_METALST], NULL,
530 NULL);
531 if (err) {
532 kfree(p);
533 return err;
534 }
535 err = load_metalist(tb2, rtnl_held);
536 if (err) {
537 kfree(p);
538 return err;
539 }
540 }
541
512 index = parm->index;542 index = parm->index;
513 err = tcf_idr_check_alloc(tn, &index, a, bind);543 err = tcf_idr_check_alloc(tn, &index, a, bind);
514 if (err < 0) {544 if (err < 0) {
@@ -570,15 +600,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 55 unmodified lines
570 }600 }
571 601
572 if (tb[TCA_IFE_METALST]) {602 if (tb[TCA_IFE_METALST]) {
573 err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
574 tb[TCA_IFE_METALST], NULL,
575 NULL);
576 if (err)
577 goto metadata_parse_err;
578 err = populate_metalist(ife, tb2, exists, rtnl_held);603 err = populate_metalist(ife, tb2, exists, rtnl_held);
579 if (err)604 if (err)
580 goto metadata_parse_err;605 goto metadata_parse_err;
581
582 } else {606 } else {
583 /* if no passed metadata allow list or passed allow-all607 /* if no passed metadata allow list or passed allow-all
584 * then here we process by adding as many supported metadatum608 * then here we process by adding as many supported metadatum
net/sched/act_tunnel_key.c+1−0
@@ -156,6 +156,7 @@ tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len, · 155 unmodified lines
156 struct vxlan_metadata *md = dst;156 struct vxlan_metadata *md = dst;
157 157
158 md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]);158 md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]);
159 md->gbp &= VXLAN_GBP_MASK;
159 }160 }
160 161
161 return sizeof(struct vxlan_metadata);162 return sizeof(struct vxlan_metadata);
net/sched/cls_flower.c+4−1
@@ -1175,8 +1175,10 @@ static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key, · 1174 unmodified lines
1175 return -EINVAL;1175 return -EINVAL;
1176 }1176 }
1177 1177
1178 if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP])1178 if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) {
1179 md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]);1179 md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]);
1180 md->gbp &= VXLAN_GBP_MASK;
1181 }
1180 1182
1181 return sizeof(*md);1183 return sizeof(*md);
1182}1184}
@@ -1221,6 +1223,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key, · 38 unmodified lines
1221 }1223 }
1222 if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {1224 if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {
1223 nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];1225 nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];
1226 memset(&md->u, 0x00, sizeof(md->u));
1224 md->u.index = nla_get_be32(nla);1227 md->u.index = nla_get_be32(nla);
1225 }1228 }
1226 } else if (md->version == 2) {1229 } else if (md->version == 2) {
net/sched/sch_generic.c+33−15
@@ -1131,24 +1131,10 @@ EXPORT_SYMBOL(dev_activate); · 1130 unmodified lines
1131 1131
1132static void qdisc_deactivate(struct Qdisc *qdisc)1132static void qdisc_deactivate(struct Qdisc *qdisc)
1133{1133{
1134 bool nolock = qdisc->flags & TCQ_F_NOLOCK;
1135
1136 if (qdisc->flags & TCQ_F_BUILTIN)1134 if (qdisc->flags & TCQ_F_BUILTIN)
1137 return;1135 return;
1138 if (test_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state))
1139 return;
1140
1141 if (nolock)
1142 spin_lock_bh(&qdisc->seqlock);
1143 spin_lock_bh(qdisc_lock(qdisc));
1144 1136
1145 set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);1137 set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
1146
1147 qdisc_reset(qdisc);
1148
1149 spin_unlock_bh(qdisc_lock(qdisc));
1150 if (nolock)
1151 spin_unlock_bh(&qdisc->seqlock);
1152}1138}
1153 1139
1154static void dev_deactivate_queue(struct net_device *dev,1140static void dev_deactivate_queue(struct net_device *dev,
@@ -1165,6 +1151,30 @@ static void dev_deactivate_queue(struct net_device *dev, · 10 unmodified lines
1165 }1151 }
1166}1152}
1167 1153
1154static void dev_reset_queue(struct net_device *dev,
1155 struct netdev_queue *dev_queue,
1156 void *_unused)
1157{
1158 struct Qdisc *qdisc;
1159 bool nolock;
1160
1161 qdisc = dev_queue->qdisc_sleeping;
1162 if (!qdisc)
1163 return;
1164
1165 nolock = qdisc->flags & TCQ_F_NOLOCK;
1166
1167 if (nolock)
1168 spin_lock_bh(&qdisc->seqlock);
1169 spin_lock_bh(qdisc_lock(qdisc));
1170
1171 qdisc_reset(qdisc);
1172
1173 spin_unlock_bh(qdisc_lock(qdisc));
1174 if (nolock)
1175 spin_unlock_bh(&qdisc->seqlock);
1176}
1177
1168static bool some_qdisc_is_busy(struct net_device *dev)1178static bool some_qdisc_is_busy(struct net_device *dev)
1169{1179{
1170 unsigned int i;1180 unsigned int i;
@@ -1213,12 +1223,20 @@ void dev_deactivate_many(struct list_head *head) · 42 unmodified lines
1213 dev_watchdog_down(dev);1223 dev_watchdog_down(dev);
1214 }1224 }
1215 1225
1216 /* Wait for outstanding qdisc-less dev_queue_xmit calls.1226 /* Wait for outstanding qdisc-less dev_queue_xmit calls or
1227 * outstanding qdisc enqueuing calls.
1217 * This is avoided if all devices are in dismantle phase :1228 * This is avoided if all devices are in dismantle phase :
1218 * Caller will call synchronize_net() for us1229 * Caller will call synchronize_net() for us
1219 */1230 */
1220 synchronize_net();1231 synchronize_net();
1221 1232
1233 list_for_each_entry(dev, head, close_list) {
1234 netdev_for_each_tx_queue(dev, dev_reset_queue, NULL);
1235
1236 if (dev_ingress_queue(dev))
1237 dev_reset_queue(dev, dev_ingress_queue(dev), NULL);
1238 }
1239
1222 /* Wait for outstanding qdisc_run calls. */1240 /* Wait for outstanding qdisc_run calls. */
1223 list_for_each_entry(dev, head, close_list) {1241 list_for_each_entry(dev, head, close_list) {
1224 while (some_qdisc_is_busy(dev)) {1242 while (some_qdisc_is_busy(dev)) {
net/sched/sch_taprio.c+17−11
@@ -777,9 +777,11 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { · 776 unmodified lines
777 [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },777 [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },
778};778};
779 779
780static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,780static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
781 struct sched_entry *entry,
781 struct netlink_ext_ack *extack)782 struct netlink_ext_ack *extack)
782{783{
784 int min_duration = length_to_duration(q, ETH_ZLEN);
783 u32 interval = 0;785 u32 interval = 0;
784 786
785 if (tb[TCA_TAPRIO_SCHED_ENTRY_CMD])787 if (tb[TCA_TAPRIO_SCHED_ENTRY_CMD])
@@ -794,7 +796,10 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, · 8 unmodified lines
794 interval = nla_get_u32(796 interval = nla_get_u32(
795 tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]);797 tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]);
796 798
797 if (interval == 0) {799 /* The interval should allow at least the minimum ethernet
800 * frame to go out.
801 */
802 if (interval < min_duration) {
798 NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");803 NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
799 return -EINVAL;804 return -EINVAL;
800 }805 }
@@ -804,8 +809,9 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, · 3 unmodified lines
804 return 0;809 return 0;
805}810}
806 811
807static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,812static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,
808 int index, struct netlink_ext_ack *extack)813 struct sched_entry *entry, int index,
814 struct netlink_ext_ack *extack)
809{815{
810 struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };816 struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };
811 int err;817 int err;
@@ -819,10 +825,10 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry, · 7 unmodified lines
819 825
820 entry->index = index;826 entry->index = index;
821 827
822 return fill_sched_entry(tb, entry, extack);828 return fill_sched_entry(q, tb, entry, extack);
823}829}
824 830
825static int parse_sched_list(struct nlattr *list,831static int parse_sched_list(struct taprio_sched *q, struct nlattr *list,
826 struct sched_gate_list *sched,832 struct sched_gate_list *sched,
827 struct netlink_ext_ack *extack)833 struct netlink_ext_ack *extack)
828{834{
@@ -847,7 +853,7 @@ static int parse_sched_list(struct nlattr *list, · 18 unmodified lines
847 return -ENOMEM;853 return -ENOMEM;
848 }854 }
849 855
850 err = parse_sched_entry(n, entry, i, extack);856 err = parse_sched_entry(q, n, entry, i, extack);
851 if (err < 0) {857 if (err < 0) {
852 kfree(entry);858 kfree(entry);
853 return err;859 return err;
@@ -862,7 +868,7 @@ static int parse_sched_list(struct nlattr *list, · 8 unmodified lines
862 return i;868 return i;
863}869}
864 870
865static int parse_taprio_schedule(struct nlattr **tb,871static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
866 struct sched_gate_list *new,872 struct sched_gate_list *new,
867 struct netlink_ext_ack *extack)873 struct netlink_ext_ack *extack)
868{874{
@@ -883,8 +889,8 @@ static int parse_taprio_schedule(struct nlattr **tb, · 14 unmodified lines
883 new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);889 new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);
884 890
885 if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])891 if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])
886 err = parse_sched_list(892 err = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],
887 tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack);893 new, extack);
888 if (err < 0)894 if (err < 0)
889 return err;895 return err;
890 896
@@ -1473,7 +1479,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, · 582 unmodified lines
1473 goto free_sched;1479 goto free_sched;
1474 }1480 }
1475 1481
1476 err = parse_taprio_schedule(tb, new_admin, extack);1482 err = parse_taprio_schedule(q, tb, new_admin, extack);
1477 if (err < 0)1483 if (err < 0)
1478 goto free_sched;1484 goto free_sched;
1479 1485
net/sctp/socket.c+3−6
@@ -9220,13 +9220,10 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, · 9219 unmodified lines
9220static inline void sctp_copy_descendant(struct sock *sk_to,9220static inline void sctp_copy_descendant(struct sock *sk_to,
9221 const struct sock *sk_from)9221 const struct sock *sk_from)
9222{9222{
9223 int ancestor_size = sizeof(struct inet_sock) +9223 size_t ancestor_size = sizeof(struct inet_sock);
9224 sizeof(struct sctp_sock) -
9225 offsetof(struct sctp_sock, pd_lobby);
9226
9227 if (sk_from->sk_family == PF_INET6)
9228 ancestor_size += sizeof(struct ipv6_pinfo);
9229 9224
9225 ancestor_size += sk_from->sk_prot->obj_size;
9226 ancestor_size -= offsetof(struct sctp_sock, pd_lobby);
9230 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);9227 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
9231}9228}
9232 9229
net/tipc/group.c+10−4
@@ -273,8 +273,8 @@ static struct tipc_member *tipc_group_find_node(struct tipc_group *grp, · 272 unmodified lines
273 return NULL;273 return NULL;
274}274}
275 275
276static void tipc_group_add_to_tree(struct tipc_group *grp,276static int tipc_group_add_to_tree(struct tipc_group *grp,
277 struct tipc_member *m)277 struct tipc_member *m)
278{278{
279 u64 nkey, key = (u64)m->node << 32 | m->port;279 u64 nkey, key = (u64)m->node << 32 | m->port;
280 struct rb_node **n, *parent = NULL;280 struct rb_node **n, *parent = NULL;
@@ -291,10 +291,11 @@ static void tipc_group_add_to_tree(struct tipc_group *grp, · 10 unmodified lines
291 else if (key > nkey)291 else if (key > nkey)
292 n = &(*n)->rb_right;292 n = &(*n)->rb_right;
293 else293 else
294 return;294 return -EEXIST;
295 }295 }
296 rb_link_node(&m->tree_node, parent, n);296 rb_link_node(&m->tree_node, parent, n);
297 rb_insert_color(&m->tree_node, &grp->members);297 rb_insert_color(&m->tree_node, &grp->members);
298 return 0;
298}299}
299 300
300static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,301static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
@@ -302,6 +303,7 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, · 1 unmodified line
302 u32 instance, int state)303 u32 instance, int state)
303{304{
304 struct tipc_member *m;305 struct tipc_member *m;
306 int ret;
305 307
306 m = kzalloc(sizeof(*m), GFP_ATOMIC);308 m = kzalloc(sizeof(*m), GFP_ATOMIC);
307 if (!m)309 if (!m)
@@ -314,8 +316,12 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, · 6 unmodified lines
314 m->port = port;316 m->port = port;
315 m->instance = instance;317 m->instance = instance;
316 m->bc_acked = grp->bc_snd_nxt - 1;318 m->bc_acked = grp->bc_snd_nxt - 1;
319 ret = tipc_group_add_to_tree(grp, m);
320 if (ret < 0) {
321 kfree(m);
322 return NULL;
323 }
317 grp->member_cnt++;324 grp->member_cnt++;
318 tipc_group_add_to_tree(grp, m);
319 tipc_nlist_add(&grp->dests, m->node);325 tipc_nlist_add(&grp->dests, m->node);
320 m->state = state;326 m->state = state;
321 return m;327 return m;
net/tipc/link.c+2−1
@@ -532,7 +532,8 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id, · 531 unmodified lines
532 * tipc_link_bc_create - create new link to be used for broadcast532 * tipc_link_bc_create - create new link to be used for broadcast
533 * @net: pointer to associated network namespace533 * @net: pointer to associated network namespace
534 * @mtu: mtu to be used initially if no peers534 * @mtu: mtu to be used initially if no peers
535 * @window: send window to be used535 * @min_win: minimal send window to be used by link
536 * @max_win: maximal send window to be used by link
536 * @inputq: queue to put messages ready for delivery537 * @inputq: queue to put messages ready for delivery
537 * @namedq: queue to put binding table update messages ready for delivery538 * @namedq: queue to put binding table update messages ready for delivery
538 * @link: return value, pointer to put the created link539 * @link: return value, pointer to put the created link
net/tipc/msg.c+2−1
@@ -150,7 +150,8 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) · 149 unmodified lines
150 if (fragid == FIRST_FRAGMENT) {150 if (fragid == FIRST_FRAGMENT) {
151 if (unlikely(head))151 if (unlikely(head))
152 goto err;152 goto err;
153 if (unlikely(skb_unclone(frag, GFP_ATOMIC)))153 frag = skb_unshare(frag, GFP_ATOMIC);
154 if (unlikely(!frag))
154 goto err;155 goto err;
155 head = *headbuf = frag;156 head = *headbuf = frag;
156 *buf = NULL;157 *buf = NULL;
net/tipc/socket.c+1−4
@@ -2771,10 +2771,7 @@ static int tipc_shutdown(struct socket *sock, int how) · 2770 unmodified lines
2771 2771
2772 trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");2772 trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");
2773 __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);2773 __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);
2774 if (tipc_sk_type_connectionless(sk))2774 sk->sk_shutdown = SHUTDOWN_MASK;
2775 sk->sk_shutdown = SHUTDOWN_MASK;
2776 else
2777 sk->sk_shutdown = SEND_SHUTDOWN;
2778 2775
2779 if (sk->sk_state == TIPC_DISCONNECTING) {2776 if (sk->sk_state == TIPC_DISCONNECTING) {
2780 /* Discard any unreceived messages */2777 /* Discard any unreceived messages */
net/wireless/Kconfig+1−0
@@ -217,6 +217,7 @@ config LIB80211_CRYPT_WEP · 216 unmodified lines
217 217
218config LIB80211_CRYPT_CCMP218config LIB80211_CRYPT_CCMP
219 tristate219 tristate
220 select CRYPTO
220 select CRYPTO_AES221 select CRYPTO_AES
221 select CRYPTO_CCM222 select CRYPTO_CCM
222 223
net/wireless/util.c+1−1
@@ -95,7 +95,7 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band) · 94 unmodified lines
95 /* see 802.11ax D6.1 27.3.23.2 */95 /* see 802.11ax D6.1 27.3.23.2 */
96 if (chan == 2)96 if (chan == 2)
97 return MHZ_TO_KHZ(5935);97 return MHZ_TO_KHZ(5935);
98 if (chan <= 253)98 if (chan <= 233)
99 return MHZ_TO_KHZ(5950 + chan * 5);99 return MHZ_TO_KHZ(5950 + chan * 5);
100 break;100 break;
101 case NL80211_BAND_60GHZ:101 case NL80211_BAND_60GHZ:
net/xdp/xdp_umem.c+8−9
@@ -303,10 +303,10 @@ static int xdp_umem_account_pages(struct xdp_umem *umem) · 302 unmodified lines
303 303
304static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)304static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
305{305{
306 u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom;
306 bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;307 bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
307 u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
308 u64 npgs, addr = mr->addr, size = mr->len;308 u64 npgs, addr = mr->addr, size = mr->len;
309 unsigned int chunks, chunks_per_page;309 unsigned int chunks, chunks_rem;
310 int err;310 int err;
311 311
312 if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {312 if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
@@ -336,19 +336,18 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) · 23 unmodified lines
336 if ((addr + size) < addr)336 if ((addr + size) < addr)
337 return -EINVAL;337 return -EINVAL;
338 338
339 npgs = size >> PAGE_SHIFT;339 npgs = div_u64_rem(size, PAGE_SIZE, &npgs_rem);
340 if (npgs_rem)
341 npgs++;
340 if (npgs > U32_MAX)342 if (npgs > U32_MAX)
341 return -EINVAL;343 return -EINVAL;
342 344
343 chunks = (unsigned int)div_u64(size, chunk_size);345 chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem);
344 if (chunks == 0)346 if (chunks == 0)
345 return -EINVAL;347 return -EINVAL;
346 348
347 if (!unaligned_chunks) {349 if (!unaligned_chunks && chunks_rem)
348 chunks_per_page = PAGE_SIZE / chunk_size;350 return -EINVAL;
349 if (chunks < chunks_per_page || chunks % chunks_per_page)
350 return -EINVAL;
351 }
352 351
353 if (headroom >= chunk_size - XDP_PACKET_HEADROOM)352 if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
354 return -EINVAL;353 return -EINVAL;
tools/bpf/Makefile+2−2
@@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args · 37 unmodified lines
38FEATURE_DISPLAY = libbfd disassembler-four-args38FEATURE_DISPLAY = libbfd disassembler-four-args
39 39
40check_feat := 140check_feat := 1
41NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean41NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
42ifdef MAKECMDGOALS42ifdef MAKECMDGOALS
43ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)43ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
44 check_feat := 044 check_feat := 0
@@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c · 44 unmodified lines
89$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c89$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
90$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c90$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
91 91
92clean: bpftool_clean runqslower_clean92clean: bpftool_clean runqslower_clean resolve_btfids_clean
93 $(call QUIET_CLEAN, bpf-progs)93 $(call QUIET_CLEAN, bpf-progs)
94 $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \94 $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
95 $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*95 $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
tools/bpf/resolve_btfids/Makefile+1−0
@@ -80,6 +80,7 @@ libbpf-clean: · 79 unmodified lines
80clean: libsubcmd-clean libbpf-clean fixdep-clean80clean: libsubcmd-clean libbpf-clean fixdep-clean
81 $(call msg,CLEAN,$(BINARY))81 $(call msg,CLEAN,$(BINARY))
82 $(Q)$(RM) -f $(BINARY); \82 $(Q)$(RM) -f $(BINARY); \
83 $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
83 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)84 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
84 85
85tags:86tags:
tools/lib/bpf/Makefile+3−1
@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf · 58 unmodified lines
59FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray59FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray
60FEATURE_DISPLAY = libelf zlib bpf60FEATURE_DISPLAY = libelf zlib bpf
61 61
62INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi62INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
63FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)63FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
64 64
65check_feat := 165check_feat := 1
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ · 86 unmodified lines
152 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \152 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
153 sort -u | wc -l)153 sort -u | wc -l)
154VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \154VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
155 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
155 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)156 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
156 157
157CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)158CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so · 61 unmodified lines
219 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \220 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
220 sort -u > $(OUTPUT)libbpf_global_syms.tmp; \221 sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
221 readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \222 readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
223 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
222 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \224 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
223 sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \225 sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
224 diff -u $(OUTPUT)libbpf_global_syms.tmp \226 diff -u $(OUTPUT)libbpf_global_syms.tmp \
tools/lib/bpf/libbpf.c+1−1
@@ -5203,8 +5203,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj, · 5202 unmodified lines
5203 int i, j, nrels, new_sz;5203 int i, j, nrels, new_sz;
5204 const struct btf_var_secinfo *vi = NULL;5204 const struct btf_var_secinfo *vi = NULL;
5205 const struct btf_type *sec, *var, *def;5205 const struct btf_type *sec, *var, *def;
5206 struct bpf_map *map = NULL, *targ_map;
5206 const struct btf_member *member;5207 const struct btf_member *member;
5207 struct bpf_map *map, *targ_map;
5208 const char *name, *mname;5208 const char *name, *mname;
5209 Elf_Data *symbols;5209 Elf_Data *symbols;
5210 unsigned int moff;5210 unsigned int moff;
tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map.c+15−0
@@ -47,7 +47,10 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx) · 46 unmodified lines
47 __u32 seq_num = ctx->meta->seq_num;47 __u32 seq_num = ctx->meta->seq_num;
48 struct bpf_map *map = ctx->map;48 struct bpf_map *map = ctx->map;
49 struct key_t *key = ctx->key;49 struct key_t *key = ctx->key;
50 struct key_t tmp_key;
50 __u64 *val = ctx->value;51 __u64 *val = ctx->value;
52 __u64 tmp_val = 0;
53 int ret;
51 54
52 if (in_test_mode) {55 if (in_test_mode) {
53 /* test mode is used by selftests to56 /* test mode is used by selftests to
@@ -61,6 +64,18 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx) · 7 unmodified lines
61 if (key == (void *)0 || val == (void *)0)64 if (key == (void *)0 || val == (void *)0)
62 return 0;65 return 0;
63 66
67 /* update the value and then delete the <key, value> pair.
68 * it should not impact the existing 'val' which is still
69 * accessible under rcu.
70 */
71 __builtin_memcpy(&tmp_key, key, sizeof(struct key_t));
72 ret = bpf_map_update_elem(&hashmap1, &tmp_key, &tmp_val, 0);
73 if (ret)
74 return 0;
75 ret = bpf_map_delete_elem(&hashmap1, &tmp_key);
76 if (ret)
77 return 0;
78
64 key_sum_a += key->a;79 key_sum_a += key->a;
65 key_sum_b += key->b;80 key_sum_b += key->b;
66 key_sum_c += key->c;81 key_sum_c += key->c;
tools/testing/selftests/net/rtnetlink.sh+47−0
@@ -1175,6 +1175,51 @@ kci_test_neigh_get() · 1174 unmodified lines
1175 echo "PASS: neigh get"1175 echo "PASS: neigh get"
1176}1176}
1177 1177
1178kci_test_bridge_parent_id()
1179{
1180 local ret=0
1181 sysfsnet=/sys/bus/netdevsim/devices/netdevsim
1182 probed=false
1183
1184 if [ ! -w /sys/bus/netdevsim/new_device ] ; then
1185 modprobe -q netdevsim
1186 check_err $?
1187 if [ $ret -ne 0 ]; then
1188 echo "SKIP: bridge_parent_id can't load netdevsim"
1189 return $ksft_skip
1190 fi
1191 probed=true
1192 fi
1193
1194 echo "10 1" > /sys/bus/netdevsim/new_device
1195 while [ ! -d ${sysfsnet}10 ] ; do :; done
1196 echo "20 1" > /sys/bus/netdevsim/new_device
1197 while [ ! -d ${sysfsnet}20 ] ; do :; done
1198 udevadm settle
1199 dev10=`ls ${sysfsnet}10/net/`
1200 dev20=`ls ${sysfsnet}20/net/`
1201
1202 ip link add name test-bond0 type bond mode 802.3ad
1203 ip link set dev $dev10 master test-bond0
1204 ip link set dev $dev20 master test-bond0
1205 ip link add name test-br0 type bridge
1206 ip link set dev test-bond0 master test-br0
1207 check_err $?
1208
1209 # clean up any leftovers
1210 ip link del dev test-br0
1211 ip link del dev test-bond0
1212 echo 20 > /sys/bus/netdevsim/del_device
1213 echo 10 > /sys/bus/netdevsim/del_device
1214 $probed && rmmod netdevsim
1215
1216 if [ $ret -ne 0 ]; then
1217 echo "FAIL: bridge_parent_id"
1218 return 1
1219 fi
1220 echo "PASS: bridge_parent_id"
1221}
1222
1178kci_test_rtnl()1223kci_test_rtnl()
1179{1224{
1180 local ret=01225 local ret=0
@@ -1224,6 +1269,8 @@ kci_test_rtnl() · 43 unmodified lines
1224 check_err $?1269 check_err $?
1225 kci_test_neigh_get1270 kci_test_neigh_get
1226 check_err $?1271 check_err $?
1272 kci_test_bridge_parent_id
1273 check_err $?
1227 1274
1228 kci_del_dummy1275 kci_del_dummy
1229 return $ret1276 return $ret

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t