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
182182 already committed. It is thus possible for slow producers to temporarily hold
183183 off submitted records, that were reserved later.
184184
185−Reservation/commit/consumer protocol is verified by litmus tests in
186−Documentation/litmus_tests/bpf-rb/_.
187−
188185 One interesting implementation bit, that significantly simplifies (and thus
189186 speeds up as well) implementation of both producers and consumers is how data
190187 area 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
200197 being available after commit only if consumer has already caught up right up to
201198 the record being committed. If not, consumer still has to catch up and thus
202199 will see new data anyways without needing an extra poll notification.
203−Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbuf.c_) show that
200+Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbufs.c) show that
204201 this allows to achieve a very high throughput without having to resort to
205202 tricks like "notify only every Nth sample", which are necessary with perf
206203 buffer. 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
206206 ``ETHTOOL_MSG_TSINFO_GET`` get timestamping info
207207 ``ETHTOOL_MSG_CABLE_TEST_ACT`` action start cable test
208208 ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT`` action start raw TDR cable test
209+ ``ETHTOOL_MSG_TUNNEL_INFO_GET`` get tunnel offload info
209210 ===================================== ================================
210211
211212 Kernel to userspace:
@@ -239,6 +240,7 @@ Kernel to userspace: · 27 unmodified lines
239240 ``ETHTOOL_MSG_TSINFO_GET_REPLY`` timestamping info
240241 ``ETHTOOL_MSG_CABLE_TEST_NTF`` Cable test results
241242 ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF`` Cable test TDR results
243+ ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info
242244 ===================================== =================================
243245
244246 ``GET`` requests are sent by userspace applications to retrieve device
@@ -1363,4 +1365,5 @@ are netlink only. · 1118 unmodified lines
13631365 ``ETHTOOL_SFECPARAM`` n/a
13641366 n/a ''ETHTOOL_MSG_CABLE_TEST_ACT''
13651367 n/a ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''
1368+ n/a ``ETHTOOL_MSG_TUNNEL_INFO_GET``
13661369 =================================== =====================================
MAINTAINERS+6−9
@@ -4408,12 +4408,6 @@ T: git git://git.infradead.org/users/hch/configfs.git · 4407 unmodified lines
44084408 F: fs/configfs/
44094409 F: include/linux/configfs.h
44104410
4411−CONNECTOR
4412−M: Evgeniy Polyakov <zbr@ioremap.net>
4413−L: netdev@vger.kernel.org
4414−S: Maintained
4415−F: drivers/connector/
4416−
44174411 CONSOLE SUBSYSTEM
44184412 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44194413 S: Supported
@@ -8329,8 +8323,9 @@ S: Supported · 3909 unmodified lines
83298323 F: drivers/pci/hotplug/rpaphp*
83308324
83318325 IBM Power SRIOV Virtual NIC Device Driver
8332−M: Thomas Falcon <tlfalcon@linux.ibm.com>
8333−M: John Allen <jallen@linux.ibm.com>
8326+M: Dany Madden <drt@linux.ibm.com>
8327+M: Lijun Pan <ljp@linux.ibm.com>
8328+M: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
83348329 L: netdev@vger.kernel.org
83358330 S: Supported
83368331 F: drivers/net/ethernet/ibm/ibmvnic.*
@@ -8344,7 +8339,7 @@ F: arch/powerpc/platforms/powernv/copy-paste.h · 7 unmodified lines
83448339 F: arch/powerpc/platforms/powernv/vas*
83458340
83468341 IBM Power Virtual Ethernet Device Driver
8347−M: Thomas Falcon <tlfalcon@linux.ibm.com>
8342+M: Cristobal Forno <cforno12@linux.ibm.com>
83488343 L: netdev@vger.kernel.org
83498344 S: Supported
83508345 F: drivers/net/ethernet/ibm/ibmveth.*
@@ -11042,6 +11037,7 @@ F: drivers/char/hw_random/mtk-rng.c · 2691 unmodified lines
1104211037
1104311038 MEDIATEK SWITCH DRIVER
1104411039 M: Sean Wang <sean.wang@mediatek.com>
11040+M: Landen Chao <Landen.Chao@mediatek.com>
1104511041 L: netdev@vger.kernel.org
1104611042 S: Maintained
1104711043 F: drivers/net/dsa/mt7530.*
@@ -12055,6 +12051,7 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/ · 1007 unmodified lines
1205512051 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
1205612052 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
1205712053 F: Documentation/devicetree/bindings/net/
12054+F: drivers/connector/
1205812055 F: drivers/net/
1205912056 F: include/linux/etherdevice.h
1206012057 F: include/linux/fcdevice.h
arch/arm/boot/dts/at91-sama5d2_icp.dts+1−1
@@ -116,7 +116,6 @@ · 115 unmodified lines
116116 switch0: ksz8563@0 {
117117 compatible = "microchip,ksz8563";
118118 reg = <0>;
119− phy-mode = "mii";
120119 reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;
121120
122121 spi-max-frequency = <500000>;
@@ -140,6 +139,7 @@ · 17 unmodified lines
140139 reg = <2>;
141140 label = "cpu";
142141 ethernet = <&macb0>;
142+ phy-mode = "mii";
143143 fixed-link {
144144 speed = <100>;
145145 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
22242224
22252225 rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
22262226 if (rc < 0)
2227− goto out;
2227+ goto err_disable;
22282228
22292229 rc = -ENOMEM;
22302230 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
932932 ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
933933
934934 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+
935943 /* Configure MII interface for proper network communication. */
936944 ksz_read8(dev, REG_PORT_5_CTRL_6, &data8);
937945 data8 &= ~PORT_INTERFACE_TYPE;
938946 data8 &= ~PORT_GMII_1GPS_MODE;
939− switch (dev->interface) {
947+ switch (p->interface) {
940948 case PHY_INTERFACE_MODE_MII:
941949 p->phydev.speed = SPEED_100;
942950 break;
@@ -952,11 +960,11 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port) · 9 unmodified lines
952960 default:
953961 data8 &= ~PORT_RGMII_ID_IN_ENABLE;
954962 data8 &= ~PORT_RGMII_ID_OUT_ENABLE;
955− if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
956− dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
963+ if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
964+ p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
957965 data8 |= PORT_RGMII_ID_IN_ENABLE;
958− if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
959− dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
966+ if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
967+ p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
960968 data8 |= PORT_RGMII_ID_OUT_ENABLE;
961969 data8 |= PORT_GMII_1GPS_MODE;
962970 data8 |= PORT_INTERFACE_RGMII;
@@ -1252,7 +1260,7 @@ static int ksz8795_switch_init(struct ksz_device *dev) · 289 unmodified lines
12521260 }
12531261
12541262 /* set the real number of ports */
1255− dev->ds->num_ports = dev->port_cnt;
1263+ dev->ds->num_ports = dev->port_cnt + 1;
12561264
12571265 return 0;
12581266 }
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
12081208
12091209 /* configure MAC to 1G & RGMII mode */
12101210 ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
1211− switch (dev->interface) {
1211+ switch (p->interface) {
12121212 case PHY_INTERFACE_MODE_MII:
12131213 ksz9477_set_xmii(dev, 0, &data8);
12141214 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
12291229 ksz9477_set_gbit(dev, true, &data8);
12301230 data8 &= ~PORT_RGMII_ID_IG_ENABLE;
12311231 data8 &= ~PORT_RGMII_ID_EG_ENABLE;
1232− if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1233− dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
1232+ if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1233+ p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
12341234 data8 |= PORT_RGMII_ID_IG_ENABLE;
1235− if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1236− dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
1235+ if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
1236+ p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
12371237 data8 |= PORT_RGMII_ID_EG_ENABLE;
12381238 p->phydev.speed = SPEED_1000;
12391239 break;
@@ -1269,23 +1269,32 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds) · 29 unmodified lines
12691269 dev->cpu_port = i;
12701270 dev->host_mask = (1 << dev->cpu_port);
12711271 dev->port_mask |= dev->host_mask;
1272+ p = &dev->ports[i];
12721273
12731274 /* Read from XMII register to determine host port
12741275 * interface. If set specifically in device tree
12751276 * note the difference to help debugging.
12761277 */
12771278 interface = ksz9477_get_interface(dev, i);
1278− if (!dev->interface)
1279− dev->interface = interface;
1280− if (interface && interface != dev->interface)
1279+ if (!p->interface) {
1280+ if (dev->compat_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)
12811291 dev_info(dev->dev,
12821292 "use %s instead of %s\n",
1283− phy_modes(dev->interface),
1293+ phy_modes(p->interface),
12841294 phy_modes(interface));
12851295
12861296 /* enable cpu port */
12871297 ksz9477_port_setup(dev, i, true);
1288− p = &dev->ports[dev->cpu_port];
12891298 p->vid_member = dev->port_mask;
12901299 p->on = 1;
12911300 }
drivers/net/dsa/microchip/ksz_common.c+12−1
@@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev, · 387 unmodified lines
388388 const struct ksz_dev_ops *ops)
389389 {
390390 phy_interface_t interface;
391+ struct device_node *port;
392+ unsigned int port_num;
391393 int ret;
392394
393395 if (dev->pdata)
@@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev, · 27 unmodified lines
421423 /* Host port interface will be self detected, or specifically set in
422424 * device tree.
423425 */
426+ for (port_num = 0; port_num < dev->port_cnt; ++port_num)
427+ dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA;
424428 if (dev->dev->of_node) {
425429 ret = of_get_phy_mode(dev->dev->of_node, &interface);
426430 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+ }
428439 dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
429440 "microchip,synclko-125");
430441 }
drivers/net/dsa/microchip/ksz_common.h+2−1
@@ -39,6 +39,7 @@ struct ksz_port { · 38 unmodified lines
3939 u32 freeze:1; /* MIB counter freeze is enabled */
4040
4141 struct ksz_port_mib mib;
42+ phy_interface_t interface;
4243 };
4344
4445 struct ksz_device {
@@ -72,7 +73,7 @@ struct ksz_device { · 27 unmodified lines
7273 int mib_cnt;
7374 int mib_port_cnt;
7475 int last_port; /* ports after that not used */
75− phy_interface_t interface;
76+ phy_interface_t compat_interface;
7677 u32 regs_size;
7778 bool phy_errata_9477;
7879 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
585585 if (err)
586586 return err;
587587
588− ocelot_init(ocelot);
588+ err = ocelot_init(ocelot);
589+ if (err)
590+ return err;
591+
589592 if (ocelot->ptp) {
590593 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
591594 if (err) {
@@ -640,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds) · 48 unmodified lines
640643 {
641644 struct ocelot *ocelot = ds->priv;
642645 struct felix *felix = ocelot_to_felix(ocelot);
646+ int port;
643647
644648 if (felix->info->mdio_bus_free)
645649 felix->info->mdio_bus_free(ocelot);
646650
651+ for (port = 0; port < ocelot->num_phys_ports; port++)
652+ ocelot_deinit_port(ocelot, port);
647653 ocelot_deinit_timestamp(ocelot);
648654 /* stop workqueue thread */
649655 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
645645 [VCAP_IS2_HK_DIP_EQ_SIP] = {118, 1},
646646 /* IP4_TCP_UDP (TYPE=100) */
647647 [VCAP_IS2_HK_TCP] = {119, 1},
648− [VCAP_IS2_HK_L4_SPORT] = {120, 16},
649− [VCAP_IS2_HK_L4_DPORT] = {136, 16},
648+ [VCAP_IS2_HK_L4_DPORT] = {120, 16},
649+ [VCAP_IS2_HK_L4_SPORT] = {136, 16},
650650 [VCAP_IS2_HK_L4_RNG] = {152, 8},
651651 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {160, 1},
652652 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {161, 1},
653− [VCAP_IS2_HK_L4_URG] = {162, 1},
654− [VCAP_IS2_HK_L4_ACK] = {163, 1},
655− [VCAP_IS2_HK_L4_PSH] = {164, 1},
656− [VCAP_IS2_HK_L4_RST] = {165, 1},
657− [VCAP_IS2_HK_L4_SYN] = {166, 1},
658− [VCAP_IS2_HK_L4_FIN] = {167, 1},
653+ [VCAP_IS2_HK_L4_FIN] = {162, 1},
654+ [VCAP_IS2_HK_L4_SYN] = {163, 1},
655+ [VCAP_IS2_HK_L4_RST] = {164, 1},
656+ [VCAP_IS2_HK_L4_PSH] = {165, 1},
657+ [VCAP_IS2_HK_L4_ACK] = {166, 1},
658+ [VCAP_IS2_HK_L4_URG] = {167, 1},
659659 [VCAP_IS2_HK_L4_1588_DOM] = {168, 8},
660660 [VCAP_IS2_HK_L4_1588_VER] = {176, 4},
661661 /* 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
659659 [VCAP_IS2_HK_DIP_EQ_SIP] = {122, 1},
660660 /* IP4_TCP_UDP (TYPE=100) */
661661 [VCAP_IS2_HK_TCP] = {123, 1},
662− [VCAP_IS2_HK_L4_SPORT] = {124, 16},
663− [VCAP_IS2_HK_L4_DPORT] = {140, 16},
662+ [VCAP_IS2_HK_L4_DPORT] = {124, 16},
663+ [VCAP_IS2_HK_L4_SPORT] = {140, 16},
664664 [VCAP_IS2_HK_L4_RNG] = {156, 8},
665665 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {164, 1},
666666 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {165, 1},
667− [VCAP_IS2_HK_L4_URG] = {166, 1},
668− [VCAP_IS2_HK_L4_ACK] = {167, 1},
669− [VCAP_IS2_HK_L4_PSH] = {168, 1},
670− [VCAP_IS2_HK_L4_RST] = {169, 1},
671− [VCAP_IS2_HK_L4_SYN] = {170, 1},
672− [VCAP_IS2_HK_L4_FIN] = {171, 1},
667+ [VCAP_IS2_HK_L4_FIN] = {166, 1},
668+ [VCAP_IS2_HK_L4_SYN] = {167, 1},
669+ [VCAP_IS2_HK_L4_RST] = {168, 1},
670+ [VCAP_IS2_HK_L4_PSH] = {169, 1},
671+ [VCAP_IS2_HK_L4_ACK] = {170, 1},
672+ [VCAP_IS2_HK_L4_URG] = {171, 1},
673673 /* IP4_OTHER (TYPE=101) */
674674 [VCAP_IS2_HK_IP4_L3_PROTO] = {123, 8},
675675 [VCAP_IS2_HK_L3_PAYLOAD] = {131, 56},
@@ -1008,7 +1008,7 @@ static const struct felix_info seville_info_vsc9953 = { · 332 unmodified lines
10081008 .vcap_is2_keys = vsc9953_vcap_is2_keys,
10091009 .vcap_is2_actions = vsc9953_vcap_is2_actions,
10101010 .vcap = vsc9953_vcap_props,
1011− .shared_queue_sz = 128 * 1024,
1011+ .shared_queue_sz = 2048 * 1024,
10121012 .num_mact_rows = 2048,
10131013 .num_ports = 10,
10141014 .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
452452 return ret;
453453
454454 if (vid == vlanmc.vid) {
455− /* clear VLAN member configurations */
456− vlanmc.vid = 0;
457− vlanmc.priority = 0;
458− vlanmc.member = 0;
459− vlanmc.untag = 0;
460− vlanmc.fid = 0;
461−
455+ /* Remove this port from the VLAN */
456+ vlanmc.member &= ~BIT(port);
457+ vlanmc.untag &= ~BIT(port);
458+ /*
459+ * If no ports are members of this VLAN
460+ * anymore then clear the whole member
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+ }
462468 ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
463469 if (ret) {
464470 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
37823782 return -EOPNOTSUPP;
37833783
37843784 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1);
3785+ req.fid = cpu_to_le16(0xffff);
37853786 req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
37863787 mutex_lock(&bp->hwrm_cmd_lock);
37873788 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
38523853 tx_masks = stats->hw_masks;
38533854 tx_count = sizeof(struct tx_port_stats_ext) / 8;
38543855
3855− flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
3856+ flags = PORT_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
38563857 rc = bnxt_hwrm_port_qstats_ext(bp, flags);
38573858 if (rc) {
38583859 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
43054306 u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
43064307 u16 dst = BNXT_HWRM_CHNL_CHIMP;
43074308
4308− if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
4309+ if (BNXT_NO_FW_ACCESS(bp))
43094310 return -EBUSY;
43104311
43114312 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
57235724 struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;
57245725 u16 error_code;
57255726
5726− if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
5727+ if (BNXT_NO_FW_ACCESS(bp))
57275728 return 0;
57285729
57295730 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
78177818
78187819 if (set_tpa)
78197820 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))
78217822 return 0;
78227823 for (i = 0; i < bp->nr_vnics; i++) {
78237824 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
93119312 struct hwrm_temp_monitor_query_output *resp;
93129313 struct bnxt *bp = dev_get_drvdata(dev);
93139314 u32 len = 0;
9315+ int rc;
93149316
93159317 resp = bp->hwrm_cmd_resp_addr;
93169318 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
93179319 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)
93199322 len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
93209323 mutex_unlock(&bp->hwrm_cmd_lock);
9321−
9322− if (len)
9323− return len;
9324−
9325− return sprintf(buf, "unknown\n");
9324+ return rc ?: len;
93269325 }
93279326 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
93289327
@@ -9342,7 +9341,16 @@ static void bnxt_hwmon_close(struct bnxt *bp) · 13 unmodified lines
93429341
93439342 static void bnxt_hwmon_open(struct bnxt *bp)
93449343 {
9344+ struct hwrm_temp_monitor_query_input req = {0};
93459345 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+ }
93469354
93479355 if (bp->hwmon_dev)
93489356 return;
@@ -11779,6 +11787,10 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 2430 unmodified lines
1177911787 if (BNXT_PF(bp))
1178011788 bnxt_sriov_disable(bp);
1178111789
11790+ clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11791+ bnxt_cancel_sp_work(bp);
11792+ bp->sp_event = 0;
11793+
1178211794 bnxt_dl_fw_reporters_destroy(bp, true);
1178311795 if (BNXT_PF(bp))
1178411796 devlink_port_type_clear(&bp->dl_port);
@@ -11786,9 +11798,6 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 1 unmodified line
1178611798 unregister_netdev(dev);
1178711799 bnxt_dl_unregister(bp);
1178811800 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;
1179211801
1179311802 bnxt_clear_int_mode(bp);
1179411803 bnxt_hwrm_func_drv_unrgtr(bp);
@@ -12089,7 +12098,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp) · 294 unmodified lines
1208912098 static void bnxt_vpd_read_info(struct bnxt *bp)
1209012099 {
1209112100 struct pci_dev *pdev = bp->pdev;
12092− int i, len, pos, ro_size;
12101+ int i, len, pos, ro_size, size;
1209312102 ssize_t vpd_size;
1209412103 u8 *vpd_data;
1209512104
@@ -12124,7 +12133,8 @@ static void bnxt_vpd_read_info(struct bnxt *bp) · 28 unmodified lines
1212412133 if (len + pos > vpd_size)
1212512134 goto read_sn;
1212612135
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);
1212812138
1212912139 read_sn:
1213012140 pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
@@ -12137,7 +12147,8 @@ read_sn: · 6 unmodified lines
1213712147 if (len + pos > vpd_size)
1213812148 goto exit;
1213912149
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);
1214112152 exit:
1214212153 kfree(vpd_data);
1214312154 }
drivers/net/ethernet/broadcom/bnxt/bnxt.h+4−0
@@ -1737,6 +1737,10 @@ struct bnxt { · 1736 unmodified lines
17371737 #define BNXT_STATE_FW_FATAL_COND 6
17381738 #define BNXT_STATE_DRV_REGISTERED 7
17391739
1740+#define BNXT_NO_FW_ACCESS(bp) \
1741+ (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \
1742+ pci_channel_offline((bp)->pdev))
1743+
17401744 struct bnxt_irq *irq_tbl;
17411745 int total_irqs;
17421746 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
13221322 struct bnxt *bp = netdev_priv(dev);
13231323 int reg_len;
13241324
1325+ if (!BNXT_PF(bp))
1326+ return -EOPNOTSUPP;
1327+
13251328 reg_len = BNXT_PXP_REG_LEN;
13261329
13271330 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
17881791 if (!BNXT_PHY_CFG_ABLE(bp))
17891792 return -EOPNOTSUPP;
17901793
1794+ mutex_lock(&bp->link_lock);
17911795 if (epause->autoneg) {
1792− if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))
1793− return -EINVAL;
1796+ if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
1797+ rc = -EINVAL;
1798+ goto pause_exit;
1799+ }
17941800
17951801 link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
17961802 if (bp->hwrm_spec_code >= 0x10201)
@@ -1811,11 +1817,11 @@ static int bnxt_set_pauseparam(struct net_device *dev, · 14 unmodified lines
18111817 if (epause->tx_pause)
18121818 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
18131819
1814− if (netif_running(dev)) {
1815− mutex_lock(&bp->link_lock);
1820+ if (netif_running(dev))
18161821 rc = bnxt_hwrm_set_pause(bp);
1817− mutex_unlock(&bp->link_lock);
1818− }
1822+
1823+pause_exit:
1824+ mutex_unlock(&bp->link_lock);
18191825 return rc;
18201826 }
18211827
@@ -2552,8 +2558,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 730 unmodified lines
25522558 struct bnxt *bp = netdev_priv(dev);
25532559 struct ethtool_eee *eee = &bp->eee;
25542560 struct bnxt_link_info *link_info = &bp->link_info;
2555− u32 advertising =
2556− _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
2561+ u32 advertising;
25572562 int rc = 0;
25582563
25592564 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
25622567 if (!(bp->flags & BNXT_FLAG_EEE_CAP))
25632568 return -EOPNOTSUPP;
25642569
2570+ mutex_lock(&bp->link_lock);
2571+ advertising = _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
25652572 if (!edata->eee_enabled)
25662573 goto eee_ok;
25672574
25682575 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
25692576 netdev_warn(dev, "EEE requires autoneg\n");
2570− return -EINVAL;
2577+ rc = -EINVAL;
2578+ goto eee_exit;
25712579 }
25722580 if (edata->tx_lpi_enabled) {
25732581 if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||
25742582 edata->tx_lpi_timer < bp->lpi_tmr_lo)) {
25752583 netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",
25762584 bp->lpi_tmr_lo, bp->lpi_tmr_hi);
2577− return -EINVAL;
2585+ rc = -EINVAL;
2586+ goto eee_exit;
25782587 } else if (!bp->lpi_tmr_hi) {
25792588 edata->tx_lpi_timer = eee->tx_lpi_timer;
25802589 }
@@ -2584,7 +2593,8 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 3 unmodified lines
25842593 } else if (edata->advertised & ~advertising) {
25852594 netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
25862595 edata->advertised, advertising);
2587− return -EINVAL;
2596+ rc = -EINVAL;
2597+ goto eee_exit;
25882598 }
25892599
25902600 eee->advertised = edata->advertised;
@@ -2596,6 +2606,8 @@ eee_ok: · 5 unmodified lines
25962606 if (netif_running(dev))
25972607 rc = bnxt_hwrm_set_link_setting(bp, false, true);
25982608
2609+eee_exit:
2610+ mutex_unlock(&bp->link_lock);
25992611 return rc;
26002612 }
26012613
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
647647 ctrl |= GEM_BIT(GBE);
648648 }
649649
650− /* We do not support MLO_PAUSE_RX yet */
651− if (tx_pause)
650+ if (rx_pause)
652651 ctrl |= MACB_BIT(PAE);
653652
654653 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
19111911 static int configure_filter_tcb(struct adapter *adap, unsigned int tid,
19121912 struct filter_entry *f)
19131913 {
1914− if (f->fs.hitcnts)
1914+ if (f->fs.hitcnts) {
19151915 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,
19171920 TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M),
1918− TCB_TIMESTAMP_V(0ULL) |
19191921 TCB_RTT_TS_RECENT_AGE_V(0ULL),
19201922 1);
1923+ }
19211924
19221925 if (f->fs.newdmac)
19231926 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
229229 {
230230 struct mps_entries_ref *mps_entry, *tmp;
231231
232− if (!list_empty(&adap->mps_ref))
232+ if (list_empty(&adap->mps_ref))
233233 return;
234234
235235 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
8585 #define DSL CONFIG_DE2104X_DSL
8686 #endif
8787
88−#define DE_RX_RING_SIZE 64
88+#define DE_RX_RING_SIZE 128
8989 #define DE_TX_RING_SIZE 64
9090 #define DE_RING_BYTES \
9191 ((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
6666 };
6767
6868 struct dpmac_rsp_get_counter {
69− u64 pad;
70− u64 counter;
69+ __le64 pad;
70+ __le64 counter;
7171 };
7272
7373 #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
10531053
10541054 err_reg_netdev:
10551055 enetc_teardown_serdes(priv);
1056− enetc_mdio_remove(pf);
10571056 enetc_free_msix(priv);
10581057 err_alloc_msix:
10591058 enetc_free_si_resources(priv);
@@ -1061,6 +1060,7 @@ err_alloc_si_res: · 1 unmodified line
10611060 si->ndev = NULL;
10621061 free_netdev(ndev);
10631062 err_alloc_netdev:
1063+ enetc_mdio_remove(pf);
10641064 enetc_of_put_phy(pf);
10651065 err_map_pf_space:
10661066 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
334334 * bit6-11 for ppe0-5
335335 * bit12-17 for roce0-5
336336 * bit18-19 for com/dfx
337− * @enable: false - request reset , true - drop reset
337+ * @dereset: false - request reset , true - drop reset
338338 */
339339 static void
340340 hns_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
357357 * bit6-11 for ppe0-5
358358 * bit12-17 for roce0-5
359359 * bit18-19 for com/dfx
360− * @enable: false - request reset , true - drop reset
360+ * @dereset: false - request reset , true - drop reset
361361 */
362362 static void
363363 hns_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
463463
464464 /**
465465 * nic_run_loopback_test - run loopback test
466− * @nic_dev: net device
467− * @loopback_type: loopback type
466+ * @ndev: net device
467+ * @loop_mode: loopback mode
468468 */
469469 static int __lb_run_test(struct net_device *ndev,
470470 enum hnae_loop loop_mode)
@@ -572,7 +572,7 @@ static int __lb_down(struct net_device *ndev, enum hnae_loop loop) · 101 unmodified lines
572572
573573 /**
574574 * hns_nic_self_test - self test
575− * @dev: net device
575+ * @ndev: net device
576576 * @eth_test: test cmd
577577 * @data: test result
578578 */
@@ -633,7 +633,7 @@ static void hns_nic_self_test(struct net_device *ndev, · 54 unmodified lines
633633
634634 /**
635635 * hns_nic_get_drvinfo - get net driver info
636− * @dev: net device
636+ * @net_dev: net device
637637 * @drvinfo: driver info
638638 */
639639 static 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
658658
659659 /**
660660 * hns_get_ringparam - get ring parameter
661− * @dev: net device
661+ * @net_dev: net device
662662 * @param: ethtool parameter
663663 */
664664 static 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
683683
684684 /**
685685 * hns_get_pauseparam - get pause parameter
686− * @dev: net device
686+ * @net_dev: net device
687687 * @param: pause parameter
688688 */
689689 static 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
701701
702702 /**
703703 * hns_set_pauseparam - set pause parameter
704− * @dev: net device
704+ * @net_dev: net device
705705 * @param: pause parameter
706706 *
707707 * Return 0 on success, negative on failure
@@ -725,7 +725,7 @@ static int hns_set_pauseparam(struct net_device *net_dev, · 17 unmodified lines
725725
726726 /**
727727 * hns_get_coalesce - get coalesce info.
728− * @dev: net device
728+ * @net_dev: net device
729729 * @ec: coalesce info.
730730 *
731731 * Return 0 on success, negative on failure.
@@ -769,7 +769,7 @@ static int hns_get_coalesce(struct net_device *net_dev, · 37 unmodified lines
769769
770770 /**
771771 * hns_set_coalesce - set coalesce info.
772− * @dev: net device
772+ * @net_dev: net device
773773 * @ec: coalesce info.
774774 *
775775 * Return 0 on success, negative on failure.
@@ -808,7 +808,7 @@ static int hns_set_coalesce(struct net_device *net_dev, · 32 unmodified lines
808808
809809 /**
810810 * hns_get_channels - get channel info.
811− * @dev: net device
811+ * @net_dev: net device
812812 * @ch: channel info.
813813 */
814814 static void
@@ -825,7 +825,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch) · 10 unmodified lines
825825
826826 /**
827827 * get_ethtool_stats - get detail statistics.
828− * @dev: net device
828+ * @netdev: net device
829829 * @stats: statistics info.
830830 * @data: statistics data.
831831 */
@@ -883,8 +883,8 @@ static void hns_get_ethtool_stats(struct net_device *netdev, · 51 unmodified lines
883883
884884 /**
885885 * get_strings: Return a set of strings that describe the requested objects
886− * @dev: net device
887− * @stats: string set ID.
886+ * @netdev: net device
887+ * @stringset: string set ID.
888888 * @data: objects data.
889889 */
890890 static 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
972972
973973 /**
974974 * nic_get_sset_count - get string set count witch returned by nic_get_strings.
975− * @dev: net device
975+ * @netdev: net device
976976 * @stringset: string set index, 0: self test string; 1: statistics string.
977977 *
978978 * Return string set count.
@@ -1006,7 +1006,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset) · 27 unmodified lines
10061006
10071007 /**
10081008 * hns_phy_led_set - set phy LED status.
1009− * @dev: net device
1009+ * @netdev: net device
10101010 * @value: LED state.
10111011 *
10121012 * 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
10281028
10291029 /**
10301030 * nic_set_phys_id - set phy identify LED.
1031− * @dev: net device
1031+ * @netdev: net device
10321032 * @state: LED state.
10331033 *
10341034 * 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
11041104
11051105 /**
11061106 * hns_get_regs - get net device register
1107− * @dev: net device
1107+ * @net_dev: net device
11081108 * @cmd: ethtool cmd
1109− * @date: register data
1109+ * @data: register data
11101110 */
11111111 static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
11121112 void *data)
@@ -1126,7 +1126,7 @@ static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd, · 13 unmodified lines
11261126
11271127 /**
11281128 * nic_get_regs_len - get total register len.
1129− * @dev: net device
1129+ * @net_dev: net device
11301130 *
11311131 * Return total register len.
11321132 */
@@ -1151,7 +1151,7 @@ static int hns_get_regs_len(struct net_device *net_dev) · 18 unmodified lines
11511151
11521152 /**
11531153 * hns_nic_nway_reset - nway reset
1154− * @dev: net device
1154+ * @netdev: net device
11551155 *
11561156 * Return 0 on success, negative on failure
11571157 */
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
16541654 }
16551655
16561656 netif_carrier_off(netdev);
1657+ netif_tx_disable(netdev);
16571658
16581659 err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
16591660 &test_index);
@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev, · 2 unmodified lines
16621663 data[test_index] = 1;
16631664 }
16641665
1666+ netif_tx_wake_all_queues(netdev);
1667+
16651668 err = hinic_port_link_state(nic_dev, &link_state);
16661669 if (!err && link_state == HINIC_LINK_STATE_UP)
16671670 netif_carrier_on(netdev);
1671+
16681672 }
16691673
16701674 static 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
4747
4848 #define MGMT_MSG_TIMEOUT 5000
4949
50+#define SET_FUNC_PORT_MBOX_TIMEOUT 30000
51+
5052 #define SET_FUNC_PORT_MGMT_TIMEOUT 25000
5153
54+#define UPDATE_FW_MGMT_TIMEOUT 20000
55+
5256 #define mgmt_to_pfhwdev(pf_mgmt) \
5357 container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
5458
@@ -361,16 +365,22 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, · 306 unmodified lines
361365 return -EINVAL;
362366 }
363367
364− if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
365− timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
368+ if (HINIC_IS_VF(hwif)) {
369+ if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
370+ timeout = SET_FUNC_PORT_MBOX_TIMEOUT;
366371
367− if (HINIC_IS_VF(hwif))
368372 return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,
369− in_size, buf_out, out_size, 0);
370− else
373+ in_size, buf_out, out_size, timeout);
374+ } 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+
371380 return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
372381 buf_out, out_size, MGMT_DIRECT_SEND,
373382 MSG_NOT_RESP, timeout);
383+ }
374384 }
375385
376386 static 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
174174 return err;
175175 }
176176
177+static 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+
186+static 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+
177195 /**
178196 * free_txqs - Free the Logical Tx Queues of specific NIC device
179197 * @nic_dev: the specific NIC device
@@ -400,6 +418,8 @@ int hinic_open(struct net_device *netdev) · 220 unmodified lines
400418 goto err_create_txqs;
401419 }
402420
421+ enable_txqs_napi(nic_dev);
422+
403423 err = create_rxqs(nic_dev);
404424 if (err) {
405425 netif_err(nic_dev, drv, netdev,
@@ -484,6 +504,7 @@ err_port_state: · 78 unmodified lines
484504 }
485505
486506 err_create_rxqs:
507+ disable_txqs_napi(nic_dev);
487508 free_txqs(nic_dev);
488509
489510 err_create_txqs:
@@ -497,6 +518,9 @@ int hinic_close(struct net_device *netdev) · 7 unmodified lines
497518 struct hinic_dev *nic_dev = netdev_priv(netdev);
498519 unsigned int flags;
499520
521+ /* Disable txq napi firstly to aviod rewaking txq in free_tx_poll */
522+ disable_txqs_napi(nic_dev);
523+
500524 down(&nic_dev->mgmt_lock);
501525
502526 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
543543 if (err) {
544544 netif_err(nic_dev, drv, rxq->netdev,
545545 "Failed to set RX interrupt coalescing attribute\n");
546− rx_del_napi(rxq);
547− return err;
546+ goto err_req_irq;
548547 }
549548
550549 err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq);
551− if (err) {
552− rx_del_napi(rxq);
553− return err;
554− }
550+ if (err)
551+ goto err_req_irq;
555552
556553 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+
560+err_irq_affinity:
561+ free_irq(rq->irq, rxq);
562+err_req_irq:
563+ rx_del_napi(rxq);
564+ return err;
558565 }
559566
560567 static 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
717717 netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
718718
719719 __netif_tx_lock(netdev_txq, smp_processor_id());
720−
721− netif_wake_subqueue(nic_dev->netdev, qp->q_id);
720+ if (!netif_testing(nic_dev->netdev))
721+ netif_wake_subqueue(nic_dev->netdev, qp->q_id);
722722
723723 __netif_tx_unlock(netdev_txq);
724724
@@ -745,18 +745,6 @@ static int free_tx_poll(struct napi_struct *napi, int budget) · 20 unmodified lines
745745 return budget;
746746 }
747747
748−static 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−
754−static void tx_napi_del(struct hinic_txq *txq)
755−{
756− napi_disable(&txq->napi);
757− netif_napi_del(&txq->napi);
758−}
759−
760748 static irqreturn_t tx_irq(int irq, void *data)
761749 {
762750 struct hinic_txq *txq = data;
@@ -790,7 +778,7 @@ static int tx_request_irq(struct hinic_txq *txq) · 27 unmodified lines
790778
791779 qp = container_of(sq, struct hinic_qp, sq);
792780
793− tx_napi_add(txq, nic_dev->tx_weight);
781+ netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, nic_dev->tx_weight);
794782
795783 hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry,
796784 TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC,
@@ -807,14 +795,14 @@ static int tx_request_irq(struct hinic_txq *txq) · 10 unmodified lines
807795 if (err) {
808796 netif_err(nic_dev, drv, txq->netdev,
809797 "Failed to set TX interrupt coalescing attribute\n");
810− tx_napi_del(txq);
798+ netif_napi_del(&txq->napi);
811799 return err;
812800 }
813801
814802 err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq);
815803 if (err) {
816804 dev_err(&pdev->dev, "Failed to request Tx irq\n");
817− tx_napi_del(txq);
805+ netif_napi_del(&txq->napi);
818806 return err;
819807 }
820808
@@ -826,7 +814,7 @@ static void tx_free_irq(struct hinic_txq *txq) · 5 unmodified lines
826814 struct hinic_sq *sq = txq->sq;
827815
828816 free_irq(sq->irq, txq);
829− tx_napi_del(txq);
817+ netif_napi_del(&txq->napi);
830818 }
831819
832820 /**
drivers/net/ethernet/ibm/ibmvnic.c+4−2
@@ -2032,16 +2032,18 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 2031 unmodified lines
20322032
20332033 } else {
20342034 rc = reset_tx_pools(adapter);
2035− if (rc)
2035+ if (rc) {
20362036 netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",
20372037 rc);
20382038 goto out;
2039+ }
20392040
20402041 rc = reset_rx_pools(adapter);
2041− if (rc)
2042+ if (rc) {
20422043 netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",
20432044 rc);
20442045 goto out;
2046+ }
20452047 }
20462048 ibmvnic_disable_irqs(adapter);
20472049 }
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
11151115 static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
11161116 {
11171117 struct i40e_mac_filter *f;
1118− int num_vlans = 0, bkt;
1118+ u16 num_vlans = 0, bkt;
11191119
11201120 hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {
11211121 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
11341134 *
11351135 * Called to get number of VLANs and VLAN list present in mac_filter_hash.
11361136 **/
1137−static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,
1138− s16 **vlan_list)
1137+static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans,
1138+ s16 **vlan_list)
11391139 {
11401140 struct i40e_mac_filter *f;
11411141 int i = 0;
@@ -1169,11 +1169,11 @@ err: · 27 unmodified lines
11691169 **/
11701170 static i40e_status
11711171 i40e_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)
11731173 {
1174+ i40e_status aq_ret, aq_tmp = 0;
11741175 struct i40e_pf *pf = vf->pf;
11751176 struct i40e_hw *hw = &pf->hw;
1176− i40e_status aq_ret;
11771177 int i;
11781178
11791179 /* 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
12221222 vf->vf_id,
12231223 i40e_stat_str(&pf->hw, aq_ret),
12241224 i40e_aq_str(&pf->hw, aq_err));
1225+
1226+ if (!aq_tmp)
1227+ aq_tmp = aq_ret;
12251228 }
12261229
12271230 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
12351238 vf->vf_id,
12361239 i40e_stat_str(&pf->hw, aq_ret),
12371240 i40e_aq_str(&pf->hw, aq_err));
1241+
1242+ if (!aq_tmp)
1243+ aq_tmp = aq_ret;
12381244 }
12391245 }
1246+
1247+ if (aq_tmp)
1248+ aq_ret = aq_tmp;
1249+
12401250 return aq_ret;
12411251 }
12421252
@@ -1258,7 +1268,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, · 15 unmodified lines
12581268 i40e_status aq_ret = I40E_SUCCESS;
12591269 struct i40e_pf *pf = vf->pf;
12601270 struct i40e_vsi *vsi;
1261− int num_vlans;
1271+ u16 num_vlans;
12621272 s16 *vl;
12631273
12641274 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
299299 #define IGC_RX_HDR_LEN IGC_RXBUFFER_256
300300
301301 /* Transmit and receive latency (for PTP timestamps) */
302−/* FIXME: These values were estimated using the ones that i225 has as
303− * basis, they seem to provide good numbers with ptp4l/phc2sys, but we
304− * need to confirm them.
305− */
306−#define IGC_I225_TX_LATENCY_10 9542
307−#define IGC_I225_TX_LATENCY_100 1024
308−#define IGC_I225_TX_LATENCY_1000 178
309−#define IGC_I225_TX_LATENCY_2500 64
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
302+#define IGC_I225_TX_LATENCY_10 240
303+#define IGC_I225_TX_LATENCY_100 58
304+#define IGC_I225_TX_LATENCY_1000 80
305+#define IGC_I225_TX_LATENCY_2500 1325
306+#define IGC_I225_RX_LATENCY_10 6450
307+#define IGC_I225_RX_LATENCY_100 185
308+#define IGC_I225_RX_LATENCY_1000 300
309+#define IGC_I225_RX_LATENCY_2500 1485
314310
315311 /* RX and TX descriptor control thresholds.
316312 * 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
364364 struct sk_buff *skb = adapter->ptp_tx_skb;
365365 struct skb_shared_hwtstamps shhwtstamps;
366366 struct igc_hw *hw = &adapter->hw;
367+ int adjust = 0;
367368 u64 regval;
368369
369370 if (WARN_ON_ONCE(!skb))
@@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) · 3 unmodified lines
373374 regval |= (u64)rd32(IGC_TXSTMPH) << 32;
374375 igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
375376
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+
376395 /* Clear the lock early before calling skb_tstamp_tx so that
377396 * applications are not woken up before the lock bit is clear. We use
378397 * 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
230230 }
231231
232232 if (rx < budget) {
233− napi_complete(&ch->napi);
234− ltq_dma_enable_irq(&ch->dma);
233+ if (napi_complete_done(&ch->napi, rx))
234+ ltq_dma_enable_irq(&ch->dma);
235235 }
236236
237237 return rx;
@@ -268,9 +268,12 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) · 30 unmodified lines
268268 net_dev->stats.tx_bytes += bytes;
269269 netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
270270
271+ if (netif_queue_stopped(net_dev))
272+ netif_wake_queue(net_dev);
273+
271274 if (pkts < budget) {
272− napi_complete(&ch->napi);
273− ltq_dma_enable_irq(&ch->dma);
275+ if (napi_complete_done(&ch->napi, pkts))
276+ ltq_dma_enable_irq(&ch->dma);
274277 }
275278
276279 return pkts;
@@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) · 65 unmodified lines
342345 {
343346 struct xrx200_chan *ch = ptr;
344347
345− ltq_dma_disable_irq(&ch->dma);
346− ltq_dma_ack_irq(&ch->dma);
348+ if (napi_schedule_prep(&ch->napi)) {
349+ __napi_schedule(&ch->napi);
350+ ltq_dma_disable_irq(&ch->dma);
351+ }
347352
348− napi_schedule(&ch->napi);
353+ ltq_dma_ack_irq(&ch->dma);
349354
350355 return IRQ_HANDLED;
351356 }
@@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev) · 147 unmodified lines
499504
500505 /* setup NAPI */
501506 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);
503508
504509 platform_set_drvdata(pdev, priv);
505510
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
20292029 struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
20302030 int i;
20312031
2032− page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
2033− sync_len, napi);
20342032 for (i = 0; i < sinfo->nr_frags; i++)
20352033 page_pool_put_full_page(rxq->page_pool,
20362034 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);
20372037 }
20382038
20392039 static int
@@ -2383,8 +2383,12 @@ static int mvneta_rx_swbm(struct napi_struct *napi, · 343 unmodified lines
23832383 mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,
23842384 &size, page, &ps);
23852385 } 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);
23872390 continue;
2391+ }
23882392
23892393 mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf,
23902394 &size, page);
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−2
@@ -600,7 +600,7 @@ struct mlx5e_rq { · 599 unmodified lines
600600 struct dim dim; /* Dynamic Interrupt Moderation */
601601
602602 /* XDP */
603− struct bpf_prog *xdp_prog;
603+ struct bpf_prog __rcu *xdp_prog;
604604 struct mlx5e_xdpsq *xdpsq;
605605 DECLARE_BITMAP(flags, 8);
606606 struct page_pool *page_pool;
@@ -1005,7 +1005,6 @@ int mlx5e_update_nic_rx(struct mlx5e_priv *priv); · 398 unmodified lines
10051005 void mlx5e_update_carrier(struct mlx5e_priv *priv);
10061006 int mlx5e_close(struct net_device *netdev);
10071007 int mlx5e_open(struct net_device *netdev);
1008−void mlx5e_update_ndo_stats(struct mlx5e_priv *priv);
10091008
10101009 void mlx5e_queue_update_stats(struct mlx5e_priv *priv);
10111010 int 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
5151 monitor_counters_work);
5252
5353 mutex_lock(&priv->state_lock);
54− mlx5e_update_ndo_stats(priv);
54+ mlx5e_stats_update_ndo_stats(priv);
5555 mutex_unlock(&priv->state_lock);
5656 mlx5e_monitor_counter_arm(priv);
5757 }
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
490490 int err;
491491 int i;
492492
493− if (!MLX5_CAP_GEN(dev, pcam_reg))
494− return -EOPNOTSUPP;
495−
496− if (!MLX5_CAP_PCAM_REG(dev, pplm))
497− return -EOPNOTSUPP;
493+ if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm))
494+ return false;
498495
499496 MLX5_SET(pplm_reg, in, local_port, 1);
500497 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
699699 err_rule:
700700 mlx5e_mod_hdr_detach(ct_priv->esw->dev,
701701 &esw->offloads.mod_hdr, zone_rule->mh);
702+ mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id);
702703 err_mod_hdr:
703704 kfree(spec);
704705 return err;
@@ -958,12 +959,22 @@ mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv, · 253 unmodified lines
958959 return 0;
959960 }
960961
962+void 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+
961972 int
962−mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
963− struct mlx5_flow_spec *spec,
964− struct flow_cls_offload *f,
965− struct mlx5_ct_attr *ct_attr,
966− struct netlink_ext_ack *extack)
973+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
974+ struct mlx5_flow_spec *spec,
975+ struct flow_cls_offload *f,
976+ struct mlx5_ct_attr *ct_attr,
977+ struct netlink_ext_ack *extack)
967978 {
968979 struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
969980 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
8787 void
8888 mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv);
8989
90+void
91+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr);
92+
9093 int
91−mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
92− struct mlx5_flow_spec *spec,
93− struct flow_cls_offload *f,
94− struct mlx5_ct_attr *ct_attr,
95− struct netlink_ext_ack *extack);
94+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
95+ struct mlx5_flow_spec *spec,
96+ struct flow_cls_offload *f,
97+ struct mlx5_ct_attr *ct_attr,
98+ struct netlink_ext_ack *extack);
9699 int
97100 mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
98101 struct mlx5_flow_spec *spec);
@@ -130,12 +133,15 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv) · 31 unmodified lines
130133 {
131134 }
132135
136+static inline void
137+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) {}
138+
133139 static inline int
134−mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
135− struct mlx5_flow_spec *spec,
136− struct flow_cls_offload *f,
137− struct mlx5_ct_attr *ct_attr,
138− struct netlink_ext_ack *extack)
140+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
141+ struct mlx5_flow_spec *spec,
142+ struct flow_cls_offload *f,
143+ struct mlx5_ct_attr *ct_attr,
144+ struct netlink_ext_ack *extack)
139145 {
140146 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
141147
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+5−0
@@ -20,6 +20,11 @@ enum mlx5e_icosq_wqe_type { · 19 unmodified lines
2020 };
2121
2222 /* General */
23+static 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+
2328 void mlx5e_trigger_irq(struct mlx5e_icosq *sq);
2429 void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);
2530 void 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
122122 bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
123123 u32 *len, struct xdp_buff *xdp)
124124 {
125− struct bpf_prog *prog = READ_ONCE(rq->xdp_prog);
125+ struct bpf_prog *prog = rcu_dereference(rq->xdp_prog);
126126 u32 act;
127127 int err;
128128
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
3131 {
3232 struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk;
3333 u32 cqe_bcnt32 = cqe_bcnt;
34− bool consumed;
3534
3635 /* Check packet size. Note LRO doesn't use linear SKB */
3736 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
5150 xsk_buff_dma_sync_for_cpu(xdp);
5251 prefetch(xdp->data);
5352
54− rcu_read_lock();
55− consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp);
56− rcu_read_unlock();
57−
5853 /* Possible flows:
5954 * - XDP_REDIRECT to XSKMAP:
6055 * 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
7065 * allocated first from the Reuse Ring, so it has enough space.
7166 */
7267
73− if (likely(consumed)) {
68+ if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp))) {
7469 if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))
7570 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
7671 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
8883 u32 cqe_bcnt)
8984 {
9085 struct xdp_buff *xdp = wi->di->xsk;
91− bool consumed;
9286
9387 /* wi->offset is not used in this function, because xdp->data and the
9488 * 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
107101 return NULL;
108102 }
109103
110− rcu_read_lock();
111− consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp);
112− rcu_read_unlock();
113−
114− if (likely(consumed))
104+ if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp)))
115105 return NULL; /* page/packet was consumed by XDP */
116106
117107 /* 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
106106 void mlx5e_close_xsk(struct mlx5e_channel *c)
107107 {
108108 clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
109− napi_synchronize(&c->napi);
110− synchronize_rcu(); /* Sync with the XSK wakeup. */
109+ synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */
111110
112111 mlx5e_close_rq(&c->xskrq);
113112 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
234234
235235 /* Re-sync */
236236 /* Runs in work context */
237−static struct mlx5_wqe_ctrl_seg *
237+static int
238238 resync_post_get_progress_params(struct mlx5e_icosq *sq,
239239 struct mlx5e_ktls_offload_context_rx *priv_rx)
240240 {
@@ -258,15 +258,19 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 17 unmodified lines
258258 PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
259259 if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {
260260 err = -ENOMEM;
261− goto err_out;
261+ goto err_free;
262262 }
263263
264264 buf->priv_rx = priv_rx;
265265
266266 BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
267+
268+ spin_lock(&sq->channel->async_icosq_lock);
269+
267270 if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
271+ spin_unlock(&sq->channel->async_icosq_lock);
268272 err = -ENOSPC;
269− goto err_out;
273+ goto err_dma_unmap;
270274 }
271275
272276 pi = mlx5e_icosq_get_next_pi(sq, 1);
@@ -294,12 +298,18 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, · 21 unmodified lines
294298 };
295299 icosq_fill_wi(sq, pi, &wi);
296300 sq->pc++;
301+ mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
302+ spin_unlock(&sq->channel->async_icosq_lock);
297303
298− return cseg;
304+ return 0;
299305
306+err_dma_unmap:
307+ dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
308+err_free:
309+ kfree(buf);
300310 err_out:
301311 priv_rx->stats->tls_resync_req_skip++;
302− return ERR_PTR(err);
312+ return err;
303313 }
304314
305315 /* Function is called with elevated refcount.
@@ -309,10 +319,8 @@ static void resync_handle_work(struct work_struct *work) · 3 unmodified lines
309319 {
310320 struct mlx5e_ktls_offload_context_rx *priv_rx;
311321 struct mlx5e_ktls_rx_resync_ctx *resync;
312− struct mlx5_wqe_ctrl_seg *cseg;
313322 struct mlx5e_channel *c;
314323 struct mlx5e_icosq *sq;
315− struct mlx5_wq_cyc *wq;
316324
317325 resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work);
318326 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
324332
325333 c = resync->priv->channels.c[priv_rx->rxq];
326334 sq = &c->async_icosq;
327− wq = &sq->wq;
328−
329− spin_lock(&c->async_icosq_lock);
330335
331− cseg = resync_post_get_progress_params(sq, priv_rx);
332− if (IS_ERR(cseg)) {
336+ if (resync_post_get_progress_params(sq, priv_rx))
333337 refcount_dec(&resync->refcnt);
334− goto unlock;
335− }
336− mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg);
337−unlock:
338− spin_unlock(&c->async_icosq_lock);
339338 }
340339
341340 static 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
386385 struct mlx5e_ktls_offload_context_rx *priv_rx;
387386 struct mlx5e_ktls_rx_resync_ctx *resync;
388387 u8 tracker_state, auth_state, *ctx;
388+ struct device *dev;
389389 u32 hw_seq;
390390
391391 priv_rx = buf->priv_rx;
392392 resync = &priv_rx->resync;
393−
393+ dev = resync->priv->mdev->device;
394394 if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags)))
395395 goto out;
396396
397− dma_sync_single_for_cpu(resync->priv->mdev->device, buf->dma_addr,
398− PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
397+ dma_sync_single_for_cpu(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE,
398+ DMA_FROM_DEVICE);
399399
400400 ctx = buf->progress.ctx;
401401 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
411411 priv_rx->stats->tls_resync_req_end++;
412412 out:
413413 refcount_dec(&resync->refcnt);
414+ dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
414415 kfree(buf);
415416 }
416417
@@ -659,7 +660,7 @@ void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx) · 242 unmodified lines
659660 priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx);
660661 set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags);
661662 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 */
663664 if (!cancel_work_sync(&priv_rx->rule.work))
664665 /* completion is needed, as the priv_rx in the add flow
665666 * 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
3535 #include <net/sock.h>
3636
3737 #include "en.h"
38−#include "accel/tls.h"
3938 #include "fpga/sdk.h"
4039 #include "en_accel/tls.h"
4140
@@ -51,9 +50,14 @@ static const struct counter_desc mlx5e_tls_sw_stats_desc[] = { · 9 unmodified lines
5150
5251 #define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc)
5352
53+static bool is_tls_atomic_stats(struct mlx5e_priv *priv)
54+{
55+ return priv->tls && !mlx5_accel_is_ktls_device(priv->mdev);
56+}
57+
5458 int mlx5e_tls_get_count(struct mlx5e_priv *priv)
5559 {
56− if (!priv->tls)
60+ if (!is_tls_atomic_stats(priv))
5761 return 0;
5862
5963 return NUM_TLS_SW_COUNTERS;
@@ -63,7 +67,7 @@ int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data) · 3 unmodified lines
6367 {
6468 unsigned int i, idx = 0;
6569
66− if (!priv->tls)
70+ if (!is_tls_atomic_stats(priv))
6771 return 0;
6872
6973 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
7781 {
7882 int i, idx = 0;
7983
80− if (!priv->tls)
84+ if (!is_tls_atomic_stats(priv))
8185 return 0;
8286
8387 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
158158 mutex_unlock(&priv->state_lock);
159159 }
160160
161−void 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−
171161 static void mlx5e_update_stats_work(struct work_struct *work)
172162 {
173163 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
399389
400390 if (params->xdp_prog)
401391 bpf_prog_inc(params->xdp_prog);
402− rq->xdp_prog = params->xdp_prog;
392+ RCU_INIT_POINTER(rq->xdp_prog, params->xdp_prog);
403393
404394 rq_xdp_ix = rq->ix;
405395 if (xsk)
@@ -408,7 +398,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 2 unmodified lines
408398 if (err < 0)
409399 goto err_rq_wq_destroy;
410400
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;
412402 rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk);
413403 pool_size = 1 << params->log_rq_mtu_frames;
414404
@@ -564,8 +554,8 @@ err_free: · 149 unmodified lines
564554 }
565555
566556 err_rq_wq_destroy:
567− if (rq->xdp_prog)
568− bpf_prog_put(rq->xdp_prog);
557+ if (params->xdp_prog)
558+ bpf_prog_put(params->xdp_prog);
569559 xdp_rxq_info_unreg(&rq->xdp_rxq);
570560 page_pool_destroy(rq->page_pool);
571561 mlx5_wq_destroy(&rq->wq_ctrl);
@@ -575,10 +565,16 @@ err_rq_wq_destroy: · 3 unmodified lines
575565
576566 static void mlx5e_free_rq(struct mlx5e_rq *rq)
577567 {
568+ struct mlx5e_channel *c = rq->channel;
569+ struct bpf_prog *old_prog = NULL;
578570 int i;
579571
580− if (rq->xdp_prog)
581− bpf_prog_put(rq->xdp_prog);
572+ /* drop_rq has neither channel nor 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);
582578
583579 switch (rq->wq_type) {
584580 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
@@ -867,7 +863,7 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq) · 282 unmodified lines
867863 void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
868864 {
869865 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. */
871867 }
872868
873869 void mlx5e_close_rq(struct mlx5e_rq *rq)
@@ -1312,12 +1308,10 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq) · 438 unmodified lines
13121308
13131309 static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)
13141310 {
1315− struct mlx5e_channel *c = sq->channel;
13161311 struct mlx5_wq_cyc *wq = &sq->wq;
13171312
13181313 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
1319− /* prevent netif_tx_wake_queue */
1320− napi_synchronize(&c->napi);
1314+ synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */
13211315
13221316 mlx5e_tx_disable_queue(sq->txq);
13231317
@@ -1392,10 +1386,8 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq) · 68 unmodified lines
13921386
13931387 void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
13941388 {
1395− struct mlx5e_channel *c = icosq->channel;
1396−
13971389 clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);
1398− napi_synchronize(&c->napi);
1390+ synchronize_rcu(); /* Sync with NAPI. */
13991391 }
14001392
14011393 void mlx5e_close_icosq(struct mlx5e_icosq *sq)
@@ -1474,7 +1466,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq) · 72 unmodified lines
14741466 struct mlx5e_channel *c = sq->channel;
14751467
14761468 clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
1477− napi_synchronize(&c->napi);
1469+ synchronize_rcu(); /* Sync with NAPI. */
14781470
14791471 mlx5e_destroy_sq(c->mdev, sq->sqn);
14801472 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
35673559
35683560 s->rx_packets += rq_stats->packets + xskrq_stats->packets;
35693561 s->rx_bytes += rq_stats->bytes + xskrq_stats->bytes;
3562+ s->multicast += rq_stats->mcast_packets + xskrq_stats->mcast_packets;
35703563
35713564 for (j = 0; j < priv->max_opened_tc; j++) {
35723565 struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
@@ -3582,7 +3575,6 @@ void · 9 unmodified lines
35823575 mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
35833576 {
35843577 struct mlx5e_priv *priv = netdev_priv(dev);
3585− struct mlx5e_vport_stats *vstats = &priv->stats.vport;
35863578 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
35873579
35883580 /* 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
36173609 stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
36183610 stats->rx_frame_errors;
36193611 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);
36263612 }
36273613
36283614 static 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
43304316 return 0;
43314317 }
43324318
4319+static 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+
43334329 static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
43344330 {
43354331 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
43884384 */
43894385 for (i = 0; i < priv->channels.num; i++) {
43904386 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− }
44084387
4409− set_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
4410− if (xsk_open)
4411− set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
4412− /* napi_schedule in case we have missed anything */
4413− napi_schedule(&c->napi);
4388+ mlx5e_rq_replace_xdp_prog(&c->rq, prog);
4389+ if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
4390+ mlx5e_rq_replace_xdp_prog(&c->xskrq, prog);
44144391 }
44154392
44164393 unlock:
@@ -5200,7 +5177,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { · 783 unmodified lines
52005177 .enable = mlx5e_nic_enable,
52015178 .disable = mlx5e_nic_disable,
52025179 .update_rx = mlx5e_update_nic_rx,
5203− .update_stats = mlx5e_update_ndo_stats,
5180+ .update_stats = mlx5e_stats_update_ndo_stats,
52045181 .update_carrier = mlx5e_update_carrier,
52055182 .rx_handlers = &mlx5e_rx_handlers_nic,
52065183 .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
11711171 .cleanup_tx = mlx5e_cleanup_rep_tx,
11721172 .enable = mlx5e_rep_enable,
11731173 .update_rx = mlx5e_update_rep_rx,
1174− .update_stats = mlx5e_update_ndo_stats,
1174+ .update_stats = mlx5e_stats_update_ndo_stats,
11751175 .rx_handlers = &mlx5e_rx_handlers_rep,
11761176 .max_tc = 1,
11771177 .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR),
@@ -1189,7 +1189,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { · 11 unmodified lines
11891189 .enable = mlx5e_uplink_rep_enable,
11901190 .disable = mlx5e_uplink_rep_disable,
11911191 .update_rx = mlx5e_update_rep_rx,
1192− .update_stats = mlx5e_update_ndo_stats,
1192+ .update_stats = mlx5e_stats_update_ndo_stats,
11931193 .update_carrier = mlx5e_update_carrier,
11941194 .rx_handlers = &mlx5e_rx_handlers_rep,
11951195 .max_tc = MLX5E_MAX_NUM_TC,
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+6−10
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include "en/xsk/rx.h"
5454 #include "en/health.h"
5555 #include "en/params.h"
56+#include "en/txrx.h"
5657
5758 static struct sk_buff *
5859 mlx5e_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
10801081 mlx5e_enable_ecn(rq, skb);
10811082
10821083 skb->protocol = eth_type_trans(skb, netdev);
1084+
1085+ if (unlikely(mlx5e_skb_is_multicast(skb)))
1086+ stats->mcast_packets++;
10831087 }
10841088
10851089 static 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
11321136 struct xdp_buff xdp;
11331137 struct sk_buff *skb;
11341138 void *va, *data;
1135− bool consumed;
11361139 u32 frag_size;
11371140
11381141 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
11441147 prefetchw(va); /* xdp_frame data area */
11451148 prefetch(data);
11461149
1147− rcu_read_lock();
11481150 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);
1149− consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp);
1150− rcu_read_unlock();
1151− if (consumed)
1151+ if (mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp))
11521152 return NULL; /* page/packet was consumed by XDP */
11531153
11541154 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
14381438 struct sk_buff *skb;
14391439 void *va, *data;
14401440 u32 frag_size;
1441− bool consumed;
14421441
14431442 /* Check packet size. Note LRO doesn't use linear SKB */
14441443 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
14551454 prefetchw(va); /* xdp_frame data area */
14561455 prefetch(data);
14571456
1458− rcu_read_lock();
14591457 mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
1460− consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp);
1461− rcu_read_unlock();
1462− if (consumed) {
1458+ if (mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp)) {
14631459 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))
14641460 __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
14651461 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
5454 return total;
5555 }
5656
57+void 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+
5769 void mlx5e_stats_update(struct mlx5e_priv *priv)
5870 {
5971 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
103103 void mlx5e_stats_update(struct mlx5e_priv *priv);
104104 void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);
105105 void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data);
106+void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv);
106107
107108 /* Concrete NIC Stats */
108109
@@ -119,6 +120,7 @@ struct mlx5e_sw_stats { · 10 unmodified lines
119120 u64 tx_nop;
120121 u64 rx_lro_packets;
121122 u64 rx_lro_bytes;
123+ u64 rx_mcast_packets;
122124 u64 rx_ecn_mark;
123125 u64 rx_removed_vlan_packets;
124126 u64 rx_csum_unnecessary;
@@ -298,6 +300,7 @@ struct mlx5e_rq_stats { · 173 unmodified lines
298300 u64 csum_none;
299301 u64 lro_packets;
300302 u64 lro_bytes;
303+ u64 mcast_packets;
301304 u64 ecn_mark;
302305 u64 removed_vlan_packets;
303306 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
12901290
12911291 mlx5e_put_flow_tunnel_id(flow);
12921292
1293− if (flow_flag_test(flow, NOT_READY)) {
1293+ if (flow_flag_test(flow, NOT_READY))
12941294 remove_unready_flow(flow);
1295− kvfree(attr->parse_attr);
1296− return;
1297− }
12981295
12991296 if (mlx5e_is_offloaded_flow(flow)) {
13001297 if (flow_flag_test(flow, SLOW))
@@ -1315,6 +1312,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 14 unmodified lines
13151312 }
13161313 kvfree(attr->parse_attr);
13171314
1315+ mlx5_tc_ct_match_del(priv, &flow->esw_attr->ct_attr);
1316+
13181317 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
13191318 mlx5e_detach_mod_hdr(priv, flow);
13201319
@@ -2625,6 +2624,22 @@ static struct mlx5_fields fields[] = { · 1304 unmodified lines
26252624 OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest, 0, udp_dport),
26262625 };
26272626
2627+static 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+}
26282643 static int offload_pedit_fields(struct mlx5e_priv *priv,
26292644 int namespace,
26302645 struct pedit_headers_action *hdrs,
@@ -2638,9 +2653,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 7 unmodified lines
26382653 u32 *s_masks_p, *a_masks_p, s_mask, a_mask;
26392654 struct mlx5e_tc_mod_hdr_acts *mod_acts;
26402655 struct mlx5_fields *f;
2641− unsigned long mask;
2642− __be32 mask_be32;
2643− __be16 mask_be16;
2656+ unsigned long mask, field_mask;
26442657 int err;
26452658 u8 cmd;
26462659
@@ -2706,14 +2719,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, · 59 unmodified lines
27062719 if (skip)
27072720 continue;
27082721
2709− if (f->field_bsize == 32) {
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− }
2722+ mask = mask_to_le(mask, f->field_bsize);
27172723
27182724 first = find_first_bit(&mask, f->field_bsize);
27192725 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
27442750 if (cmd == MLX5_ACTION_TYPE_SET) {
27452751 int start;
27462752
2753+ field_mask = mask_to_le(f->field_mask, f->field_bsize);
2754+
27472755 /* if field is bit sized it can start not from first bit */
2748− start = find_first_bit((unsigned long *)&f->field_mask,
2749− f->field_bsize);
2756+ start = find_first_bit(&field_mask, f->field_bsize);
27502757
27512758 MLX5_SET(set_action_in, action, offset, first - start);
27522759 /* 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
44024409 goto err_free;
44034410
44044411 /* actions validation depends on parsing the ct matches first */
4405− err = mlx5_tc_ct_parse_match(priv, &parse_attr->spec, f,
4406− &flow->esw_attr->ct_attr, extack);
4412+ err = mlx5_tc_ct_match_add(priv, &parse_attr->spec, f,
4413+ &flow->esw_attr->ct_attr, extack);
44074414 if (err)
44084415 goto err_free;
44094416
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
121121 struct mlx5e_xdpsq *xsksq = &c->xsksq;
122122 struct mlx5e_rq *xskrq = &c->xskrq;
123123 struct mlx5e_rq *rq = &c->rq;
124− bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
125124 bool aff_change = false;
126125 bool busy_xsk = false;
127126 bool busy = false;
128127 int work_done = 0;
128+ bool xsk_open;
129129 int i;
130130
131+ rcu_read_lock();
132+
133+ xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
134+
131135 ch_stats->poll++;
132136
133137 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
167171 busy |= busy_xsk;
168172
169173 if (busy) {
170− if (likely(mlx5e_channel_no_affinity_change(c)))
171− return budget;
174+ if (likely(mlx5e_channel_no_affinity_change(c))) {
175+ work_done = budget;
176+ goto out;
177+ }
172178 ch_stats->aff_change++;
173179 aff_change = true;
174180 if (budget && work_done == budget)
@@ -176,7 +182,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 1 unmodified line
176182 }
177183
178184 if (unlikely(!napi_complete_done(napi, work_done)))
179− return work_done;
185+ goto out;
180186
181187 ch_stats->arm++;
182188
@@ -203,6 +209,9 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 20 unmodified lines
203209 ch_stats->force_irq++;
204210 }
205211
212+out:
213+ rcu_read_unlock();
214+
206215 return work_done;
207216 }
208217
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
12191219 }
12201220 esw->fdb_table.offloads.send_to_vport_grp = g;
12211221
1222− /* create peer esw miss group */
1223− memset(flow_group_in, 0, inlen);
1222+ if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) {
1223+ /* create peer esw miss group */
1224+ memset(flow_group_in, 0, inlen);
12241225
1225− esw_set_flow_group_source_port(esw, flow_group_in);
1226+ esw_set_flow_group_source_port(esw, flow_group_in);
12261227
1227− if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
1228− match_criteria = MLX5_ADDR_OF(create_flow_group_in,
1229− flow_group_in,
1230− match_criteria);
1228+ if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
1229+ match_criteria = MLX5_ADDR_OF(create_flow_group_in,
1230+ flow_group_in,
1231+ match_criteria);
12311232
1232− MLX5_SET_TO_ONES(fte_match_param, match_criteria,
1233− misc_parameters.source_eswitch_owner_vhca_id);
1233+ MLX5_SET_TO_ONES(fte_match_param, match_criteria,
1234+ misc_parameters.source_eswitch_owner_vhca_id);
12341235
1235− MLX5_SET(create_flow_group_in, flow_group_in,
1236− source_eswitch_owner_vhca_id_valid, 1);
1237− }
1236+ MLX5_SET(create_flow_group_in, flow_group_in,
1237+ source_eswitch_owner_vhca_id_valid, 1);
1238+ }
12381239
1239− 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− ix + esw->total_vports - 1);
1242− ix += esw->total_vports;
1240+ MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
1241+ MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
1242+ ix + esw->total_vports - 1);
1243+ ix += esw->total_vports;
12431244
1244− g = mlx5_create_flow_group(fdb, flow_group_in);
1245− if (IS_ERR(g)) {
1246− err = PTR_ERR(g);
1247− esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
1248− goto peer_miss_err;
1245+ g = mlx5_create_flow_group(fdb, flow_group_in);
1246+ if (IS_ERR(g)) {
1247+ err = PTR_ERR(g);
1248+ esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
1249+ goto peer_miss_err;
1250+ }
1251+ esw->fdb_table.offloads.peer_miss_grp = g;
12491252 }
1250− esw->fdb_table.offloads.peer_miss_grp = g;
12511253
12521254 /* create miss group */
12531255 memset(flow_group_in, 0, inlen);
@@ -1281,7 +1283,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw) · 27 unmodified lines
12811283 miss_rule_err:
12821284 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
12831285 miss_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);
12851288 peer_miss_err:
12861289 mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
12871290 send_vport_err:
@@ -1305,7 +1308,8 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw) · 17 unmodified lines
13051308 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi);
13061309 mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni);
13071310 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);
13091313 mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
13101314
13111315 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
654654 fte->action = *flow_act;
655655 fte->flow_context = spec->flow_context;
656656
657− tree_init_node(&fte->node, NULL, del_sw_fte);
657+ tree_init_node(&fte->node, del_hw_fte, del_sw_fte);
658658
659659 return fte;
660660 }
@@ -1792,7 +1792,6 @@ skip_search: · 1131 unmodified lines
17921792 up_write_ref_node(&g->node, false);
17931793 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
17941794 up_write_ref_node(&fte->node, false);
1795− tree_put_node(&fte->node, false);
17961795 return rule;
17971796 }
17981797 rule = ERR_PTR(-ENOENT);
@@ -1891,7 +1890,6 @@ search_again_locked: · 92 unmodified lines
18911890 up_write_ref_node(&g->node, false);
18921891 rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
18931892 up_write_ref_node(&fte->node, false);
1894− tree_put_node(&fte->node, false);
18951893 tree_put_node(&g->node, false);
18961894 return rule;
18971895
@@ -2001,7 +1999,9 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 103 unmodified lines
20011999 up_write_ref_node(&fte->node, false);
20022000 } else {
20032001 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);
20052005 tree_put_node(&fte->node, false);
20062006 }
20072007 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
421421
422422 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
423423 ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
424+ spin_lock(&ocelot_port->ts_id_lock);
425+
424426 shinfo->tx_flags |= SKBTX_IN_PROGRESS;
425427 /* 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;
427430 skb_queue_tail(&ocelot_port->tx_skbs, skb);
431+
432+ spin_unlock(&ocelot_port->ts_id_lock);
428433 return 0;
429434 }
430435 return -ENODATA;
@@ -1300,6 +1305,7 @@ void ocelot_init_port(struct ocelot *ocelot, int port) · 869 unmodified lines
13001305 struct ocelot_port *ocelot_port = ocelot->ports[port];
13011306
13021307 skb_queue_head_init(&ocelot_port->tx_skbs);
1308+ spin_lock_init(&ocelot_port->ts_id_lock);
13031309
13041310 /* Basic L2 initialization */
13051311
@@ -1544,18 +1550,18 @@ EXPORT_SYMBOL(ocelot_init); · 238 unmodified lines
15441550
15451551 void ocelot_deinit(struct ocelot *ocelot)
15461552 {
1547− struct ocelot_port *port;
1548− int i;
1549−
15501553 cancel_delayed_work(&ocelot->stats_work);
15511554 destroy_workqueue(ocelot->stats_queue);
15521555 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− }
15581556 }
15591557 EXPORT_SYMBOL(ocelot_deinit);
15601558
1559+void 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+}
1565+EXPORT_SYMBOL(ocelot_deinit_port);
1566+
15611567 MODULE_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
330330 u8 grp = 0; /* Send everything on CPU group 0 */
331331 unsigned int i, count, last;
332332 int port = priv->chip_port;
333+ bool do_tstamp;
333334
334335 val = ocelot_read(ocelot, QS_INJ_STATUS);
335336 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
344345 info.vid = skb_vlan_tag_get(skb);
345346
346347 /* Check if timestamping is needed */
348+ do_tstamp = (ocelot_port_add_txtstamp_skb(ocelot_port, skb) == 0);
349+
347350 if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) {
348351 info.rew_op = ocelot_port->ptp_cmd;
349352 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;
351354 }
352355
353356 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
380383 dev->stats.tx_packets++;
381384 dev->stats.tx_bytes += skb->len;
382385
383− if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) {
384− ocelot_port->ts_id++;
385− return NETDEV_TX_OK;
386− }
386+ if (!do_tstamp)
387+ dev_kfree_skb_any(skb);
387388
388− dev_kfree_skb_any(skb);
389389 return NETDEV_TX_OK;
390390 }
391391
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
806806 [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1},
807807 /* IP4_TCP_UDP (TYPE=100) */
808808 [VCAP_IS2_HK_TCP] = {124, 1},
809− [VCAP_IS2_HK_L4_SPORT] = {125, 16},
810− [VCAP_IS2_HK_L4_DPORT] = {141, 16},
809+ [VCAP_IS2_HK_L4_DPORT] = {125, 16},
810+ [VCAP_IS2_HK_L4_SPORT] = {141, 16},
811811 [VCAP_IS2_HK_L4_RNG] = {157, 8},
812812 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1},
813813 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1},
814− [VCAP_IS2_HK_L4_URG] = {167, 1},
815− [VCAP_IS2_HK_L4_ACK] = {168, 1},
816− [VCAP_IS2_HK_L4_PSH] = {169, 1},
817− [VCAP_IS2_HK_L4_RST] = {170, 1},
818− [VCAP_IS2_HK_L4_SYN] = {171, 1},
819− [VCAP_IS2_HK_L4_FIN] = {172, 1},
814+ [VCAP_IS2_HK_L4_FIN] = {167, 1},
815+ [VCAP_IS2_HK_L4_SYN] = {168, 1},
816+ [VCAP_IS2_HK_L4_RST] = {169, 1},
817+ [VCAP_IS2_HK_L4_PSH] = {170, 1},
818+ [VCAP_IS2_HK_L4_ACK] = {171, 1},
819+ [VCAP_IS2_HK_L4_URG] = {172, 1},
820820 [VCAP_IS2_HK_L4_1588_DOM] = {173, 8},
821821 [VCAP_IS2_HK_L4_1588_VER] = {181, 4},
822822 /* IP4_OTHER (TYPE=101) */
@@ -896,11 +896,137 @@ static struct ptp_clock_info ocelot_ptp_clock_info = { · 73 unmodified lines
896896 .enable = ocelot_ptp_enable,
897897 };
898898
899+static 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+
921+static 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+
8991025 static int mscc_ocelot_probe(struct platform_device *pdev)
9001026 {
9011027 struct device_node *np = pdev->dev.of_node;
902− struct device_node *ports, *portnp;
9031028 int err, irq_xtr, irq_ptp_rdy;
1029+ struct device_node *ports;
9041030 struct ocelot *ocelot;
9051031 struct regmap *hsio;
9061032 unsigned int i;
@@ -985,20 +1111,24 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 78 unmodified lines
9851111
9861112 ports = of_get_child_by_name(np, "ethernet-ports");
9871113 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");
9891115 return -ENODEV;
9901116 }
9911117
9921118 ocelot->num_phys_ports = of_get_child_count(ports);
9931119
994− ocelot->ports = devm_kcalloc(&pdev->dev, ocelot->num_phys_ports,
995− sizeof(struct ocelot_port *), GFP_KERNEL);
996−
9971120 ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys;
9981121 ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;
9991122 ocelot->vcap = vsc7514_vcap_props;
10001123
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+
10021132 if (ocelot->ptp) {
10031133 err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
10041134 if (err) {
@@ -1008,96 +1138,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 3 unmodified lines
10081138 }
10091139 }
10101140
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−
11011141 register_netdevice_notifier(&ocelot_netdevice_nb);
11021142 register_switchdev_notifier(&ocelot_switchdev_nb);
11031143 register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
@@ -1114,6 +1154,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev) · 10 unmodified lines
11141154 struct ocelot *ocelot = platform_get_drvdata(pdev);
11151155
11161156 ocelot_deinit_timestamp(ocelot);
1157+ mscc_ocelot_release_ports(ocelot);
11171158 ocelot_deinit(ocelot);
11181159 unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
11191160 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
829829 struct nfp_eth_table_port *eth_port;
830830 struct nfp_port *port;
831831
832− param->active_fec = ETHTOOL_FEC_NONE_BIT;
833− param->fec = ETHTOOL_FEC_NONE_BIT;
832+ param->active_fec = ETHTOOL_FEC_NONE;
833+ param->fec = ETHTOOL_FEC_NONE;
834834
835835 port = nfp_port_from_netdev(netdev);
836836 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
42534253 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
42544254 BIT(QED_MF_LLH_PROTO_CLSS) |
42554255 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);
42574258 break;
42584259 case NVM_CFG1_GLOB_MF_MODE_DEFAULT:
42594260 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
42664267
42674268 DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
42684269 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);
42694278 }
42704279
42714280 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
19801980 struct qed_ptt *p_ptt,
19811981 struct qed_arfs_config_params *p_cfg_params)
19821982 {
1983+ if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits))
1984+ return;
1985+
19831986 if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) {
19841987 qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,
19851988 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
444444 dev_info->fw_eng = FW_ENGINEERING_VERSION;
445445 dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH,
446446 &cdev->mf_bits);
447+ if (!test_bit(QED_MF_DISABLE_ARFS, &cdev->mf_bits))
448+ dev_info->b_arfs_capable = true;
447449 dev_info->tx_switching = true;
448450
449451 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
7171 p_ramrod->personality = PERSONALITY_ETH;
7272 break;
7373 case QED_PCI_ETH_ROCE:
74+ case QED_PCI_ETH_IWARP:
7475 p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
7576 break;
7677 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
311311 {
312312 int i;
313313
314+ if (!edev->dev_info.common.b_arfs_capable)
315+ return -EINVAL;
316+
314317 edev->arfs = vzalloc(sizeof(*edev->arfs));
315318 if (!edev->arfs)
316319 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
804804 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
805805 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC;
806806
807− if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1)
807+ if (edev->dev_info.common.b_arfs_capable)
808808 hw_features |= NETIF_F_NTUPLE;
809809
810810 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
22742274 qede_vlan_mark_nonconfigured(edev);
22752275 edev->ops->fastpath_stop(edev->cdev);
22762276
2277− if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
2277+ if (edev->dev_info.common.b_arfs_capable) {
22782278 qede_poll_for_freeing_arfs_filters(edev);
22792279 qede_free_arfs(edev);
22802280 }
@@ -2341,10 +2341,9 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, · 60 unmodified lines
23412341 if (rc)
23422342 goto err2;
23432343
2344− if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
2345− rc = qede_alloc_arfs(edev);
2346− if (rc)
2347− DP_NOTICE(edev, "aRFS memory allocation failed\n");
2344+ if (qede_alloc_arfs(edev)) {
2345+ edev->ndev->features &= ~NETIF_F_NTUPLE;
2346+ edev->dev_info.common.b_arfs_capable = false;
23482347 }
23492348
23502349 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
490490 if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) {
491491 netif_err(efx, probe, efx->net_dev,
492492 "Func control window overruns BAR\n");
493+ rc = -EIO;
493494 goto fail;
494495 }
495496
drivers/net/ethernet/ti/cpsw_new.c+53−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/phy.h>
1818 #include <linux/phy/phy.h>
1919 #include <linux/delay.h>
20+#include <linux/pinctrl/consumer.h>
2021 #include <linux/pm_runtime.h>
2122 #include <linux/gpio/consumer.h>
2223 #include <linux/of.h>
@@ -2070,9 +2071,61 @@ static int cpsw_remove(struct platform_device *pdev) · 2047 unmodified lines
20702071 return 0;
20712072 }
20722073
2074+static 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+
2098+static 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+
2123+static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
2124+
20732125 static struct platform_driver cpsw_driver = {
20742126 .driver = {
20752127 .name = "cpsw-switch",
2128+ .pm = &cpsw_pm_ops,
20762129 .of_match_table = cpsw_of_mtable,
20772130 },
20782131 .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
777777 struct net_device *dev,
778778 struct geneve_sock *gs4,
779779 struct flowi4 *fl4,
780− const struct ip_tunnel_info *info)
780+ const struct ip_tunnel_info *info,
781+ __be16 dport, __be16 sport)
781782 {
782783 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
783784 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
793794 fl4->flowi4_proto = IPPROTO_UDP;
794795 fl4->daddr = info->key.u.ipv4.dst;
795796 fl4->saddr = info->key.u.ipv4.src;
797+ fl4->fl4_dport = dport;
798+ fl4->fl4_sport = sport;
796799
797800 tos = info->key.tos;
798801 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
827830 struct net_device *dev,
828831 struct geneve_sock *gs6,
829832 struct flowi6 *fl6,
830− const struct ip_tunnel_info *info)
833+ const struct ip_tunnel_info *info,
834+ __be16 dport, __be16 sport)
831835 {
832836 bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
833837 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
843847 fl6->flowi6_proto = IPPROTO_UDP;
844848 fl6->daddr = info->key.u.ipv6.dst;
845849 fl6->saddr = info->key.u.ipv6.src;
850+ fl6->fl6_dport = dport;
851+ fl6->fl6_sport = sport;
852+
846853 prio = info->key.tos;
847854 if ((prio == 1) && !geneve->cfg.collect_md) {
848855 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
889896 __be16 sport;
890897 int err;
891898
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);
893902 if (IS_ERR(rt))
894903 return PTR_ERR(rt);
895904
@@ -919,7 +928,6 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 23 unmodified lines
919928 return -EMSGSIZE;
920929 }
921930
922− sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
923931 if (geneve->cfg.collect_md) {
924932 tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
925933 ttl = key->ttl;
@@ -974,7 +982,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 48 unmodified lines
974982 __be16 sport;
975983 int err;
976984
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);
978988 if (IS_ERR(dst))
979989 return PTR_ERR(dst);
980990
@@ -1003,7 +1013,6 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 22 unmodified lines
10031013 return -EMSGSIZE;
10041014 }
10051015
1006− sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
10071016 if (geneve->cfg.collect_md) {
10081017 prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
10091018 ttl = key->ttl;
@@ -1085,13 +1094,18 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 75 unmodified lines
10851094 {
10861095 struct ip_tunnel_info *info = skb_tunnel_info(skb);
10871096 struct geneve_dev *geneve = netdev_priv(dev);
1097+ __be16 sport;
10881098
10891099 if (ip_tunnel_info_af(info) == AF_INET) {
10901100 struct rtable *rt;
10911101 struct flowi4 fl4;
1102+
10921103 struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);
1104+ sport = udp_flow_src_port(geneve->net, skb,
1105+ 1, USHRT_MAX, true);
10931106
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);
10951109 if (IS_ERR(rt))
10961110 return PTR_ERR(rt);
10971111
@@ -1101,9 +1115,13 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 3 unmodified lines
11011115 } else if (ip_tunnel_info_af(info) == AF_INET6) {
11021116 struct dst_entry *dst;
11031117 struct flowi6 fl6;
1118+
11041119 struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);
1120+ sport = udp_flow_src_port(geneve->net, skb,
1121+ 1, USHRT_MAX, true);
11051122
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);
11071125 if (IS_ERR(dst))
11081126 return PTR_ERR(dst);
11091127
@@ -1114,8 +1132,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 4 unmodified lines
11141132 return -EINVAL;
11151133 }
11161134
1117− info->key.tp_src = udp_flow_src_port(geneve->net, skb,
1118− 1, USHRT_MAX, true);
1135+ info->key.tp_src = sport;
11191136 info->key.tp_dst = geneve->cfg.info.key.tp_dst;
11201137 return 0;
11211138 }
drivers/net/hyperv/hyperv_net.h+7−0
@@ -847,6 +847,10 @@ struct nvsp_message { · 846 unmodified lines
847847
848848 #define NETVSC_XDP_HDRM 256
849849
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+
850854 struct multi_send_data {
851855 struct sk_buff *skb; /* skb containing the pkt */
852856 struct hv_netvsc_packet *pkt; /* netvsc pkt pending */
@@ -974,6 +978,9 @@ struct net_device_context { · 121 unmodified lines
974978 /* Serial number of the VF to team with */
975979 u32 vf_serial;
976980
981+ /* Is the current data path through the VF NIC? */
982+ bool data_path_is_vf;
983+
977984 /* Used to temporarily save the config info across hibernation */
978985 struct netvsc_device_info *saved_netvsc_dev_info;
979986 };
drivers/net/hyperv/netvsc.c+111−13
@@ -388,6 +388,15 @@ static int netvsc_init_buf(struct hv_device *device, · 387 unmodified lines
388388 net_device->recv_section_size = resp->sections[0].sub_alloc_size;
389389 net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;
390390
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+
391400 /* Setup receive completion ring.
392401 * Add 1 to the recv_section_cnt because at least one entry in a
393402 * ring buffer has to be empty.
@@ -460,6 +469,12 @@ static int netvsc_init_buf(struct hv_device *device, · 66 unmodified lines
460469 /* Parse the response */
461470 net_device->send_section_size = init_packet->msg.
462471 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+ }
463478
464479 /* Section count is simply the size divided by the section size. */
465480 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
731746 int budget)
732747 {
733748 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+ }
734756
735757 switch (nvsp_packet->hdr.msg_type) {
736758 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+
737767 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+
738776 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+
739785 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+ }
740792 /* Copy the response back */
741793 memcpy(&net_device->channel_init_pkt, nvsp_packet,
742794 sizeof(struct nvsp_message));
@@ -1117,19 +1169,28 @@ static void enq_receive_complete(struct net_device *ndev, · 374 unmodified lines
11171169 static int netvsc_receive(struct net_device *ndev,
11181170 struct netvsc_device *net_device,
11191171 struct netvsc_channel *nvchan,
1120− const struct vmpacket_descriptor *desc,
1121− const struct nvsp_message *nvsp)
1172+ const struct vmpacket_descriptor *desc)
11221173 {
11231174 struct net_device_context *net_device_ctx = netdev_priv(ndev);
11241175 struct vmbus_channel *channel = nvchan->channel;
11251176 const struct vmtransfer_page_packet_header *vmxferpage_packet
11261177 = 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);
11271180 u16 q_idx = channel->offermsg.offer.sub_channel_index;
11281181 char *recv_buf = net_device->recv_buf;
11291182 u32 status = NVSP_STAT_SUCCESS;
11301183 int i;
11311184 int count = 0;
11321185
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+
11331194 /* Make sure this is a valid nvsp packet */
11341195 if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) {
11351196 netif_err(net_device_ctx, rx_err, ndev,
@@ -1138,6 +1199,14 @@ static int netvsc_receive(struct net_device *ndev, · 2 unmodified lines
11381199 return 0;
11391200 }
11401201
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+
11411210 if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) {
11421211 netif_err(net_device_ctx, rx_err, ndev,
11431212 "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
11481217
11491218 count = vmxferpage_packet->range_cnt;
11501219
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+
11511228 /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
11521229 for (i = 0; i < count; i++) {
11531230 u32 offset = vmxferpage_packet->ranges[i].byte_offset;
@@ -1155,7 +1232,8 @@ static int netvsc_receive(struct net_device *ndev, · 1 unmodified line
11551232 void *data;
11561233 int ret;
11571234
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)) {
11591237 nvchan->rsc.cnt = 0;
11601238 status = NVSP_STAT_FAIL;
11611239 netif_err(net_device_ctx, rx_err, ndev,
@@ -1194,6 +1272,13 @@ static void netvsc_send_table(struct net_device *ndev, · 32 unmodified lines
11941272 u32 count, offset, *tab;
11951273 int i;
11961274
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+
11971282 count = nvmsg->msg.v5_msg.send_table.count;
11981283 offset = nvmsg->msg.v5_msg.send_table.offset;
11991284
@@ -1225,10 +1310,18 @@ static void netvsc_send_table(struct net_device *ndev, · 25 unmodified lines
12251310 }
12261311
12271312 static void netvsc_send_vf(struct net_device *ndev,
1228− const struct nvsp_message *nvmsg)
1313+ const struct nvsp_message *nvmsg,
1314+ u32 msglen)
12291315 {
12301316 struct net_device_context *net_device_ctx = netdev_priv(ndev);
12311317
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+
12321325 net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
12331326 net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
12341327 netdev_info(ndev, "VF slot %u %s\n",
@@ -1238,16 +1331,24 @@ static void netvsc_send_vf(struct net_device *ndev, · 3 unmodified lines
12381331
12391332 static void netvsc_receive_inband(struct net_device *ndev,
12401333 struct netvsc_device *nvscdev,
1241− const struct nvsp_message *nvmsg,
1242− u32 msglen)
1334+ const struct vmpacket_descriptor *desc)
12431335 {
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+
12441345 switch (nvmsg->hdr.msg_type) {
12451346 case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE:
12461347 netvsc_send_table(ndev, nvscdev, nvmsg, msglen);
12471348 break;
12481349
12491350 case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION:
1250− netvsc_send_vf(ndev, nvmsg);
1351+ netvsc_send_vf(ndev, nvmsg, msglen);
12511352 break;
12521353 }
12531354 }
@@ -1261,23 +1362,20 @@ static int netvsc_process_raw_pkt(struct hv_device *device, · 7 unmodified lines
12611362 {
12621363 struct vmbus_channel *channel = nvchan->channel;
12631364 const struct nvsp_message *nvmsg = hv_pkt_data(desc);
1264− u32 msglen = hv_pkt_datalen(desc);
12651365
12661366 trace_nvsp_recv(ndev, channel, nvmsg);
12671367
12681368 switch (desc->type) {
12691369 case VM_PKT_COMP:
1270− netvsc_send_completion(ndev, net_device, channel,
1271− desc, budget);
1370+ netvsc_send_completion(ndev, net_device, channel, desc, budget);
12721371 break;
12731372
12741373 case VM_PKT_DATA_USING_XFER_PAGES:
1275− return netvsc_receive(ndev, net_device, nvchan,
1276− desc, nvmsg);
1374+ return netvsc_receive(ndev, net_device, nvchan, desc);
12771375 break;
12781376
12791377 case VM_PKT_DATA_INBAND:
1280− netvsc_receive_inband(ndev, net_device, nvmsg, msglen);
1378+ netvsc_receive_inband(ndev, net_device, desc);
12811379 break;
12821380
12831381 default:
drivers/net/hyperv/netvsc_drv.c+29−6
@@ -748,6 +748,13 @@ void netvsc_linkstatus_callback(struct net_device *net, · 747 unmodified lines
748748 struct netvsc_reconfig *event;
749749 unsigned long flags;
750750
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+
751758 /* Update the physical link speed when changing to another vSwitch */
752759 if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {
753760 u32 speed;
@@ -2366,7 +2373,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 1612 unmodified lines
23662373 return NOTIFY_OK;
23672374 }
23682375
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+ */
23702386 static int netvsc_vf_changed(struct net_device *vf_netdev)
23712387 {
23722388 struct net_device_context *net_device_ctx;
@@ -2383,6 +2399,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev) · 10 unmodified lines
23832399 if (!netvsc_dev)
23842400 return NOTIFY_DONE;
23852401
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+
23862406 netvsc_switch_datapath(ndev, vf_is_up);
23872407 netdev_info(ndev, "Data path switched %s VF: %s\n",
23882408 vf_is_up ? "to" : "from", vf_netdev->name);
@@ -2587,8 +2607,8 @@ static int netvsc_remove(struct hv_device *dev) · 198 unmodified lines
25872607 static int netvsc_suspend(struct hv_device *dev)
25882608 {
25892609 struct net_device_context *ndev_ctx;
2590− struct net_device *vf_netdev, *net;
25912610 struct netvsc_device *nvdev;
2611+ struct net_device *net;
25922612 int ret;
25932613
25942614 net = hv_get_drvdata(dev);
@@ -2604,10 +2624,6 @@ static int netvsc_suspend(struct hv_device *dev) · 9 unmodified lines
26042624 goto out;
26052625 }
26062626
2607− vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
2608− if (vf_netdev)
2609− netvsc_unregister_vf(vf_netdev);
2610−
26112627 /* Save the current config info */
26122628 ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
26132629
@@ -2628,6 +2644,12 @@ static int netvsc_resume(struct hv_device *dev) · 14 unmodified lines
26282644 rtnl_lock();
26292645
26302646 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;
26312653 device_info = net_device_ctx->saved_netvsc_dev_info;
26322654
26332655 ret = netvsc_attach(net, device_info);
@@ -2695,6 +2717,7 @@ static int netvsc_netdev_event(struct notifier_block *this, · 61 unmodified lines
26952717 return netvsc_unregister_vf(event_dev);
26962718 case NETDEV_UP:
26972719 case NETDEV_DOWN:
2720+ case NETDEV_CHANGE:
26982721 return netvsc_vf_changed(event_dev);
26992722 default:
27002723 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
275275 return;
276276 }
277277
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+
278288 spin_lock_irqsave(&dev->request_lock, flags);
279289 list_for_each_entry(request, &dev->req_list, list_ent) {
280290 /*
@@ -331,8 +341,9 @@ static void rndis_filter_receive_response(struct net_device *ndev, · 50 unmodified lines
331341 * Get the Per-Packet-Info with the specified type
332342 * return NULL if not found.
333343 */
334−static inline void *rndis_get_ppi(struct rndis_packet *rpkt,
335− u32 type, u8 internal)
344+static inline void *rndis_get_ppi(struct net_device *ndev,
345+ struct rndis_packet *rpkt,
346+ u32 rpkt_len, u32 type, u8 internal)
336347 {
337348 struct rndis_per_packet_info *ppi;
338349 int len;
@@ -340,11 +351,36 @@ static inline void *rndis_get_ppi(struct rndis_packet *rpkt, · 1 unmodified line
340351 if (rpkt->per_pkt_info_offset == 0)
341352 return NULL;
342353
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+
343368 ppi = (struct rndis_per_packet_info *)((ulong)rpkt +
344369 rpkt->per_pkt_info_offset);
345370 len = rpkt->per_pkt_info_len;
346371
347372 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+
348384 if (ppi->type == type && ppi->internal == internal)
349385 return (void *)((ulong)ppi + ppi->ppi_offset);
350386 len -= ppi->size;
@@ -388,14 +424,29 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 37 unmodified lines
388424 const struct ndis_pkt_8021q_info *vlan;
389425 const struct rndis_pktinfo_id *pktinfo_id;
390426 const u32 *hash_info;
391− u32 data_offset;
427+ u32 data_offset, rpkt_len;
392428 void *data;
393429 bool rsc_more = false;
394430 int ret;
395431
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+
396446 /* Remove the rndis header and pass it back up the stack */
397447 data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
398448
449+ rpkt_len = data_buflen - RNDIS_HEADER_SIZE;
399450 data_buflen -= data_offset;
400451
401452 /*
@@ -410,13 +461,13 @@ static int rndis_filter_receive_data(struct net_device *ndev, · 8 unmodified lines
410461 return NVSP_STAT_FAIL;
411462 }
412463
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);
414465
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);
416467
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);
418469
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);
420471
421472 data = (void *)msg + data_offset;
422473
@@ -474,6 +525,14 @@ int rndis_filter_receive(struct net_device *ndev, · 51 unmodified lines
474525 if (netif_msg_rx_status(net_device_ctx))
475526 dump_rndis_message(ndev, rndis_msg);
476527
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+
477536 switch (rndis_msg->ndis_msg_type) {
478537 case RNDIS_MSG_PACKET:
479538 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
882882 int ret;
883883 u8 lqi, len_u8, *data;
884884
885− adf7242_read_reg(lp, 0, &len_u8);
885+ ret = adf7242_read_reg(lp, 0, &len_u8);
886+ if (ret)
887+ return ret;
886888
887889 len = len_u8;
888890
drivers/net/ieee802154/ca8210.c+1−0
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv) · 2924 unmodified lines
29252925 );
29262926 if (!priv->irq_workqueue) {
29272927 dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
2928+ destroy_workqueue(priv->mlme_workqueue);
29282929 return -ENOMEM;
29292930 }
29302931
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
521521 val = ioread32(endpoint->ipa->reg_virt + offset);
522522
523523 /* 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);
525525
526526 iowrite32(val, endpoint->ipa->reg_virt + offset);
527527 }
@@ -573,7 +573,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) · 45 unmodified lines
573573 val = ioread32(ipa->reg_virt + offset);
574574
575575 /* 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);
577577
578578 iowrite32(val, ipa->reg_virt + offset);
579579 }
drivers/net/phy/phy.c+1−1
@@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev) · 995 unmodified lines
996996 {
997997 struct net_device *dev = phydev->attached_dev;
998998
999− if (!phy_is_started(phydev)) {
999+ if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) {
10001000 WARN(1, "called from state %s\n",
10011001 phy_state_to_str(phydev->state));
10021002 return;
drivers/net/phy/phy_device.c+6−5
@@ -1143,10 +1143,6 @@ int phy_init_hw(struct phy_device *phydev) · 1142 unmodified lines
11431143 if (ret < 0)
11441144 return ret;
11451145
1146− ret = phy_disable_interrupts(phydev);
1147− if (ret)
1148− return ret;
1149−
11501146 if (phydev->drv->config_init)
11511147 ret = phydev->drv->config_init(phydev);
11521148
@@ -1423,6 +1419,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 270 unmodified lines
14231419 if (err)
14241420 goto error;
14251421
1422+ err = phy_disable_interrupts(phydev);
1423+ if (err)
1424+ return err;
1425+
14261426 phy_resume(phydev);
14271427 phy_led_triggers_register(phydev);
14281428
@@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev) · 253 unmodified lines
16821682
16831683 phy_led_triggers_unregister(phydev);
16841684
1685− module_put(phydev->mdio.dev.driver->owner);
1685+ if (phydev->mdio.dev.driver)
1686+ module_put(phydev->mdio.dev.driver->owner);
16861687
16871688 /* If the device had no specific driver before (i.e. - it
16881689 * 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
201201 dev_dbg(&info->control->dev,
202202 "rndis response error, code %d\n", retval);
203203 }
204− msleep(20);
204+ msleep(40);
205205 }
206206 dev_dbg(&info->control->dev, "rndis response timeout\n");
207207 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
118118 skb_put(skb, sizeof(struct cisco_packet));
119119 skb->priority = TC_PRIO_CONTROL;
120120 skb->dev = dev;
121+ skb->protocol = htons(ETH_P_HDLC);
121122 skb_reset_network_header(skb);
122123
123124 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
433433 if (pvc->state.fecn) /* TX Congestion counter */
434434 dev->stats.tx_compressed++;
435435 skb->dev = pvc->frad;
436+ skb->protocol = htons(ETH_P_HDLC);
437+ skb_reset_network_header(skb);
436438 dev_queue_xmit(skb);
437439 return NETDEV_TX_OK;
438440 }
@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) · 116 unmodified lines
555557 skb_put(skb, i);
556558 skb->priority = TC_PRIO_CONTROL;
557559 skb->dev = dev;
560+ skb->protocol = htons(ETH_P_HDLC);
558561 skb_reset_network_header(skb);
559562
560563 dev_queue_xmit(skb);
@@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev) · 480 unmodified lines
10411044 {
10421045 dev->type = ARPHRD_DLCI;
10431046 dev->flags = IFF_POINTOPOINT;
1044− dev->hard_header_len = 10;
1047+ dev->hard_header_len = 0;
10451048 dev->addr_len = 2;
10461049 netif_keep_dst(dev);
10471050 }
@@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 45 unmodified lines
10931096 dev->mtu = HDLC_MAX_MTU;
10941097 dev->min_mtu = 68;
10951098 dev->max_mtu = HDLC_MAX_MTU;
1099+ dev->needed_headroom = 10;
10961100 dev->priv_flags |= IFF_NO_QUEUE;
10971101 dev->ml_priv = pvc;
10981102
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
251251
252252 skb->priority = TC_PRIO_CONTROL;
253253 skb->dev = dev;
254+ skb->protocol = htons(ETH_P_HDLC);
254255 skb_reset_network_header(skb);
255256 skb_queue_tail(&tx_queue, skb);
256257 }
@@ -383,11 +384,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 126 unmodified lines
383384 }
384385
385386 for (opt = data; len; len -= opt[1], opt += opt[1]) {
386− if (len < 2 || len < opt[1]) {
387− dev->stats.rx_errors++;
388− kfree(out);
389− return; /* bad packet, drop silently */
390− }
387+ if (len < 2 || opt[1] < 2 || len < opt[1])
388+ goto err_out;
391389
392390 if (pid == PID_LCP)
393391 switch (opt[0]) {
@@ -395,6 +393,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 1 unmodified line
395393 continue; /* MRU always OK and > 1500 bytes? */
396394
397395 case LCP_OPTION_ACCM: /* async control character map */
396+ if (opt[1] < sizeof(valid_accm))
397+ goto err_out;
398398 if (!memcmp(opt, valid_accm,
399399 sizeof(valid_accm)))
400400 continue;
@@ -406,6 +406,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, · 5 unmodified lines
406406 }
407407 break;
408408 case LCP_OPTION_MAGIC:
409+ if (len < 6)
410+ goto err_out;
409411 if (opt[1] != 6 || (!opt[2] && !opt[3] &&
410412 !opt[4] && !opt[5]))
411413 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
424426 ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data);
425427
426428 kfree(out);
429+ return;
430+
431+err_out:
432+ dev->stats.rx_errors++;
433+ kfree(out);
427434 }
428435
429436 static 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
198198 struct net_device *dev;
199199 int size = skb->len;
200200
201− skb->protocol = htons(ETH_P_X25);
202−
203201 ptr = skb_push(skb, 2);
204202
205203 *ptr++ = size % 256;
@@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 4 unmodified lines
210208
211209 skb->dev = dev = lapbeth->ethdev;
212210
211+ skb->protocol = htons(ETH_P_DEC);
212+
213213 skb_reset_network_header(skb);
214214
215215 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
8787
8888 void wg_noise_handshake_clear(struct noise_handshake *handshake)
8989 {
90+ down_write(&handshake->lock);
9091 wg_index_hashtable_remove(
9192 handshake->entry.peer->device->index_hashtable,
9293 &handshake->entry);
93− down_write(&handshake->lock);
9494 handshake_zero(handshake);
9595 up_write(&handshake->lock);
96− wg_index_hashtable_remove(
97− handshake->entry.peer->device->index_hashtable,
98− &handshake->entry);
9996 }
10097
10198 static 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
167167 struct index_hashtable_entry *old,
168168 struct index_hashtable_entry *new)
169169 {
170− if (unlikely(hlist_unhashed(&old->index_hash)))
171− return false;
170+ bool ret;
171+
172172 spin_lock_bh(&table->lock);
173+ ret = !hlist_unhashed(&old->index_hash);
174+ if (unlikely(!ret))
175+ goto out;
176+
173177 new->index = old->index;
174178 hlist_replace_rcu(&old->index_hash, &new->index_hash);
175179
@@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, · 4 unmodified lines
180184 * simply gets dropped, which isn't terrible.
181185 */
182186 INIT_HLIST_NODE(&old->index_hash);
187+out:
183188 spin_unlock_bh(&table->lock);
184− return true;
189+ return ret;
185190 }
186191
187192 void 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
664664 /* To check if there's window offered */
665665 static bool data_ok(struct brcmf_sdio *bus)
666666 {
667− /* Reserve TXCTL_CREDITS credits for txctl */
668− return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS &&
669− ((bus->tx_max - bus->tx_seq) & 0x80) == 0;
667+ u8 tx_rsv = 0;
668+
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+
670676 }
671677
672678 /* 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
954954 struct mwifiex_aes_param {
955955 u8 pn[WPA_PN_SIZE];
956956 __le16 key_len;
957− u8 key[WLAN_KEY_LEN_CCMP];
957+ u8 key[WLAN_KEY_LEN_CCMP_256];
958958 } __packed;
959959
960960 struct 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
619619 key_v2 = &resp->params.key_material_v2;
620620
621621 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))
623623 return -EINVAL;
624624
625625 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
635635 return 0;
636636
637637 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));
639639 priv->aes_key_v2.key_param_set.key_params.aes.key_len =
640640 cpu_to_le16(len);
641641 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
21282128 sizeof(dev->mt76.hw->wiphy->fw_version),
21292129 "%.10s-%.15s", hdr->fw_ver, hdr->build_date);
21302130
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))) {
21322133 dev->fw_ver = MT7615_FIRMWARE_V2;
21332134 dev->mcu_ops = &sta_update_ops;
21342135 } 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
699699 spin_lock_bh(&dev->token_lock);
700700 idr_for_each_entry(&dev->token, txwi, id) {
701701 mt7915_txp_skb_unmap(&dev->mt76, txwi);
702− if (txwi->skb)
703− dev_kfree_skb_any(txwi->skb);
702+ if (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+ }
704708 mt76_put_txwi(&dev->mt76, txwi);
705709 }
706710 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
841841 if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK))
842842 mt7915_tx_status(sta, hw, info, NULL);
843843
844− dev_kfree_skb(skb);
844+ ieee80211_free_txskb(hw, skb);
845845 }
846846
847847 void 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
458458 KEY_TKIP = 2,
459459 KEY_AES = 3,
460460 KEY_GEM = 4,
461− KEY_IGTK = 5,
462461 };
463462
464463 struct 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
35593559 case WL1271_CIPHER_SUITE_GEM:
35603560 key_type = KEY_GEM;
35613561 break;
3562− case WLAN_CIPHER_SUITE_AES_CMAC:
3563− key_type = KEY_IGTK;
3564− break;
35653562 default:
35663563 wl1271_error("Unknown key algo 0x%x", key_conf->cipher);
35673564
@@ -6231,7 +6228,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) · 2663 unmodified lines
62316228 WLAN_CIPHER_SUITE_TKIP,
62326229 WLAN_CIPHER_SUITE_CCMP,
62336230 WL1271_CIPHER_SUITE_GEM,
6234− WLAN_CIPHER_SUITE_AES_CMAC,
62356231 };
62366232
62376233 /* 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
284284
285285 if (card->state == CARD_STATE_SOFTSETUP) {
286286 qeth_clear_ipacmd_list(card);
287− qeth_drain_output_queues(card);
288287 card->state = CARD_STATE_DOWN;
289288 }
290289
291290 qeth_qdio_clear_card(card, 0);
291+ qeth_drain_output_queues(card);
292292 qeth_clear_working_pool_list(card);
293293 flush_workqueue(card->event_wq);
294294 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
11681168 if (card->state == CARD_STATE_SOFTSETUP) {
11691169 qeth_l3_clear_ip_htable(card, 1);
11701170 qeth_clear_ipacmd_list(card);
1171− qeth_drain_output_queues(card);
11721171 card->state = CARD_STATE_DOWN;
11731172 }
11741173
11751174 qeth_qdio_clear_card(card, 0);
1175+ qeth_drain_output_queues(card);
11761176 qeth_clear_working_pool_list(card);
11771177 flush_workqueue(card->event_wq);
11781178 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
193193 #define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
194194 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
195195
196−/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
196+/* List of IP checksum features. Note that NETIF_F_HW_CSUM should not be
197197 * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
198198 * this would be contradictory
199199 */
include/linux/netdevice.h+2−0
@@ -1784,6 +1784,7 @@ enum netdev_priv_flags { · 1783 unmodified lines
17841784 * the watchdog (see dev_watchdog())
17851785 * @watchdog_timer: List of timers
17861786 *
1787+ * @proto_down_reason: reason a netdev interface is held down
17871788 * @pcpu_refcnt: Number of references to this device
17881789 * @todo_list: Delayed register/unregister
17891790 * @link_watch_list: XXX: need comments on this one
@@ -1848,6 +1849,7 @@ enum netdev_priv_flags { · 58 unmodified lines
18481849 * @udp_tunnel_nic_info: static structure describing the UDP tunnel
18491850 * offload capabilities of the device
18501851 * @udp_tunnel_nic: UDP tunnel offload state
1852+ * @xdp_state: stores info on attached XDP BPF programs
18511853 *
18521854 * FIXME: cleanup struct net_device such that network protocol info
18531855 * moves out.
include/linux/qed/qed_if.h+1−0
@@ -623,6 +623,7 @@ struct qed_dev_info { · 622 unmodified lines
623623 #define QED_MFW_VERSION_3_OFFSET 24
624624
625625 u32 flash_size;
626+ bool b_arfs_capable;
626627 bool b_inter_pf_switch;
627628 bool tx_switching;
628629 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
32233223 * is untouched. Otherwise it is extended. Returns zero on
32243224 * success. The skb is freed on error if @free_on_error is true.
32253225 */
3226−static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
3227− bool free_on_error)
3226+static inline int __must_check __skb_put_padto(struct sk_buff *skb,
3227+ unsigned int len,
3228+ bool free_on_error)
32283229 {
32293230 unsigned int size = skb->len;
32303231
@@ -3247,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len, · 16 unmodified lines
32473248 * is untouched. Otherwise it is extended. Returns zero on
32483249 * success. The skb is freed on error.
32493250 */
3250−static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
3251+static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len)
32513252 {
32523253 return __skb_put_padto(skb, len, true);
32533254 }
include/net/flow.h+1−0
@@ -116,6 +116,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, · 115 unmodified lines
116116 fl4->saddr = saddr;
117117 fl4->fl4_dport = dport;
118118 fl4->fl4_sport = sport;
119+ fl4->flowi4_multipath_hash = 0;
119120 }
120121
121122 /* 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
726726 * @hdrlen: length of family specific header
727727 * @tb: destination array with maxtype+1 elements
728728 * @maxtype: maximum attribute type to be expected
729− * @validate: validation strictness
730729 * @extack: extended ACK report struct
731730 *
732731 * See nla_parse()
@@ -824,7 +823,6 @@ static inline int nla_validate_deprecated(const struct nlattr *head, int len, · 91 unmodified lines
824823 * @len: length of attribute stream
825824 * @maxtype: maximum attribute type to be expected
826825 * @policy: validation policy
827− * @validate: validation strictness
828826 * @extack: extended ACK report struct
829827 *
830828 * 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
88 struct list_head tables;
99 struct list_head commit_list;
1010 struct list_head module_list;
11+ struct list_head notify_list;
1112 struct mutex commit_mutex;
1213 unsigned int base_seq;
1314 u8 gencursor;
include/net/sctp/structs.h+5−3
@@ -226,12 +226,14 @@ struct sctp_sock { · 225 unmodified lines
226226 data_ready_signalled:1;
227227
228228 atomic_t pd_mode;
229+
230+ /* Fields after this point will be skipped on copies, like on accept
231+ * and peeloff operations
232+ */
233+
229234 /* Receive to here while partial delivery is in effect. */
230235 struct sk_buff_head pd_lobby;
231236
232− /* These must be the last fields, as they will skipped on copies,
233− * like on accept and peeloff operations
234− */
235237 struct list_head auto_asconf_list;
236238 int do_auto_asconf;
237239 };
include/net/vxlan.h+3−0
@@ -121,6 +121,9 @@ struct vxlanhdr_gbp { · 120 unmodified lines
121121 #define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
122122 #define VXLAN_GBP_ID_MASK (0xFFFF)
123123
124+#define VXLAN_GBP_MASK (VXLAN_GBP_DONT_LEARN | VXLAN_GBP_POLICY_APPLIED | \
125+ VXLAN_GBP_ID_MASK)
126+
124127 /*
125128 * VXLAN Generic Protocol Extension (VXLAN_F_GPE):
126129 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
include/soc/mscc/ocelot.h+2−0
@@ -566,6 +566,7 @@ struct ocelot_port { · 565 unmodified lines
566566 u8 ptp_cmd;
567567 struct sk_buff_head tx_skbs;
568568 u8 ts_id;
569+ spinlock_t ts_id_lock;
569570
570571 phy_interface_t phy_mode;
571572
@@ -677,6 +678,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, · 105 unmodified lines
677678 int ocelot_init(struct ocelot *ocelot);
678679 void ocelot_deinit(struct ocelot *ocelot);
679680 void ocelot_init_port(struct ocelot *ocelot, int port);
681+void ocelot_deinit_port(struct ocelot *ocelot, int port);
680682
681683 /* DSA callbacks */
682684 void ocelot_port_enable(struct ocelot *ocelot, int port,
include/uapi/linux/ethtool_netlink.h+1−0
@@ -79,6 +79,7 @@ enum { · 78 unmodified lines
7979 ETHTOOL_MSG_TSINFO_GET_REPLY,
8080 ETHTOOL_MSG_CABLE_TEST_NTF,
8181 ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
82+ ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
8283
8384 /* add new constants above here */
8485 __ETHTOOL_MSG_KERNEL_CNT,
kernel/bpf/hashtab.c+4−11
@@ -1622,7 +1622,6 @@ struct bpf_iter_seq_hash_map_info { · 1621 unmodified lines
16221622 struct bpf_map *map;
16231623 struct bpf_htab *htab;
16241624 void *percpu_value_buf; // non-zero means percpu hash
1625− unsigned long flags;
16261625 u32 bucket_id;
16271626 u32 skip_elems;
16281627 };
@@ -1632,7 +1631,6 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 3 unmodified lines
16321631 struct htab_elem *prev_elem)
16331632 {
16341633 const struct bpf_htab *htab = info->htab;
1635− unsigned long flags = info->flags;
16361634 u32 skip_elems = info->skip_elems;
16371635 u32 bucket_id = info->bucket_id;
16381636 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
16561654
16571655 /* not found, unlock and go to the next bucket */
16581656 b = &htab->buckets[bucket_id++];
1659− htab_unlock_bucket(htab, b, flags);
1657+ rcu_read_unlock();
16601658 skip_elems = 0;
16611659 }
16621660
16631661 for (i = bucket_id; i < htab->n_buckets; i++) {
16641662 b = &htab->buckets[i];
1665− flags = htab_lock_bucket(htab, b);
1663+ rcu_read_lock();
16661664
16671665 count = 0;
16681666 head = &b->head;
16691667 hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) {
16701668 if (count >= skip_elems) {
1671− info->flags = flags;
16721669 info->bucket_id = i;
16731670 info->skip_elems = count;
16741671 return elem;
@@ -1676,7 +1673,7 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info, · 1 unmodified line
16761673 count++;
16771674 }
16781675
1679− htab_unlock_bucket(htab, b, flags);
1676+ rcu_read_unlock();
16801677 skip_elems = 0;
16811678 }
16821679
@@ -1754,14 +1751,10 @@ static int bpf_hash_map_seq_show(struct seq_file *seq, void *v) · 71 unmodified lines
17541751
17551752 static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v)
17561753 {
1757− struct bpf_iter_seq_hash_map_info *info = seq->private;
1758−
17591754 if (!v)
17601755 (void)__bpf_hash_map_seq_show(seq, NULL);
17611756 else
1762− htab_unlock_bucket(info->htab,
1763− &info->htab->buckets[info->bucket_id],
1764− info->flags);
1757+ rcu_read_unlock();
17651758 }
17661759
17671760 static 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
226226 else
227227 prev_key = key;
228228
229+ rcu_read_lock();
229230 if (map->ops->map_get_next_key(map, prev_key, key)) {
230231 map_iter(m)->done = true;
231− return NULL;
232+ key = NULL;
232233 }
234+ rcu_read_unlock();
233235 return key;
234236 }
235237
lib/test_rhashtable.c+1−1
@@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries) · 433 unmodified lines
434434 } else {
435435 if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d",
436436 err, -ENOENT))
437− continue;
437+ continue;
438438 }
439439 }
440440
net/batman-adv/bridge_loop_avoidance.c+117−28
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/lockdep.h>
2626 #include <linux/netdevice.h>
2727 #include <linux/netlink.h>
28+#include <linux/preempt.h>
2829 #include <linux/rculist.h>
2930 #include <linux/rcupdate.h>
3031 #include <linux/seq_file.h>
@@ -83,11 +84,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) · 52 unmodified lines
8384 */
8485 static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
8586 {
86− const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
87+ const struct batadv_bla_backbone_gw *gw;
8788 u32 hash = 0;
8889
89− hash = jhash(&claim->addr, sizeof(claim->addr), hash);
90− hash = jhash(&claim->vid, sizeof(claim->vid), hash);
90+ gw = (struct batadv_bla_backbone_gw *)data;
91+ hash = jhash(&gw->orig, sizeof(gw->orig), hash);
92+ hash = jhash(&gw->vid, sizeof(gw->vid), hash);
9193
9294 return hash % size;
9395 }
@@ -1579,13 +1581,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv) · 1485 unmodified lines
15791581 }
15801582
15811583 /**
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.
15831585 * @bat_priv: the bat priv with all the soft interface information
1584− * @skb: contains the bcast_packet to be checked
1586+ * @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
15851590 *
1586− * check if it is on our broadcast list. Another gateway might
1587− * have sent the same packet because it is connected to the same backbone,
1588− * so we have to remove this duplicate.
1591+ * Check if it is on our broadcast list. Another gateway might have sent the
1592+ * same packet because it is connected to the same backbone, so we have to
1593+ * remove this duplicate.
15891594 *
15901595 * This is performed by checking the CRC, which will tell us
15911596 * 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
15941599 *
15951600 * Return: true if a packet is in the duplicate list, false otherwise.
15961601 */
1597−bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
1598− struct sk_buff *skb)
1602+static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv,
1603+ struct sk_buff *skb, u8 *payload_ptr,
1604+ const u8 *orig)
15991605 {
1600− int i, curr;
1601− __be32 crc;
1602− struct batadv_bcast_packet *bcast_packet;
16031606 struct batadv_bcast_duplist_entry *entry;
16041607 bool ret = false;
1605−
1606− bcast_packet = (struct batadv_bcast_packet *)skb->data;
1608+ int i, curr;
1609+ __be32 crc;
16071610
16081611 /* calculate the crc ... */
1609− crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1));
1612+ crc = batadv_skb_crc32(skb, payload_ptr);
16101613
16111614 spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);
16121615
@@ -1625,8 +1628,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, · 12 unmodified lines
16251628 if (entry->crc != crc)
16261629 continue;
16271630
1628− if (batadv_compare_eth(entry->orig, bcast_packet->orig))
1629− continue;
1631+ /* are the originators both known and not anonymous? */
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+ }
16301646
16311647 /* this entry seems to match: same crc, not too old,
16321648 * 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
16421658 entry = &bat_priv->bla.bcast_duplist[curr];
16431659 entry->crc = crc;
16441660 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+
16461669 bat_priv->bla.bcast_duplist_curr = curr;
16471670
16481671 out:
@@ -1651,6 +1674,48 @@ out: · 2 unmodified lines
16511674 return ret;
16521675 }
16531676
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+ */
1689+static 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+ */
1706+bool 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+
16541719 /**
16551720 * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for
16561721 * 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
18121877 * @bat_priv: the bat priv with all the soft interface information
18131878 * @skb: the frame to be checked
18141879 * @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
18161881 *
18171882 * batadv_bla_rx avoidance checks if:
18181883 * * 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
18241889 * further process the skb.
18251890 */
18261891 bool 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)
18281893 {
18291894 struct batadv_bla_backbone_gw *backbone_gw;
18301895 struct ethhdr *ethhdr;
@@ -1846,9 +1911,32 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 15 unmodified lines
18461911 goto handled;
18471912
18481913 if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
1849− /* don't allow broadcasts while requests are in flight */
1850− if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
1851− goto handled;
1914+ /* don't allow multicast packets while requests are in flight */
1915+ if (is_multicast_ether_addr(ethhdr->h_dest))
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;
18521940
18531941 ether_addr_copy(search_claim.addr, ethhdr->h_source);
18541942 search_claim.vid = vid;
@@ -1883,13 +1971,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, · 28 unmodified lines
18831971 goto allow;
18841972 }
18851973
1886− /* if it is a broadcast ... */
1887− if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {
1974+ /* if it is a multicast ... */
1975+ if (is_multicast_ether_addr(ethhdr->h_dest) &&
1976+ (packet_type == BATADV_BCAST || packet_type == BATADV_UNICAST)) {
18881977 /* ... drop it. the responsible gateway is in charge.
18891978 *
1890− * We need to check is_bcast because with the gateway
1979+ * We need to check packet type because with the gateway
18911980 * 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.
18931982 */
18941983 goto handled;
18951984 } 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
3535
3636 #ifdef CONFIG_BATMAN_ADV_BLA
3737 bool 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);
3939 bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
4040 unsigned short vid);
4141 bool 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
6666
6767 static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
6868 struct sk_buff *skb, unsigned short vid,
69− bool is_bcast)
69+ int packet_type)
7070 {
7171 return false;
7272 }
net/batman-adv/multicast.c+36−10
@@ -51,6 +51,7 @@ · 50 unmodified lines
5151 #include <uapi/linux/batadv_packet.h>
5252 #include <uapi/linux/batman_adv.h>
5353
54+#include "bridge_loop_avoidance.h"
5455 #include "hard-interface.h"
5556 #include "hash.h"
5657 #include "log.h"
@@ -1434,6 +1435,35 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 1377 unmodified lines
14341435 return BATADV_FORW_ALL;
14351436 }
14361437
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+ */
1447+int 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+
14371467 /**
14381468 * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
14391469 * @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
14711501 break;
14721502 }
14731503
1474− batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
1475− orig_entry->orig_node, vid);
1504+ batadv_mcast_forw_send_orig(bat_priv, newskb, vid,
1505+ orig_entry->orig_node);
14761506 }
14771507 rcu_read_unlock();
14781508
@@ -1513,8 +1543,7 @@ batadv_mcast_forw_want_all_ipv4(struct batadv_priv *bat_priv, · 34 unmodified lines
15131543 break;
15141544 }
15151545
1516− batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
1517− orig_node, vid);
1546+ batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
15181547 }
15191548 rcu_read_unlock();
15201549 return ret;
@@ -1551,8 +1580,7 @@ batadv_mcast_forw_want_all_ipv6(struct batadv_priv *bat_priv, · 30 unmodified lines
15511580 break;
15521581 }
15531582
1554− batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
1555− orig_node, vid);
1583+ batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
15561584 }
15571585 rcu_read_unlock();
15581586 return ret;
@@ -1618,8 +1646,7 @@ batadv_mcast_forw_want_all_rtr4(struct batadv_priv *bat_priv, · 59 unmodified lines
16181646 break;
16191647 }
16201648
1621− batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
1622− orig_node, vid);
1649+ batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
16231650 }
16241651 rcu_read_unlock();
16251652 return ret;
@@ -1656,8 +1683,7 @@ batadv_mcast_forw_want_all_rtr6(struct batadv_priv *bat_priv, · 30 unmodified lines
16561683 break;
16571684 }
16581685
1659− batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
1660− orig_node, vid);
1686+ batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
16611687 }
16621688 rcu_read_unlock();
16631689 return ret;
net/batman-adv/multicast.h+15−0
@@ -46,6 +46,11 @@ enum batadv_forw_mode · 45 unmodified lines
4646 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
4747 struct batadv_orig_node **mcast_single_orig);
4848
49+int 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+
4954 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
5055 unsigned short vid);
5156
@@ -71,6 +76,16 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, · 19 unmodified lines
7176 return BATADV_FORW_ALL;
7277 }
7378
79+static inline int
80+batadv_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+
7489 static inline int
7590 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
7691 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
826826 vid = batadv_get_vid(skb, hdr_len);
827827 ethhdr = (struct ethhdr *)(skb->data + hdr_len);
828828
829+ /* do not reroute multicast frames in a unicast header */
830+ if (is_multicast_ether_addr(ethhdr->h_dest))
831+ return true;
832+
829833 /* check if the destination client was served by this node and it is now
830834 * roaming. In this case, it means that the node has got a ROAM_ADV
831835 * 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
364364 goto dropped;
365365 ret = batadv_send_skb_via_gw(bat_priv, skb, vid);
366366 } else if (mcast_single_orig) {
367− ret = batadv_send_skb_unicast(bat_priv, skb,
368− BATADV_UNICAST, 0,
369− mcast_single_orig, vid);
367+ ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
368+ mcast_single_orig);
370369 } else if (forw_mode == BATADV_FORW_SOME) {
371370 ret = batadv_mcast_forw_send(bat_priv, skb, vid);
372371 } else {
@@ -425,10 +424,10 @@ void batadv_interface_rx(struct net_device *soft_iface, · 52 unmodified lines
425424 struct vlan_ethhdr *vhdr;
426425 struct ethhdr *ethhdr;
427426 unsigned short vid;
428− bool is_bcast;
427+ int packet_type;
429428
430429 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;
432431
433432 skb_pull_rcsum(skb, hdr_size);
434433 skb_reset_mac_header(skb);
@@ -471,7 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 36 unmodified lines
471470 /* Let the bridge loop avoidance check the packet. If will
472471 * not handle it, we can safely push it up.
473472 */
474− if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))
473+ if (batadv_bla_rx(bat_priv, skb, vid, packet_type))
475474 goto out;
476475
477476 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
12881288 }
12891289 }
12901290
1291−static int __br_vlan_get_pvid(const struct net_device *dev,
1292− struct net_bridge_port *p, u16 *p_pvid)
1291+int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
12931292 {
12941293 struct net_bridge_vlan_group *vg;
1294+ struct net_bridge_port *p;
12951295
1296+ ASSERT_RTNL();
1297+ p = br_port_get_check_rtnl(dev);
12961298 if (p)
12971299 vg = nbp_vlan_group(p);
12981300 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
13031305 *p_pvid = br_get_pvid(vg);
13041306 return 0;
13051307 }
1306−
1307−int 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−}
13131308 EXPORT_SYMBOL_GPL(br_vlan_get_pvid);
13141309
13151310 int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
13161311 {
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;
13181325 }
13191326 EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu);
13201327
net/core/dev.c+1−1
@@ -8647,7 +8647,7 @@ int dev_get_port_parent_id(struct net_device *dev, · 8646 unmodified lines
86478647 if (!first.id_len)
86488648 first = *ppid;
86498649 else if (memcmp(&first, ppid, sizeof(*ppid)))
8650− return -ENODATA;
8650+ return -EOPNOTSUPP;
86518651 }
86528652
86538653 return err;
net/core/dst.c+1−1
@@ -144,7 +144,7 @@ static void dst_destroy_rcu(struct rcu_head *head) · 143 unmodified lines
144144
145145 /* Operations to mark dst as DEAD and clean up the net device referenced
146146 * by dst:
147− * 1. put the dst under loopback interface and discard all tx/rx packets
147+ * 1. put the dst under blackhole interface and discard all tx/rx packets
148148 * on this route.
149149 * 2. release the net_device
150150 * 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
1616 #include <net/ip_tunnels.h>
1717 #include <linux/indirect_call_wrapper.h>
1818
19−#ifdef CONFIG_IPV6_MULTIPLE_TABLES
19+#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES)
2020 #ifdef CONFIG_IP_MULTIPLE_TABLES
2121 #define INDIRECT_CALL_MT(f, f2, f1, ...) \
2222 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
48384838 fl4.saddr = params->ipv4_src;
48394839 fl4.fl4_sport = params->sport;
48404840 fl4.fl4_dport = params->dport;
4841+ fl4.flowi4_multipath_hash = 0;
48414842
48424843 if (flags & BPF_FIB_LOOKUP_DIRECT) {
48434844 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
70657066 bool indirect = BPF_MODE(orig->code) == BPF_IND;
70667067 struct bpf_insn *insn = insn_buf;
70677068
7068− /* We're guaranteed here that CTX is in R6. */
7069− *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
70707069 if (!indirect) {
70717070 *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm);
70727071 } else {
@@ -7074,6 +7073,8 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig, · 1 unmodified line
70747073 if (orig->imm)
70757074 *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm);
70767075 }
7076+ /* We're guaranteed here that CTX is in R6. */
7077+ *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
70777078
70787079 switch (BPF_SIZE(orig->code)) {
70797080 case BPF_B:
@@ -9522,7 +9523,7 @@ BPF_CALL_1(bpf_skc_to_tcp6_sock, struct sock *, sk) · 2442 unmodified lines
95229523 * trigger an explicit type generation here.
95239524 */
95249525 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 &&
95269527 sk->sk_family == AF_INET6)
95279528 return (unsigned long)sk;
95289529
@@ -9540,7 +9541,7 @@ const struct bpf_func_proto bpf_skc_to_tcp6_sock_proto = { · 11 unmodified lines
95409541
95419542 BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk)
95429543 {
9543− if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
9544+ if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
95449545 return (unsigned long)sk;
95459546
95469547 return (unsigned long)NULL;
@@ -9558,12 +9559,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_sock_proto = { · 11 unmodified lines
95589559 BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)
95599560 {
95609561 #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)
95629563 return (unsigned long)sk;
95639564 #endif
95649565
95659566 #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)
95679568 return (unsigned long)sk;
95689569 #endif
95699570
@@ -9582,12 +9583,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = { · 12 unmodified lines
95829583 BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
95839584 {
95849585 #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)
95869587 return (unsigned long)sk;
95879588 #endif
95889589
95899590 #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)
95919592 return (unsigned long)sk;
95929593 #endif
95939594
@@ -9609,7 +9610,7 @@ BPF_CALL_1(bpf_skc_to_udp6_sock, struct sock *, sk) · 15 unmodified lines
96099610 * trigger an explicit type generation here.
96109611 */
96119612 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 &&
96139614 sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6)
96149615 return (unsigned long)sk;
96159616
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
251251 if (refcount_read(&net->count) == 0)
252252 return NETNSA_NSID_NOT_ASSIGNED;
253253
254− spin_lock(&net->nsid_lock);
254+ spin_lock_bh(&net->nsid_lock);
255255 id = __peernet2id(net, peer);
256256 if (id >= 0) {
257− spin_unlock(&net->nsid_lock);
257+ spin_unlock_bh(&net->nsid_lock);
258258 return id;
259259 }
260260
@@ -264,12 +264,12 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) · 3 unmodified lines
264264 * just been idr_remove()'d from there in cleanup_net().
265265 */
266266 if (!maybe_get_net(peer)) {
267− spin_unlock(&net->nsid_lock);
267+ spin_unlock_bh(&net->nsid_lock);
268268 return NETNSA_NSID_NOT_ASSIGNED;
269269 }
270270
271271 id = alloc_netid(net, peer, -1);
272− spin_unlock(&net->nsid_lock);
272+ spin_unlock_bh(&net->nsid_lock);
273273
274274 put_net(peer);
275275 if (id < 0)
@@ -534,20 +534,20 @@ static void unhash_nsid(struct net *net, struct net *last) · 258 unmodified lines
534534 for_each_net(tmp) {
535535 int id;
536536
537− spin_lock(&tmp->nsid_lock);
537+ spin_lock_bh(&tmp->nsid_lock);
538538 id = __peernet2id(tmp, net);
539539 if (id >= 0)
540540 idr_remove(&tmp->netns_ids, id);
541− spin_unlock(&tmp->nsid_lock);
541+ spin_unlock_bh(&tmp->nsid_lock);
542542 if (id >= 0)
543543 rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL,
544544 GFP_KERNEL);
545545 if (tmp == last)
546546 break;
547547 }
548− spin_lock(&net->nsid_lock);
548+ spin_lock_bh(&net->nsid_lock);
549549 idr_destroy(&net->netns_ids);
550− spin_unlock(&net->nsid_lock);
550+ spin_unlock_bh(&net->nsid_lock);
551551 }
552552
553553 static LLIST_HEAD(cleanup_list);
@@ -760,9 +760,9 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 206 unmodified lines
760760 return PTR_ERR(peer);
761761 }
762762
763− spin_lock(&net->nsid_lock);
763+ spin_lock_bh(&net->nsid_lock);
764764 if (__peernet2id(net, peer) >= 0) {
765− spin_unlock(&net->nsid_lock);
765+ spin_unlock_bh(&net->nsid_lock);
766766 err = -EEXIST;
767767 NL_SET_BAD_ATTR(extack, nla);
768768 NL_SET_ERR_MSG(extack,
@@ -771,7 +771,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 2 unmodified lines
771771 }
772772
773773 err = alloc_netid(net, peer, nsid);
774− spin_unlock(&net->nsid_lock);
774+ spin_unlock_bh(&net->nsid_lock);
775775 if (err >= 0) {
776776 rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,
777777 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
14261426 {
14271427 const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
14281428 struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
1429+ int prio;
14291430 int err;
14301431
14311432 if (!ops)
@@ -1475,6 +1476,13 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, · 43 unmodified lines
14751476 struct dcbnl_buffer *buffer =
14761477 nla_data(ieee[DCB_ATTR_DCB_BUFFER]);
14771478
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+
14781486 err = ops->dcbnl_setbuffer(netdev, buffer);
14791487 if (err)
14801488 goto err;
net/dsa/slave.c+16−2
@@ -1799,15 +1799,27 @@ int dsa_slave_create(struct dsa_port *port) · 1798 unmodified lines
17991799
18001800 dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);
18011801
1802− ret = register_netdev(slave_dev);
1802+ rtnl_lock();
1803+
1804+ ret = register_netdevice(slave_dev);
18031805 if (ret) {
18041806 netdev_err(master, "error %d registering interface %s\n",
18051807 ret, slave_dev->name);
1808+ rtnl_unlock();
18061809 goto out_phy;
18071810 }
18081811
1812+ ret = netdev_upper_dev_link(master, slave_dev, NULL);
1813+
1814+ rtnl_unlock();
1815+
1816+ if (ret)
1817+ goto out_unregister;
1818+
18091819 return 0;
18101820
1821+out_unregister:
1822+ unregister_netdev(slave_dev);
18111823 out_phy:
18121824 rtnl_lock();
18131825 phylink_disconnect_phy(p->dp->pl);
@@ -1824,16 +1836,18 @@ out_free: · 10 unmodified lines
18241836
18251837 void dsa_slave_destroy(struct net_device *slave_dev)
18261838 {
1839+ struct net_device *master = dsa_slave_to_master(slave_dev);
18271840 struct dsa_port *dp = dsa_slave_to_port(slave_dev);
18281841 struct dsa_slave_priv *p = netdev_priv(slave_dev);
18291842
18301843 netif_carrier_off(slave_dev);
18311844 rtnl_lock();
1845+ netdev_upper_dev_unlink(master, slave_dev);
1846+ unregister_netdevice(slave_dev);
18321847 phylink_disconnect_phy(dp->pl);
18331848 rtnl_unlock();
18341849
18351850 dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
1836− unregister_netdev(slave_dev);
18371851 phylink_destroy(dp->pl);
18381852 gro_cells_destroy(&p->gcells);
18391853 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
160160 packing(injection, &qos_class, 19, 17, OCELOT_TAG_LEN, PACK, 0);
161161
162162 if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
163+ struct sk_buff *clone = DSA_SKB_CB(skb)->clone;
164+
163165 rew_op = ocelot_port->ptp_cmd;
164− if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
165− rew_op |= (ocelot_port->ts_id % 4) << 3;
166− ocelot_port->ts_id++;
167− }
166+ /* Retrieve timestamp ID populated inside skb->cb[0] of the
167+ * clone by ocelot_port_add_txtstamp_skb
168+ */
169+ if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
170+ rew_op |= clone->cb[0] << 3;
168171
169172 packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
170173 }
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
200200 reply_len = ret + ethnl_reply_header_size();
201201
202202 rskb = ethnl_reply_init(reply_len, req_info.dev,
203− ETHTOOL_MSG_TUNNEL_INFO_GET,
203+ ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
204204 ETHTOOL_A_TUNNEL_INFO_HEADER,
205205 info, &reply_payload);
206206 if (!rskb) {
@@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb) · 66 unmodified lines
273273 goto cont;
274274
275275 ehdr = ethnl_dump_put(skb, cb,
276− ETHTOOL_MSG_TUNNEL_INFO_GET);
276+ ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY);
277277 if (!ehdr) {
278278 ret = -EMSGSIZE;
279279 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
7676 proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]);
7777
7878 if (proto >= HSR_PROTOCOL_MAX) {
79− NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol\n");
79+ NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol");
8080 return -EINVAL;
8181 }
8282
@@ -84,14 +84,14 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 1 unmodified line
8484 proto_version = HSR_V0;
8585 } else {
8686 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");
8888 return -EINVAL;
8989 }
9090
9191 proto_version = nla_get_u8(data[IFLA_HSR_VERSION]);
9292 if (proto_version > HSR_V1) {
9393 NL_SET_ERR_MSG_MOD(extack,
94− "Only HSR version 0/1 supported\n");
94+ "Only HSR version 0/1 supported");
9595 return -EINVAL;
9696 }
9797 }
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
362362 fl4.flowi4_tun_key.tun_id = 0;
363363 fl4.flowi4_flags = 0;
364364 fl4.flowi4_uid = sock_net_uid(net, NULL);
365+ fl4.flowi4_multipath_hash = 0;
365366
366367 no_addr = idev->ifa_list == NULL;
367368
net/ipv4/inet_diag.c+15−5
@@ -186,8 +186,8 @@ errout: · 185 unmodified lines
186186 }
187187 EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill);
188188
189−static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
190− struct nlattr **req_nlas)
189+static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
190+ struct nlattr **req_nlas)
191191 {
192192 struct nlattr *nla;
193193 int remaining;
@@ -195,9 +195,13 @@ static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen, · 1 unmodified line
195195 nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) {
196196 int type = nla_type(nla);
197197
198+ if (type == INET_DIAG_REQ_PROTOCOL && nla_len(nla) != sizeof(u32))
199+ return -EINVAL;
200+
198201 if (type < __INET_DIAG_REQ_MAX)
199202 req_nlas[type] = nla;
200203 }
204+ return 0;
201205 }
202206
203207 static 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
574578 int err, protocol;
575579
576580 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+
578585 protocol = inet_diag_get_protocol(req, &dump_data);
579586
580587 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
11801187 if (!cb_data)
11811188 return -ENOMEM;
11821189
1183− inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
1184−
1190+ err = inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
1191+ if (err) {
1192+ kfree(cb_data);
1193+ return err;
1194+ }
11851195 nla = cb_data->inet_diag_nla_bc;
11861196 if (nla) {
11871197 err = inet_diag_bc_audit(nla, skb);
net/ipv4/ip_output.c+2−1
@@ -74,6 +74,7 @@ · 73 unmodified lines
7474 #include <net/icmp.h>
7575 #include <net/checksum.h>
7676 #include <net/inetpeer.h>
77+#include <net/inet_ecn.h>
7778 #include <net/lwtunnel.h>
7879 #include <linux/bpf-cgroup.h>
7980 #include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, · 1623 unmodified lines
17031704 if (IS_ERR(rt))
17041705 return;
17051706
1706− inet_sk(sk)->tos = arg->tos;
1707+ inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
17071708
17081709 sk->sk_protocol = ip_hdr(skb)->protocol;
17091710 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
554554
555555 attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP];
556556 md->gbp = nla_get_u32(attr);
557+ md->gbp &= VXLAN_GBP_MASK;
557558 info->key.tun_flags |= TUNNEL_VXLAN_OPT;
558559 }
559560
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
786786 neigh_event_send(n, NULL);
787787 } else {
788788 if (fib_lookup(net, fl4, &res, 0) == 0) {
789− struct fib_nh_common *nhc = FIB_RES_NHC(res);
789+ struct fib_nh_common *nhc;
790790
791+ fib_select_path(net, &res, fl4, skb);
792+ nhc = FIB_RES_NHC(res);
791793 update_or_create_fnhe(nhc, fl4->daddr, new_gw,
792794 0, false,
793795 jiffies + ip_rt_gc_timeout);
@@ -1013,6 +1015,7 @@ out: kfree_skb(skb); · 219 unmodified lines
10131015 static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
10141016 {
10151017 struct dst_entry *dst = &rt->dst;
1018+ struct net *net = dev_net(dst->dev);
10161019 u32 old_mtu = ipv4_mtu(dst);
10171020 struct fib_result res;
10181021 bool lock = false;
@@ -1033,9 +1036,11 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) · 14 unmodified lines
10331036 return;
10341037
10351038 rcu_read_lock();
1036− if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) {
1037− struct fib_nh_common *nhc = FIB_RES_NHC(res);
1039+ if (fib_lookup(net, fl4, &res, 0) == 0) {
1040+ struct fib_nh_common *nhc;
10381041
1042+ fib_select_path(net, &res, fl4, NULL);
1043+ nhc = FIB_RES_NHC(res);
10391044 update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock,
10401045 jiffies + ip_rt_mtu_expires);
10411046 }
@@ -2147,6 +2152,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · 1105 unmodified lines
21472152 fl4.daddr = daddr;
21482153 fl4.saddr = saddr;
21492154 fl4.flowi4_uid = sock_net_uid(net, NULL);
2155+ fl4.flowi4_multipath_hash = 0;
21502156
21512157 if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) {
21522158 flkeys = &_flkeys;
@@ -2667,8 +2673,6 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, · 514 unmodified lines
26672673 fib_select_path(net, res, fl4, skb);
26682674
26692675 dev_out = FIB_RES_DEV(*res);
2670− fl4->flowi4_oif = dev_out->ifindex;
2671−
26722676
26732677 make_route:
26742678 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
303303 config IPV6_SEG6_HMAC
304304 bool "IPv6: Segment Routing HMAC support"
305305 depends on IPV6
306+ select CRYPTO
306307 select CRYPTO_HMAC
307308 select CRYPTO_SHA1
308309 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
19931993 /* Need to own table->tb6_lock */
19941994 int fib6_del(struct fib6_info *rt, struct nl_info *info)
19951995 {
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;
19991996 struct net *net = info->nl_net;
20001997 struct fib6_info __rcu **rtp;
20011998 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;
20022004
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)
20042009 return -ENOENT;
20052010
20062011 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
42024202 .fc_nlinfo.nl_net = net,
42034203 };
42044204
4205− cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO,
4205+ cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO;
42064206 cfg.fc_dst = *prefix;
42074207 cfg.fc_gateway = *gwaddr;
42084208
net/mac80211/airtime.c+14−6
@@ -560,7 +560,9 @@ static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat, · 559 unmodified lines
560560 if (rate->idx < 0 || !rate->count)
561561 return -1;
562562
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)
564566 stat->bw = RATE_INFO_BW_80;
565567 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
566568 stat->bw = RATE_INFO_BW_40;
@@ -668,20 +670,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, · 101 unmodified lines
668670 * This will not be very accurate, but much better than simply
669671 * assuming un-aggregated tx in all cases.
670672 */
671− if (duration > 400) /* <= VHT20 MCS2 1S */
673+ if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
672674 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 */
674676 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 */
676678 agg_shift = 3;
677− else
679+ else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
678680 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;
679686
680687 duration *= len;
681688 duration /= AVG_PKT_SIZE;
682689 duration /= 1024;
690+ duration += (overhead >> agg_shift);
683691
684− return duration + (overhead >> agg_shift);
692+ return max_t(u32, duration, 4);
685693 }
686694
687695 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
48614861 struct ieee80211_supported_band *sband;
48624862 struct cfg80211_chan_def chandef;
48634863 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ;
4864+ bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ;
48644865 struct ieee80211_bss *bss = (void *)cbss->priv;
48654866 int ret;
48664867 u32 i;
@@ -4879,7 +4880,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 12 unmodified lines
48794880 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
48804881 }
48814882
4882− if (!sband->vht_cap.vht_supported && !is_6ghz) {
4883+ if (!sband->vht_cap.vht_supported && is_5ghz) {
48834884 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
48844885 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
48854886 }
net/mac80211/rx.c+2−1
@@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, · 450 unmodified lines
451451 else if (status->bw == RATE_INFO_BW_5)
452452 channel_flags |= IEEE80211_CHAN_QUARTER;
453453
454− if (status->band == NL80211_BAND_5GHZ)
454+ if (status->band == NL80211_BAND_5GHZ ||
455+ status->band == NL80211_BAND_6GHZ)
455456 channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
456457 else if (status->encoding != RX_ENC_LEGACY)
457458 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
33533353 he_chandef.center_freq1 =
33543354 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0,
33553355 NL80211_BAND_6GHZ);
3356− he_chandef.center_freq2 =
3357− ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
3358− NL80211_BAND_6GHZ);
3356+ if (support_80_80 || support_160)
3357+ he_chandef.center_freq2 =
3358+ ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
3359+ NL80211_BAND_6GHZ);
33593360 }
33603361
33613362 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
168168 /* take some capabilities as-is */
169169 cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
170170 vht_cap->cap = cap_info;
171− vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |
172− IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
173− IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
174− IEEE80211_VHT_CAP_RXLDPC |
171+ vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC |
175172 IEEE80211_VHT_CAP_VHT_TXOP_PS |
176173 IEEE80211_VHT_CAP_HTC_VHT |
177174 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
180177 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
181178 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
182179
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+
183183 /* and some based on our own capabilities */
184184 switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
185185 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
3434 if (res)
3535 goto err_tx;
3636
37− ieee802154_xmit_complete(&local->hw, skb, false);
38−
3937 dev->stats.tx_packets++;
4038 dev->stats.tx_bytes += skb->len;
4139
40+ ieee802154_xmit_complete(&local->hw, skb, false);
41+
4242 return;
4343
4444 err_tx:
@@ -78,6 +78,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 33 unmodified lines
7878
7979 /* async is priority, otherwise sync is fallback */
8080 if (local->ops->xmit_async) {
81+ unsigned int len = skb->len;
82+
8183 ret = drv_xmit_async(local, skb);
8284 if (ret) {
8385 ieee802154_wake_queue(&local->hw);
@@ -85,7 +87,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) · 1 unmodified line
8587 }
8688
8789 dev->stats.tx_packets++;
88− dev->stats.tx_bytes += skb->len;
90+ dev->stats.tx_bytes += len;
8991 } else {
9092 local->tx_skb = skb;
9193 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
6666 return a->port == b->port;
6767 }
6868
69+static 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+
6979 static void local_address(const struct sock_common *skc,
7080 struct mptcp_addr_info *addr)
7181 {
@@ -171,9 +181,9 @@ static void check_work_pending(struct mptcp_sock *msk) · 99 unmodified lines
171181
172182 static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
173183 {
184+ struct mptcp_addr_info remote = { 0 };
174185 struct sock *sk = (struct sock *)msk;
175186 struct mptcp_pm_addr_entry *local;
176− struct mptcp_addr_info remote;
177187 struct pm_nl_pernet *pernet;
178188
179189 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
323333 * addr
324334 */
325335 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);
327337 if (addresses_equal(&msk_local, &skc_local, false))
328338 return 0;
329339
340+ if (address_zero(&skc_local))
341+ return 0;
342+
330343 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
331344
332345 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
341354 return ret;
342355
343356 /* address not found, add to local list */
344− entry = kmalloc(sizeof(*entry), GFP_KERNEL);
357+ entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
345358 if (!entry)
346359 return -ENOMEM;
347360
net/mptcp/subflow.c+5−2
@@ -1063,6 +1063,7 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 1062 unmodified lines
10631063 struct mptcp_sock *msk = mptcp_sk(sk);
10641064 struct mptcp_subflow_context *subflow;
10651065 struct sockaddr_storage addr;
1066+ int remote_id = remote->id;
10661067 int local_id = loc->id;
10671068 struct socket *sf;
10681069 struct sock *ssk;
@@ -1107,10 +1108,11 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex, · 38 unmodified lines
11071108 goto failed;
11081109
11091110 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− local_id);
1111+ pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk,
1112+ remote_token, local_id, remote_id);
11121113 subflow->remote_token = remote_token;
11131114 subflow->local_id = local_id;
1115+ subflow->remote_id = remote_id;
11141116 subflow->request_join = 1;
11151117 subflow->request_bkup = 1;
11161118 mptcp_info2sockaddr(remote, &addr);
@@ -1347,6 +1349,7 @@ static void subflow_ulp_clone(const struct request_sock *req, · 230 unmodified lines
13471349 new_ctx->fully_established = 1;
13481350 new_ctx->backup = subflow_req->backup;
13491351 new_ctx->local_id = subflow_req->local_id;
1352+ new_ctx->remote_id = subflow_req->remote_id;
13501353 new_ctx->token = subflow_req->token;
13511354 new_ctx->thmac = subflow_req->thmac;
13521355 }
net/netfilter/nf_conntrack_netlink.c+5−17
@@ -851,7 +851,6 @@ static int ctnetlink_done(struct netlink_callback *cb) · 850 unmodified lines
851851 }
852852
853853 struct ctnetlink_filter {
854− u_int32_t cta_flags;
855854 u8 family;
856855
857856 u_int32_t orig_flags;
@@ -906,10 +905,6 @@ static int ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 48 unmodified lines
906905 struct nf_conntrack_zone *zone,
907906 u_int32_t flags);
908907
909−/* applied on filters */
910−#define CTA_FILTER_F_CTA_MARK (1 << 0)
911−#define CTA_FILTER_F_CTA_MARK_MASK (1 << 1)
912−
913908 static struct ctnetlink_filter *
914909 ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
915910 {
@@ -930,14 +925,10 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family) · 14 unmodified lines
930925 #ifdef CONFIG_NF_CONNTRACK_MARK
931926 if (cda[CTA_MARK]) {
932927 filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK]));
933− filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK);
934−
935− if (cda[CTA_MARK_MASK]) {
928+ if (cda[CTA_MARK_MASK])
936929 filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK]));
937− filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK_MASK);
938− } else {
930+ else
939931 filter->mark.mask = 0xffffffff;
940− }
941932 } else if (cda[CTA_MARK_MASK]) {
942933 err = -EINVAL;
943934 goto err_filter;
@@ -1117,11 +1108,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data) · 173 unmodified lines
11171108 }
11181109
11191110 #ifdef CONFIG_NF_CONNTRACK_MARK
1120− if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) &&
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)
1111+ if ((ct->mark & filter->mark.mask) != filter->mark.val)
11251112 goto ignore_entry;
11261113 #endif
11271114
@@ -1404,7 +1391,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], · 276 unmodified lines
14041391 if (err < 0)
14051392 return err;
14061393
1407−
1394+ if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6)
1395+ return -EOPNOTSUPP;
14081396 tuple->src.l3num = l3num;
14091397
14101398 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
565565 int err;
566566
567567 err = nf_ct_netns_do_get(net, NFPROTO_IPV4);
568+#if IS_ENABLED(CONFIG_IPV6)
568569 if (err < 0)
569570 goto err1;
570571 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
575576 err2:
576577 nf_ct_netns_put(net, NFPROTO_IPV4);
577578 err1:
579+#endif
578580 return err;
579581 }
580582
net/netfilter/nf_tables_api.c+57−13
@@ -684,6 +684,18 @@ nla_put_failure: · 683 unmodified lines
684684 return -1;
685685 }
686686
687+struct nftnl_skb_parms {
688+ bool report;
689+};
690+#define NFT_CB(skb) (*(struct nftnl_skb_parms*)&((skb)->cb))
691+
692+static 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+
687699 static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
688700 {
689701 struct sk_buff *skb;
@@ -715,8 +727,7 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event) · 25 unmodified lines
715727 goto err;
716728 }
717729
718− nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
719− ctx->report, GFP_KERNEL);
730+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
720731 return;
721732 err:
722733 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
14681479 goto err;
14691480 }
14701481
1471− nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
1472− ctx->report, GFP_KERNEL);
1482+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
14731483 return;
14741484 err:
14751485 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
28072817 goto err;
28082818 }
28092819
2810− nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
2811− ctx->report, GFP_KERNEL);
2820+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
28122821 return;
28132822 err:
28142823 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
38373846 goto err;
38383847 }
38393848
3840− nfnetlink_send(skb, ctx->net, portid, NFNLGRP_NFTABLES, ctx->report,
3841− gfp_flags);
3849+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
38423850 return;
38433851 err:
38443852 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
49594967 goto err;
49604968 }
49614969
4962− nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, ctx->report,
4963− GFP_KERNEL);
4970+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
49644971 return;
49654972 err:
49664973 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
62756282 goto err;
62766283 }
62776284
6278− nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report, gfp);
6285+ nft_notify_enqueue(skb, report, &net->nft.notify_list);
62796286 return;
62806287 err:
62816288 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
70857092 goto err;
70867093 }
70877094
7088− nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
7089− ctx->report, GFP_KERNEL);
7095+ nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
70907096 return;
70917097 err:
70927098 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
76957701 mutex_unlock(&net->nft.commit_mutex);
76967702 }
76977703
7704+static 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) {
7712+new_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+
76987739 static int nf_tables_commit(struct net *net, struct sk_buff *skb)
76997740 {
77007741 struct nft_trans *trans, *next;
@@ -7897,6 +7938,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 196 unmodified lines
78977938 }
78987939 }
78997940
7941+ nft_commit_notify(net, NETLINK_CB(skb).portid);
79007942 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);
79017943 nf_tables_commit_release(net);
79027944
@@ -8721,6 +8763,7 @@ static int __net_init nf_tables_init_net(struct net *net) · 818 unmodified lines
87218763 INIT_LIST_HEAD(&net->nft.tables);
87228764 INIT_LIST_HEAD(&net->nft.commit_list);
87238765 INIT_LIST_HEAD(&net->nft.module_list);
8766+ INIT_LIST_HEAD(&net->nft.notify_list);
87248767 mutex_init(&net->nft.commit_mutex);
87258768 net->nft.base_seq = 1;
87268769 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
87378780 mutex_unlock(&net->nft.commit_mutex);
87388781 WARN_ON_ONCE(!list_empty(&net->nft.tables));
87398782 WARN_ON_ONCE(!list_empty(&net->nft.module_list));
8783+ WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
87408784 }
87418785
87428786 static 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
147147
148148 switch (key) {
149149 case NFT_META_SKUID:
150− *dest = from_kuid_munged(&init_user_ns,
150+ *dest = from_kuid_munged(sock_net(sk)->user_ns,
151151 sock->file->f_cred->fsuid);
152152 break;
153153 case NFT_META_SKGID:
154− *dest = from_kgid_munged(&init_user_ns,
154+ *dest = from_kgid_munged(sock_net(sk)->user_ns,
155155 sock->file->f_cred->fsgid);
156156 break;
157157 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
332332 {
333333 struct qrtr_hdr_v1 *hdr;
334334 size_t len = skb->len;
335− int rc = -ENODEV;
336− int confirm_rx;
335+ int rc, confirm_rx;
337336
338337 confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);
339338 if (confirm_rx < 0) {
@@ -357,15 +356,17 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 17 unmodified lines
357356 hdr->size = cpu_to_le32(len);
358357 hdr->confirm_rx = !!confirm_rx;
359358
360− 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);
359+ rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
368360
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+ }
369370 /* Need to ensure that a subsequent message carries the otherwise lost
370371 * confirm_rx flag if we dropped this one */
371372 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
436436 kfree_rcu(p, rcu);
437437 }
438438
439+static 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+
439458 static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
440459 bool exists, bool rtnl_held)
441460 {
@@ -449,10 +468,6 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, · 7 unmodified lines
449468 val = nla_data(tb[i]);
450469 len = nla_len(tb[i]);
451470
452− rc = load_metaops_and_vet(i, val, len, rtnl_held);
453− if (rc != 0)
454− return rc;
455−
456471 rc = add_metainfo(ife, i, val, len, exists);
457472 if (rc)
458473 return rc;
@@ -509,6 +524,21 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 50 unmodified lines
509524 if (!p)
510525 return -ENOMEM;
511526
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+
512542 index = parm->index;
513543 err = tcf_idr_check_alloc(tn, &index, a, bind);
514544 if (err < 0) {
@@ -570,15 +600,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, · 55 unmodified lines
570600 }
571601
572602 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;
578603 err = populate_metalist(ife, tb2, exists, rtnl_held);
579604 if (err)
580605 goto metadata_parse_err;
581−
582606 } else {
583607 /* if no passed metadata allow list or passed allow-all
584608 * 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
156156 struct vxlan_metadata *md = dst;
157157
158158 md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]);
159+ md->gbp &= VXLAN_GBP_MASK;
159160 }
160161
161162 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
11751175 return -EINVAL;
11761176 }
11771177
1178− if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP])
1178+ if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) {
11791179 md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]);
1180+ md->gbp &= VXLAN_GBP_MASK;
1181+ }
11801182
11811183 return sizeof(*md);
11821184 }
@@ -1221,6 +1223,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key, · 38 unmodified lines
12211223 }
12221224 if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {
12231225 nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];
1226+ memset(&md->u, 0x00, sizeof(md->u));
12241227 md->u.index = nla_get_be32(nla);
12251228 }
12261229 } else if (md->version == 2) {
net/sched/sch_generic.c+33−15
@@ -1131,24 +1131,10 @@ EXPORT_SYMBOL(dev_activate); · 1130 unmodified lines
11311131
11321132 static void qdisc_deactivate(struct Qdisc *qdisc)
11331133 {
1134− bool nolock = qdisc->flags & TCQ_F_NOLOCK;
1135−
11361134 if (qdisc->flags & TCQ_F_BUILTIN)
11371135 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));
11441136
11451137 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);
11521138 }
11531139
11541140 static void dev_deactivate_queue(struct net_device *dev,
@@ -1165,6 +1151,30 @@ static void dev_deactivate_queue(struct net_device *dev, · 10 unmodified lines
11651151 }
11661152 }
11671153
1154+static 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+
11681178 static bool some_qdisc_is_busy(struct net_device *dev)
11691179 {
11701180 unsigned int i;
@@ -1213,12 +1223,20 @@ void dev_deactivate_many(struct list_head *head) · 42 unmodified lines
12131223 dev_watchdog_down(dev);
12141224 }
12151225
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.
12171228 * This is avoided if all devices are in dismantle phase :
12181229 * Caller will call synchronize_net() for us
12191230 */
12201231 synchronize_net();
12211232
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+
12221240 /* Wait for outstanding qdisc_run calls. */
12231241 list_for_each_entry(dev, head, close_list) {
12241242 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
777777 [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },
778778 };
779779
780−static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
780+static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
781+ struct sched_entry *entry,
781782 struct netlink_ext_ack *extack)
782783 {
784+ int min_duration = length_to_duration(q, ETH_ZLEN);
783785 u32 interval = 0;
784786
785787 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
794796 interval = nla_get_u32(
795797 tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]);
796798
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) {
798803 NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
799804 return -EINVAL;
800805 }
@@ -804,8 +809,9 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, · 3 unmodified lines
804809 return 0;
805810 }
806811
807−static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
808− int index, struct netlink_ext_ack *extack)
812+static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,
813+ struct sched_entry *entry, int index,
814+ struct netlink_ext_ack *extack)
809815 {
810816 struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };
811817 int err;
@@ -819,10 +825,10 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry, · 7 unmodified lines
819825
820826 entry->index = index;
821827
822− return fill_sched_entry(tb, entry, extack);
828+ return fill_sched_entry(q, tb, entry, extack);
823829 }
824830
825−static int parse_sched_list(struct nlattr *list,
831+static int parse_sched_list(struct taprio_sched *q, struct nlattr *list,
826832 struct sched_gate_list *sched,
827833 struct netlink_ext_ack *extack)
828834 {
@@ -847,7 +853,7 @@ static int parse_sched_list(struct nlattr *list, · 18 unmodified lines
847853 return -ENOMEM;
848854 }
849855
850− err = parse_sched_entry(n, entry, i, extack);
856+ err = parse_sched_entry(q, n, entry, i, extack);
851857 if (err < 0) {
852858 kfree(entry);
853859 return err;
@@ -862,7 +868,7 @@ static int parse_sched_list(struct nlattr *list, · 8 unmodified lines
862868 return i;
863869 }
864870
865−static int parse_taprio_schedule(struct nlattr **tb,
871+static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
866872 struct sched_gate_list *new,
867873 struct netlink_ext_ack *extack)
868874 {
@@ -883,8 +889,8 @@ static int parse_taprio_schedule(struct nlattr **tb, · 14 unmodified lines
883889 new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);
884890
885891 if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])
886− err = parse_sched_list(
887− tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack);
892+ err = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],
893+ new, extack);
888894 if (err < 0)
889895 return err;
890896
@@ -1473,7 +1479,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, · 582 unmodified lines
14731479 goto free_sched;
14741480 }
14751481
1476− err = parse_taprio_schedule(tb, new_admin, extack);
1482+ err = parse_taprio_schedule(q, tb, new_admin, extack);
14771483 if (err < 0)
14781484 goto free_sched;
14791485
net/sctp/socket.c+3−6
@@ -9220,13 +9220,10 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, · 9219 unmodified lines
92209220 static inline void sctp_copy_descendant(struct sock *sk_to,
92219221 const struct sock *sk_from)
92229222 {
9223− int 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);
9223+ size_t ancestor_size = sizeof(struct inet_sock);
92299224
9225+ ancestor_size += sk_from->sk_prot->obj_size;
9226+ ancestor_size -= offsetof(struct sctp_sock, pd_lobby);
92309227 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
92319228 }
92329229
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
273273 return NULL;
274274 }
275275
276−static void tipc_group_add_to_tree(struct tipc_group *grp,
277− struct tipc_member *m)
276+static int tipc_group_add_to_tree(struct tipc_group *grp,
277+ struct tipc_member *m)
278278 {
279279 u64 nkey, key = (u64)m->node << 32 | m->port;
280280 struct rb_node **n, *parent = NULL;
@@ -291,10 +291,11 @@ static void tipc_group_add_to_tree(struct tipc_group *grp, · 10 unmodified lines
291291 else if (key > nkey)
292292 n = &(*n)->rb_right;
293293 else
294− return;
294+ return -EEXIST;
295295 }
296296 rb_link_node(&m->tree_node, parent, n);
297297 rb_insert_color(&m->tree_node, &grp->members);
298+ return 0;
298299 }
299300
300301 static 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
302303 u32 instance, int state)
303304 {
304305 struct tipc_member *m;
306+ int ret;
305307
306308 m = kzalloc(sizeof(*m), GFP_ATOMIC);
307309 if (!m)
@@ -314,8 +316,12 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, · 6 unmodified lines
314316 m->port = port;
315317 m->instance = instance;
316318 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+ }
317324 grp->member_cnt++;
318− tipc_group_add_to_tree(grp, m);
319325 tipc_nlist_add(&grp->dests, m->node);
320326 m->state = state;
321327 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
532532 * tipc_link_bc_create - create new link to be used for broadcast
533533 * @net: pointer to associated network namespace
534534 * @mtu: mtu to be used initially if no peers
535− * @window: send window to be used
535+ * @min_win: minimal send window to be used by link
536+ * @max_win: maximal send window to be used by link
536537 * @inputq: queue to put messages ready for delivery
537538 * @namedq: queue to put binding table update messages ready for delivery
538539 * @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
150150 if (fragid == FIRST_FRAGMENT) {
151151 if (unlikely(head))
152152 goto err;
153− if (unlikely(skb_unclone(frag, GFP_ATOMIC)))
153+ frag = skb_unshare(frag, GFP_ATOMIC);
154+ if (unlikely(!frag))
154155 goto err;
155156 head = *headbuf = frag;
156157 *buf = NULL;
net/tipc/socket.c+1−4
@@ -2771,10 +2771,7 @@ static int tipc_shutdown(struct socket *sock, int how) · 2770 unmodified lines
27712771
27722772 trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");
27732773 __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);
2774− if (tipc_sk_type_connectionless(sk))
2775− sk->sk_shutdown = SHUTDOWN_MASK;
2776− else
2777− sk->sk_shutdown = SEND_SHUTDOWN;
2774+ sk->sk_shutdown = SHUTDOWN_MASK;
27782775
27792776 if (sk->sk_state == TIPC_DISCONNECTING) {
27802777 /* Discard any unreceived messages */
net/wireless/Kconfig+1−0
@@ -217,6 +217,7 @@ config LIB80211_CRYPT_WEP · 216 unmodified lines
217217
218218 config LIB80211_CRYPT_CCMP
219219 tristate
220+ select CRYPTO
220221 select CRYPTO_AES
221222 select CRYPTO_CCM
222223
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
9595 /* see 802.11ax D6.1 27.3.23.2 */
9696 if (chan == 2)
9797 return MHZ_TO_KHZ(5935);
98− if (chan <= 253)
98+ if (chan <= 233)
9999 return MHZ_TO_KHZ(5950 + chan * 5);
100100 break;
101101 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
303303
304304 static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
305305 {
306+ u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom;
306307 bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
307− u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
308308 u64 npgs, addr = mr->addr, size = mr->len;
309− unsigned int chunks, chunks_per_page;
309+ unsigned int chunks, chunks_rem;
310310 int err;
311311
312312 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
336336 if ((addr + size) < addr)
337337 return -EINVAL;
338338
339− npgs = size >> PAGE_SHIFT;
339+ npgs = div_u64_rem(size, PAGE_SIZE, &npgs_rem);
340+ if (npgs_rem)
341+ npgs++;
340342 if (npgs > U32_MAX)
341343 return -EINVAL;
342344
343− chunks = (unsigned int)div_u64(size, chunk_size);
345+ chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem);
344346 if (chunks == 0)
345347 return -EINVAL;
346348
347− if (!unaligned_chunks) {
348− chunks_per_page = PAGE_SIZE / chunk_size;
349− if (chunks < chunks_per_page || chunks % chunks_per_page)
350− return -EINVAL;
351− }
349+ if (!unaligned_chunks && chunks_rem)
350+ return -EINVAL;
352351
353352 if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
354353 return -EINVAL;
tools/bpf/Makefile+2−2
@@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args · 37 unmodified lines
3838 FEATURE_DISPLAY = libbfd disassembler-four-args
3939
4040 check_feat := 1
41−NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
41+NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
4242 ifdef MAKECMDGOALS
4343 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
4444 check_feat := 0
@@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c · 44 unmodified lines
8989 $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
9090 $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
9191
92−clean: bpftool_clean runqslower_clean
92+clean: bpftool_clean runqslower_clean resolve_btfids_clean
9393 $(call QUIET_CLEAN, bpf-progs)
9494 $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
9595 $(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
8080 clean: libsubcmd-clean libbpf-clean fixdep-clean
8181 $(call msg,CLEAN,$(BINARY))
8282 $(Q)$(RM) -f $(BINARY); \
83+ $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
8384 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
8485
8586 tags:
tools/lib/bpf/Makefile+3−1
@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf · 58 unmodified lines
5959 FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray
6060 FEATURE_DISPLAY = libelf zlib bpf
6161
62−INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
62+INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
6363 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
6464
6565 check_feat := 1
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ · 86 unmodified lines
152152 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
153153 sort -u | wc -l)
154154 VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
155+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
155156 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
156157
157158 CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so · 61 unmodified lines
219220 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
220221 sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
221222 readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
223+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
222224 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
223225 sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
224226 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
52035203 int i, j, nrels, new_sz;
52045204 const struct btf_var_secinfo *vi = NULL;
52055205 const struct btf_type *sec, *var, *def;
5206+ struct bpf_map *map = NULL, *targ_map;
52065207 const struct btf_member *member;
5207− struct bpf_map *map, *targ_map;
52085208 const char *name, *mname;
52095209 Elf_Data *symbols;
52105210 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
4747 __u32 seq_num = ctx->meta->seq_num;
4848 struct bpf_map *map = ctx->map;
4949 struct key_t *key = ctx->key;
50+ struct key_t tmp_key;
5051 __u64 *val = ctx->value;
52+ __u64 tmp_val = 0;
53+ int ret;
5154
5255 if (in_test_mode) {
5356 /* 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
6164 if (key == (void *)0 || val == (void *)0)
6265 return 0;
6366
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+
6479 key_sum_a += key->a;
6580 key_sum_b += key->b;
6681 key_sum_c += key->c;
tools/testing/selftests/net/rtnetlink.sh+47−0
@@ -1175,6 +1175,51 @@ kci_test_neigh_get() · 1174 unmodified lines
11751175 echo "PASS: neigh get"
11761176 }
11771177
1178+kci_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+
11781223 kci_test_rtnl()
11791224 {
11801225 local ret=0
@@ -1224,6 +1269,8 @@ kci_test_rtnl() · 43 unmodified lines
12241269 check_err $?
12251270 kci_test_neigh_get
12261271 check_err $?
1272+ kci_test_bridge_parent_id
1273+ check_err $?
12271274
12281275 kci_del_dummy
12291276 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