summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-28 20:47:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-28 20:47:33 -0400
commit02dc96ef6c25f990452c114c59d75c368a1f4c8f (patch)
treebddda0591191f65931195d3171743507d6cae7d6
parentedf445ad7c8d58c2784a5b733790e80999093d8f (diff)
parentfaeacb6ddb13b7a020b50b9246fe098653cfbd6e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) Sanity check URB networking device parameters to avoid divide by zero, from Oliver Neukum. 2) Disable global multicast filter in NCSI, otherwise LLDP and IPV6 don't work properly. Longer term this needs a better fix tho. From Vijay Khemka. 3) Small fixes to selftests (use ping when ping6 is not present, etc.) from David Ahern. 4) Bring back rt_uses_gateway member of struct rtable, it's semantics were not well understood and trying to remove it broke things. From David Ahern. 5) Move usbnet snaity checking, ignore endpoints with invalid wMaxPacketSize. From Bjørn Mork. 6) Missing Kconfig deps for sja1105 driver, from Mao Wenan. 7) Various small fixes to the mlx5 DR steering code, from Alaa Hleihel, Alex Vesker, and Yevgeny Kliteynik 8) Missing CAP_NET_RAW checks in various places, from Ori Nimron. 9) Fix crash when removing sch_cbs entry while offloading is enabled, from Vinicius Costa Gomes. 10) Signedness bug fixes, generally in looking at the result given by of_get_phy_mode() and friends. From Dan Crapenter. 11) Disable preemption around BPF_PROG_RUN() calls, from Eric Dumazet. 12) Don't create VRF ipv6 rules if ipv6 is disabled, from David Ahern. 13) Fix quantization code in tcp_bbr, from Kevin Yang. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (127 commits) net: tap: clean up an indentation issue nfp: abm: fix memory leak in nfp_abm_u32_knode_replace tcp: better handle TCP_USER_TIMEOUT in SYN_SENT state sk_buff: drop all skb extensions on free and skb scrubbing tcp_bbr: fix quantization code to not raise cwnd if not probing bandwidth mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Documentation: Clarify trap's description mlxsw: spectrum: Clear VLAN filters during port initialization net: ena: clean up indentation issue NFC: st95hf: clean up indentation issue net: phy: micrel: add Asym Pause workaround for KSZ9021 net: socionext: ave: Avoid using netdev_err() before calling register_netdev() ptp: correctly disable flags on old ioctls lib: dimlib: fix help text typos net: dsa: microchip: Always set regmap stride to 1 nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs nfp: flower: prevent memory leak in nfp_flower_spawn_phy_reprs net/sched: Set default of CONFIG_NET_TC_SKB_EXT to N vrf: Do not attempt to create IPv6 mcast rule if IPv6 is disabled net: sched: sch_sfb: don't call qdisc_put() while holding tree lock ...
-rw-r--r--Documentation/devicetree/bindings/net/adi,adin.yaml7
-rw-r--r--Documentation/devicetree/bindings/net/micrel-ksz90x1.txt32
-rw-r--r--Documentation/devicetree/bindings/net/renesas,ravb.txt1
-rw-r--r--Documentation/devicetree/bindings/net/snps,dwmac.yaml2
-rw-r--r--Documentation/networking/devlink-trap.rst3
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/atm/he.c2
-rw-r--r--drivers/infiniband/core/addr.c2
-rw-r--r--drivers/isdn/mISDN/socket.c2
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/arcnet/Kconfig26
-rw-r--r--drivers/net/arcnet/arcnet.c31
-rw-r--r--drivers/net/can/usb/Kconfig8
-rw-r--r--drivers/net/dsa/b53/b53_serdes.h4
-rw-r--r--drivers/net/dsa/lantiq_pce.h2
-rw-r--r--drivers/net/dsa/microchip/ksz_common.h2
-rw-r--r--drivers/net/dsa/qca8k.c3
-rw-r--r--drivers/net/dsa/sja1105/Kconfig1
-rw-r--r--drivers/net/ethernet/Kconfig11
-rw-r--r--drivers/net/ethernet/Makefile1
-rw-r--r--drivers/net/ethernet/allwinner/Kconfig10
-rw-r--r--drivers/net/ethernet/amazon/Kconfig1
-rw-r--r--drivers/net/ethernet/amazon/ena/ena_eth_com.c4
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_vec.c15
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c2
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c5
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/Kconfig2
-rw-r--r--drivers/net/ethernet/freescale/enetc/enetc_pf.c2
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c2
-rw-r--r--drivers/net/ethernet/hisilicon/hix5hd2_gmac.c2
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c269
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.h6
-rw-r--r--drivers/net/ethernet/marvell/skge.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig36
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c89
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c50
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h7
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c9
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c6
-rw-r--r--drivers/net/ethernet/netronome/nfp/abm/cls.c14
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/main.c7
-rw-r--r--drivers/net/ethernet/netx-eth.c497
-rw-r--r--drivers/net/ethernet/ni/nixge.c2
-rw-r--r--drivers/net/ethernet/nxp/Kconfig8
-rw-r--r--drivers/net/ethernet/pensando/Kconfig4
-rw-r--r--drivers/net/ethernet/pensando/ionic/ionic_debugfs.c2
-rw-r--r--drivers/net/ethernet/pensando/ionic/ionic_lif.c1
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_fp.c3
-rw-r--r--drivers/net/ethernet/socionext/netsec.c2
-rw-r--r--drivers/net/ethernet/socionext/sni_ave.c8
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c5
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c16
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c2
-rw-r--r--drivers/net/macsec.c1
-rw-r--r--drivers/net/phy/Kconfig6
-rw-r--r--drivers/net/phy/micrel.c3
-rw-r--r--drivers/net/phy/national.c9
-rw-r--r--drivers/net/ppp/ppp_generic.c2
-rw-r--r--drivers/net/tap.c2
-rw-r--r--drivers/net/usb/cdc_ncm.c6
-rw-r--r--drivers/net/usb/usbnet.c8
-rw-r--r--drivers/net/vrf.c3
-rw-r--r--drivers/net/wireless/ath/Kconfig2
-rw-r--r--drivers/net/wireless/ath/ar5523/Kconfig4
-rw-r--r--drivers/net/wireless/ath/ath6kl/Kconfig2
-rw-r--r--drivers/net/wireless/ath/ath9k/Kconfig2
-rw-r--r--drivers/net/wireless/ath/carl9170/Kconfig6
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.c2
-rw-r--r--drivers/net/wireless/atmel/Kconfig32
-rw-r--r--drivers/net/wireless/intel/ipw2x00/Kconfig116
-rw-r--r--drivers/net/wireless/intel/iwlegacy/Kconfig6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/Kconfig6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tt.c9
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/mcu.c11
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h6
-rw-r--r--drivers/net/wireless/ralink/rt2x00/Kconfig24
-rw-r--r--drivers/net/wireless/realtek/rtw88/mac.c3
-rw-r--r--drivers/net/wireless/realtek/rtw88/main.c4
-rw-r--r--drivers/net/wireless/realtek/rtw88/pci.c48
-rw-r--r--drivers/net/wireless/zydas/zd1211rw/zd_usb.c2
-rw-r--r--drivers/nfc/st95hf/core.c2
-rw-r--r--drivers/of/of_mdio.c2
-rw-r--r--drivers/ptp/ptp_chardev.c4
-rw-r--r--include/linux/mlx5/mlx5_ifc.h28
-rw-r--r--include/linux/platform_data/eth-netx.h13
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--include/net/inet_timewait_sock.h1
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/netfilter/nf_tables.h6
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/sch_generic.h5
-rw-r--r--include/uapi/linux/btf.h4
-rw-r--r--include/uapi/linux/netfilter_bridge/ebtables.h6
-rw-r--r--include/uapi/linux/ptp_clock.h22
-rw-r--r--kernel/bpf/btf.c7
-rw-r--r--kernel/bpf/xskmap.c2
-rw-r--r--kernel/trace/bpf_trace.c26
-rw-r--r--lib/Kconfig5
-rw-r--r--net/appletalk/ddp.c5
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/batman-adv/Kconfig10
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/dst.c4
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/dccp/ipv6.c5
-rw-r--r--net/ieee802154/socket.c3
-rw-r--r--net/ife/Kconfig2
-rw-r--r--net/ipv4/Kconfig4
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/ip_output.c3
-rw-r--r--net/ipv4/route.c36
-rw-r--r--net/ipv4/tcp_bbr.c8
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv4/tcp_minisocks.c1
-rw-r--r--net/ipv4/tcp_timer.c5
-rw-r--r--net/ipv4/xfrm4_policy.c1
-rw-r--r--net/ipv6/fib6_rules.c3
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/ipv6/ip6_fib.c2
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/netfilter/Kconfig16
-rw-r--r--net/ipv6/tcp_ipv6.c24
-rw-r--r--net/kcm/kcmsock.c6
-rw-r--r--net/ncsi/internal.h7
-rw-r--r--net/ncsi/ncsi-manage.c98
-rw-r--r--net/netfilter/Kconfig2
-rw-r--r--net/netfilter/ipvs/Kconfig6
-rw-r--r--net/netfilter/nf_tables_api.c25
-rw-r--r--net/netfilter/nf_tables_offload.c2
-rw-r--r--net/netfilter/nft_flow_offload.c19
-rw-r--r--net/netfilter/nft_lookup.c3
-rw-r--r--net/nfc/llcp_sock.c7
-rw-r--r--net/openvswitch/datapath.c2
-rw-r--r--net/qrtr/qrtr.c1
-rw-r--r--net/rds/Kconfig4
-rw-r--r--net/rds/bind.c5
-rw-r--r--net/sched/Kconfig145
-rw-r--r--net/sched/act_api.c34
-rw-r--r--net/sched/act_sample.c1
-rw-r--r--net/sched/cls_api.c6
-rw-r--r--net/sched/sch_api.c3
-rw-r--r--net/sched/sch_cbs.c30
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_multiq.c23
-rw-r--r--net/sched/sch_netem.c4
-rw-r--r--net/sched/sch_sfb.c7
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/xdp/xdp_umem.c2
-rw-r--r--tools/lib/bpf/btf_dump.c94
-rw-r--r--tools/lib/bpf/xsk.c11
-rw-r--r--tools/testing/selftests/bpf/prog_tests/tcp_rtt.c21
-rw-r--r--tools/testing/selftests/bpf/progs/strobemeta.h5
-rw-r--r--tools/testing/selftests/bpf/test_sysctl.c1
-rwxr-xr-xtools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh7
-rwxr-xr-xtools/testing/selftests/net/fib_nexthop_multiprefix.sh6
-rwxr-xr-xtools/testing/selftests/net/fib_nexthops.sh14
-rwxr-xr-xtools/testing/selftests/net/fib_tests.sh21
-rw-r--r--usr/include/Makefile1
169 files changed, 1225 insertions, 1307 deletions
diff --git a/Documentation/devicetree/bindings/net/adi,adin.yaml b/Documentation/devicetree/bindings/net/adi,adin.yaml
index 69375cb28e92..d95cc691a65f 100644
--- a/Documentation/devicetree/bindings/net/adi,adin.yaml
+++ b/Documentation/devicetree/bindings/net/adi,adin.yaml
@@ -36,12 +36,6 @@ properties:
36 enum: [ 4, 8, 12, 16, 20, 24 ] 36 enum: [ 4, 8, 12, 16, 20, 24 ]
37 default: 8 37 default: 8
38 38
39 adi,disable-energy-detect:
40 description: |
41 Disables Energy Detect Powerdown Mode (default disabled, i.e energy detect
42 is enabled if this property is unspecified)
43 type: boolean
44
45examples: 39examples:
46 - | 40 - |
47 ethernet { 41 ethernet {
@@ -68,6 +62,5 @@ examples:
68 reg = <1>; 62 reg = <1>;
69 63
70 adi,fifo-depth-bits = <16>; 64 adi,fifo-depth-bits = <16>;
71 adi,disable-energy-detect;
72 }; 65 };
73 }; 66 };
diff --git a/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt b/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
index 5100358177c9..b921731cd970 100644
--- a/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
+++ b/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
@@ -12,8 +12,36 @@ and therefore may overwrite them.
12KSZ9021: 12KSZ9021:
13 13
14 All skew control options are specified in picoseconds. The minimum 14 All skew control options are specified in picoseconds. The minimum
15 value is 0, the maximum value is 3000, and it is incremented by 200ps 15 value is 0, the maximum value is 3000, and it can be specified in 200ps
16 steps. 16 steps, *but* these values are in not fact what you get because this chip's
17 skew values actually increase in 120ps steps, starting from -840ps. The
18 incorrect values came from an error in the original KSZ9021 datasheet
19 before it was corrected in revision 1.2 (Feb 2014), but it is too late to
20 change the driver now because of the many existing device trees that have
21 been created using values that go up in increments of 200.
22
23 The following table shows the actual skew delay you will get for each of the
24 possible devicetree values, and the number that will be programmed into the
25 corresponding pad skew register:
26
27 Device Tree Value Delay Pad Skew Register Value
28 -----------------------------------------------------
29 0 -840ps 0000
30 200 -720ps 0001
31 400 -600ps 0010
32 600 -480ps 0011
33 800 -360ps 0100
34 1000 -240ps 0101
35 1200 -120ps 0110
36 1400 0ps 0111
37 1600 120ps 1000
38 1800 240ps 1001
39 2000 360ps 1010
40 2200 480ps 1011
41 2400 600ps 1100
42 2600 720ps 1101
43 2800 840ps 1110
44 3000 960ps 1111
17 45
18 Optional properties: 46 Optional properties:
19 47
diff --git a/Documentation/devicetree/bindings/net/renesas,ravb.txt b/Documentation/devicetree/bindings/net/renesas,ravb.txt
index 7ad36213093e..5df4aa7f6811 100644
--- a/Documentation/devicetree/bindings/net/renesas,ravb.txt
+++ b/Documentation/devicetree/bindings/net/renesas,ravb.txt
@@ -18,6 +18,7 @@ Required properties:
18 R-Car Gen2 and RZ/G1 devices. 18 R-Car Gen2 and RZ/G1 devices.
19 19
20 - "renesas,etheravb-r8a774a1" for the R8A774A1 SoC. 20 - "renesas,etheravb-r8a774a1" for the R8A774A1 SoC.
21 - "renesas,etheravb-r8a774b1" for the R8A774B1 SoC.
21 - "renesas,etheravb-r8a774c0" for the R8A774C0 SoC. 22 - "renesas,etheravb-r8a774c0" for the R8A774C0 SoC.
22 - "renesas,etheravb-r8a7795" for the R8A7795 SoC. 23 - "renesas,etheravb-r8a7795" for the R8A7795 SoC.
23 - "renesas,etheravb-r8a7796" for the R8A7796 SoC. 24 - "renesas,etheravb-r8a7796" for the R8A7796 SoC.
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index ebe4537a7cce..4845e29411e4 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -113,7 +113,7 @@ properties:
113 const: stmmaceth 113 const: stmmaceth
114 114
115 mac-mode: 115 mac-mode:
116 maxItems: 1 116 $ref: ethernet-controller.yaml#/properties/phy-connection-type
117 description: 117 description:
118 The property is identical to 'phy-mode', and assumes that there is mode 118 The property is identical to 'phy-mode', and assumes that there is mode
119 converter in-between the MAC & PHY (e.g. GMII-to-RGMII). This converter 119 converter in-between the MAC & PHY (e.g. GMII-to-RGMII). This converter
diff --git a/Documentation/networking/devlink-trap.rst b/Documentation/networking/devlink-trap.rst
index c20c7c483664..8e90a85f3bd5 100644
--- a/Documentation/networking/devlink-trap.rst
+++ b/Documentation/networking/devlink-trap.rst
@@ -143,7 +143,8 @@ be added to the following table:
143 * - ``port_list_is_empty`` 143 * - ``port_list_is_empty``
144 - ``drop`` 144 - ``drop``
145 - Traps packets that the device decided to drop in case they need to be 145 - Traps packets that the device decided to drop in case they need to be
146 flooded and the flood list is empty 146 flooded (e.g., unknown unicast, unregistered multicast) and there are
147 no ports the packets should be flooded to
147 * - ``port_loopback_filter`` 148 * - ``port_loopback_filter``
148 - ``drop`` 149 - ``drop``
149 - Traps packets that the device decided to drop in case after layer 2 150 - Traps packets that the device decided to drop in case after layer 2
diff --git a/MAINTAINERS b/MAINTAINERS
index 857611c746c4..296de2b51c83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -643,6 +643,7 @@ F: drivers/net/ethernet/alacritech/*
643 643
644FORCEDETH GIGABIT ETHERNET DRIVER 644FORCEDETH GIGABIT ETHERNET DRIVER
645M: Rain River <rain.1986.08.12@gmail.com> 645M: Rain River <rain.1986.08.12@gmail.com>
646M: Zhu Yanjun <yanjun.zhu@oracle.com>
646L: netdev@vger.kernel.org 647L: netdev@vger.kernel.org
647S: Maintained 648S: Maintained
648F: drivers/net/ethernet/nvidia/* 649F: drivers/net/ethernet/nvidia/*
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 70b00ae4ec38..8af793f5e811 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1690,7 +1690,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
1690 1690
1691 if (RBRQ_HBUF_ERR(he_dev->rbrq_head)) { 1691 if (RBRQ_HBUF_ERR(he_dev->rbrq_head)) {
1692 hprintk("HBUF_ERR! (cid 0x%x)\n", cid); 1692 hprintk("HBUF_ERR! (cid 0x%x)\n", cid);
1693 atomic_inc(&vcc->stats->rx_drop); 1693 atomic_inc(&vcc->stats->rx_drop);
1694 goto return_host_buffers; 1694 goto return_host_buffers;
1695 } 1695 }
1696 1696
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 1dd467bed8fc..6d7ec371e7b2 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -352,7 +352,7 @@ static bool has_gateway(const struct dst_entry *dst, sa_family_t family)
352 352
353 if (family == AF_INET) { 353 if (family == AF_INET) {
354 rt = container_of(dst, struct rtable, dst); 354 rt = container_of(dst, struct rtable, dst);
355 return rt->rt_gw_family == AF_INET; 355 return rt->rt_uses_gateway;
356 } 356 }
357 357
358 rt6 = container_of(dst, struct rt6_info, dst); 358 rt6 = container_of(dst, struct rt6_info, dst);
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index c6ba37df4b9d..dff4132b3702 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -754,6 +754,8 @@ base_sock_create(struct net *net, struct socket *sock, int protocol, int kern)
754 754
755 if (sock->type != SOCK_RAW) 755 if (sock->type != SOCK_RAW)
756 return -ESOCKTNOSUPPORT; 756 return -ESOCKTNOSUPPORT;
757 if (!capable(CAP_NET_RAW))
758 return -EPERM;
757 759
758 sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern); 760 sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
759 if (!sk) 761 if (!sk)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 48e209e55843..df1c7989e13d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -487,7 +487,7 @@ config FUJITSU_ES
487 depends on ACPI 487 depends on ACPI
488 help 488 help
489 This driver provides support for Extended Socket network device 489 This driver provides support for Extended Socket network device
490 on Extended Partitioning of FUJITSU PRIMEQUEST 2000 E2 series. 490 on Extended Partitioning of FUJITSU PRIMEQUEST 2000 E2 series.
491 491
492config THUNDERBOLT_NET 492config THUNDERBOLT_NET
493 tristate "Networking over Thunderbolt cable" 493 tristate "Networking over Thunderbolt cable"
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index faeb4419b205..27551bf3d7e4 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -56,19 +56,19 @@ config ARCNET_CAP
56 tristate "Enable CAP mode packet interface" 56 tristate "Enable CAP mode packet interface"
57 help 57 help
58 ARCnet "cap mode" packet encapsulation. Used to get the hardware 58 ARCnet "cap mode" packet encapsulation. Used to get the hardware
59 acknowledge back to userspace. After the initial protocol byte every 59 acknowledge back to userspace. After the initial protocol byte every
60 packet is stuffed with an extra 4 byte "cookie" which doesn't 60 packet is stuffed with an extra 4 byte "cookie" which doesn't
61 actually appear on the network. After transmit the driver will send 61 actually appear on the network. After transmit the driver will send
62 back a packet with protocol byte 0 containing the status of the 62 back a packet with protocol byte 0 containing the status of the
63 transmission: 63 transmission:
64 0=no hardware acknowledge 64 0=no hardware acknowledge
65 1=excessive nak 65 1=excessive nak
66 2=transmission accepted by the receiver hardware 66 2=transmission accepted by the receiver hardware
67 67
68 Received packets are also stuffed with the extra 4 bytes but it will 68 Received packets are also stuffed with the extra 4 bytes but it will
69 be random data. 69 be random data.
70 70
71 Cap only listens to protocol 1-8. 71 Cap only listens to protocol 1-8.
72 72
73config ARCNET_COM90xx 73config ARCNET_COM90xx
74 tristate "ARCnet COM90xx (normal) chipset driver" 74 tristate "ARCnet COM90xx (normal) chipset driver"
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 8459115d9d4e..553776cc1d29 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -1063,31 +1063,34 @@ EXPORT_SYMBOL(arcnet_interrupt);
1063static void arcnet_rx(struct net_device *dev, int bufnum) 1063static void arcnet_rx(struct net_device *dev, int bufnum)
1064{ 1064{
1065 struct arcnet_local *lp = netdev_priv(dev); 1065 struct arcnet_local *lp = netdev_priv(dev);
1066 struct archdr pkt; 1066 union {
1067 struct archdr pkt;
1068 char buf[512];
1069 } rxdata;
1067 struct arc_rfc1201 *soft; 1070 struct arc_rfc1201 *soft;
1068 int length, ofs; 1071 int length, ofs;
1069 1072
1070 soft = &pkt.soft.rfc1201; 1073 soft = &rxdata.pkt.soft.rfc1201;
1071 1074
1072 lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE); 1075 lp->hw.copy_from_card(dev, bufnum, 0, &rxdata.pkt, ARC_HDR_SIZE);
1073 if (pkt.hard.offset[0]) { 1076 if (rxdata.pkt.hard.offset[0]) {
1074 ofs = pkt.hard.offset[0]; 1077 ofs = rxdata.pkt.hard.offset[0];
1075 length = 256 - ofs; 1078 length = 256 - ofs;
1076 } else { 1079 } else {
1077 ofs = pkt.hard.offset[1]; 1080 ofs = rxdata.pkt.hard.offset[1];
1078 length = 512 - ofs; 1081 length = 512 - ofs;
1079 } 1082 }
1080 1083
1081 /* get the full header, if possible */ 1084 /* get the full header, if possible */
1082 if (sizeof(pkt.soft) <= length) { 1085 if (sizeof(rxdata.pkt.soft) <= length) {
1083 lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(pkt.soft)); 1086 lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(rxdata.pkt.soft));
1084 } else { 1087 } else {
1085 memset(&pkt.soft, 0, sizeof(pkt.soft)); 1088 memset(&rxdata.pkt.soft, 0, sizeof(rxdata.pkt.soft));
1086 lp->hw.copy_from_card(dev, bufnum, ofs, soft, length); 1089 lp->hw.copy_from_card(dev, bufnum, ofs, soft, length);
1087 } 1090 }
1088 1091
1089 arc_printk(D_DURING, dev, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n", 1092 arc_printk(D_DURING, dev, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n",
1090 bufnum, pkt.hard.source, pkt.hard.dest, length); 1093 bufnum, rxdata.pkt.hard.source, rxdata.pkt.hard.dest, length);
1091 1094
1092 dev->stats.rx_packets++; 1095 dev->stats.rx_packets++;
1093 dev->stats.rx_bytes += length + ARC_HDR_SIZE; 1096 dev->stats.rx_bytes += length + ARC_HDR_SIZE;
@@ -1096,13 +1099,13 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
1096 if (arc_proto_map[soft->proto]->is_ip) { 1099 if (arc_proto_map[soft->proto]->is_ip) {
1097 if (BUGLVL(D_PROTO)) { 1100 if (BUGLVL(D_PROTO)) {
1098 struct ArcProto 1101 struct ArcProto
1099 *oldp = arc_proto_map[lp->default_proto[pkt.hard.source]], 1102 *oldp = arc_proto_map[lp->default_proto[rxdata.pkt.hard.source]],
1100 *newp = arc_proto_map[soft->proto]; 1103 *newp = arc_proto_map[soft->proto];
1101 1104
1102 if (oldp != newp) { 1105 if (oldp != newp) {
1103 arc_printk(D_PROTO, dev, 1106 arc_printk(D_PROTO, dev,
1104 "got protocol %02Xh; encap for host %02Xh is now '%c' (was '%c')\n", 1107 "got protocol %02Xh; encap for host %02Xh is now '%c' (was '%c')\n",
1105 soft->proto, pkt.hard.source, 1108 soft->proto, rxdata.pkt.hard.source,
1106 newp->suffix, oldp->suffix); 1109 newp->suffix, oldp->suffix);
1107 } 1110 }
1108 } 1111 }
@@ -1111,10 +1114,10 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
1111 lp->default_proto[0] = soft->proto; 1114 lp->default_proto[0] = soft->proto;
1112 1115
1113 /* in striking contrast, the following isn't a hack. */ 1116 /* in striking contrast, the following isn't a hack. */
1114 lp->default_proto[pkt.hard.source] = soft->proto; 1117 lp->default_proto[rxdata.pkt.hard.source] = soft->proto;
1115 } 1118 }
1116 /* call the protocol-specific receiver. */ 1119 /* call the protocol-specific receiver. */
1117 arc_proto_map[soft->proto]->rx(dev, bufnum, &pkt, length); 1120 arc_proto_map[soft->proto]->rx(dev, bufnum, &rxdata.pkt, length);
1118} 1121}
1119 1122
1120static void null_rx(struct net_device *dev, int bufnum, 1123static void null_rx(struct net_device *dev, int bufnum,
diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig
index 4b3d0ddcda79..b412f7ba4f89 100644
--- a/drivers/net/can/usb/Kconfig
+++ b/drivers/net/can/usb/Kconfig
@@ -15,10 +15,10 @@ config CAN_EMS_USB
15 from EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de). 15 from EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de).
16 16
17config CAN_ESD_USB2 17config CAN_ESD_USB2
18 tristate "ESD USB/2 CAN/USB interface" 18 tristate "ESD USB/2 CAN/USB interface"
19 ---help--- 19 ---help---
20 This driver supports the CAN-USB/2 interface 20 This driver supports the CAN-USB/2 interface
21 from esd electronic system design gmbh (http://www.esd.eu). 21 from esd electronic system design gmbh (http://www.esd.eu).
22 22
23config CAN_GS_USB 23config CAN_GS_USB
24 tristate "Geschwister Schneider UG interfaces" 24 tristate "Geschwister Schneider UG interfaces"
diff --git a/drivers/net/dsa/b53/b53_serdes.h b/drivers/net/dsa/b53/b53_serdes.h
index 3bb4f91aec9e..55d280fe38e4 100644
--- a/drivers/net/dsa/b53/b53_serdes.h
+++ b/drivers/net/dsa/b53/b53_serdes.h
@@ -1,5 +1,5 @@
1/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause 1/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
2 * 2/*
3 * Northstar Plus switch SerDes/SGMII PHY definitions 3 * Northstar Plus switch SerDes/SGMII PHY definitions
4 * 4 *
5 * Copyright (C) 2018 Florian Fainelli <f.fainelli@gmail.com> 5 * Copyright (C) 2018 Florian Fainelli <f.fainelli@gmail.com>
diff --git a/drivers/net/dsa/lantiq_pce.h b/drivers/net/dsa/lantiq_pce.h
index 180663138e75..e2be31f3672a 100644
--- a/drivers/net/dsa/lantiq_pce.h
+++ b/drivers/net/dsa/lantiq_pce.h
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0 1/* SPDX-License-Identifier: GPL-2.0 */
2/* 2/*
3 * PCE microcode extracted from UGW 7.1.1 switch api 3 * PCE microcode extracted from UGW 7.1.1 switch api
4 * 4 *
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index a24d8e61fbe7..dd60d0837fc6 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -303,7 +303,7 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset,
303 { \ 303 { \
304 .name = #width, \ 304 .name = #width, \
305 .val_bits = (width), \ 305 .val_bits = (width), \
306 .reg_stride = (width) / 8, \ 306 .reg_stride = 1, \
307 .reg_bits = (regbits) + (regalign), \ 307 .reg_bits = (regbits) + (regalign), \
308 .pad_bits = (regpad), \ 308 .pad_bits = (regpad), \
309 .max_register = BIT(regbits) - 1, \ 309 .max_register = BIT(regbits) - 1, \
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 16f15c93a102..684aa51684db 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -936,6 +936,9 @@ qca8k_port_enable(struct dsa_switch *ds, int port,
936{ 936{
937 struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; 937 struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
938 938
939 if (!dsa_is_user_port(ds, port))
940 return 0;
941
939 qca8k_port_set_status(priv, port, 1); 942 qca8k_port_set_status(priv, port, 1);
940 priv->port_sts[port].enabled = 1; 943 priv->port_sts[port].enabled = 1;
941 944
diff --git a/drivers/net/dsa/sja1105/Kconfig b/drivers/net/dsa/sja1105/Kconfig
index 55424f39cb0d..f40b248f0b23 100644
--- a/drivers/net/dsa/sja1105/Kconfig
+++ b/drivers/net/dsa/sja1105/Kconfig
@@ -27,6 +27,7 @@ config NET_DSA_SJA1105_PTP
27config NET_DSA_SJA1105_TAS 27config NET_DSA_SJA1105_TAS
28 bool "Support for the Time-Aware Scheduler on NXP SJA1105" 28 bool "Support for the Time-Aware Scheduler on NXP SJA1105"
29 depends on NET_DSA_SJA1105 29 depends on NET_DSA_SJA1105
30 depends on NET_SCH_TAPRIO
30 help 31 help
31 This enables support for the TTEthernet-based egress scheduling 32 This enables support for the TTEthernet-based egress scheduling
32 engine in the SJA1105 DSA driver, which is controlled using a 33 engine in the SJA1105 DSA driver, which is controlled using a
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 1e2de9d062bf..e8e9c166185d 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -140,17 +140,6 @@ source "drivers/net/ethernet/neterion/Kconfig"
140source "drivers/net/ethernet/netronome/Kconfig" 140source "drivers/net/ethernet/netronome/Kconfig"
141source "drivers/net/ethernet/ni/Kconfig" 141source "drivers/net/ethernet/ni/Kconfig"
142source "drivers/net/ethernet/8390/Kconfig" 142source "drivers/net/ethernet/8390/Kconfig"
143
144config NET_NETX
145 tristate "NetX Ethernet support"
146 select MII
147 depends on ARCH_NETX
148 ---help---
149 This is support for the Hilscher netX builtin Ethernet ports
150
151 To compile this driver as a module, choose M here. The module
152 will be called netx-eth.
153
154source "drivers/net/ethernet/nvidia/Kconfig" 143source "drivers/net/ethernet/nvidia/Kconfig"
155source "drivers/net/ethernet/nxp/Kconfig" 144source "drivers/net/ethernet/nxp/Kconfig"
156source "drivers/net/ethernet/oki-semi/Kconfig" 145source "drivers/net/ethernet/oki-semi/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 77f9838a76c9..05abebc17804 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -64,7 +64,6 @@ obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/
64obj-$(CONFIG_NET_VENDOR_NETERION) += neterion/ 64obj-$(CONFIG_NET_VENDOR_NETERION) += neterion/
65obj-$(CONFIG_NET_VENDOR_NETRONOME) += netronome/ 65obj-$(CONFIG_NET_VENDOR_NETRONOME) += netronome/
66obj-$(CONFIG_NET_VENDOR_NI) += ni/ 66obj-$(CONFIG_NET_VENDOR_NI) += ni/
67obj-$(CONFIG_NET_NETX) += netx-eth.o
68obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/ 67obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/
69obj-$(CONFIG_LPC_ENET) += nxp/ 68obj-$(CONFIG_LPC_ENET) += nxp/
70obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/ 69obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/
diff --git a/drivers/net/ethernet/allwinner/Kconfig b/drivers/net/ethernet/allwinner/Kconfig
index a5e2bcbf2722..264a482ec31d 100644
--- a/drivers/net/ethernet/allwinner/Kconfig
+++ b/drivers/net/ethernet/allwinner/Kconfig
@@ -21,17 +21,17 @@ config NET_VENDOR_ALLWINNER
21if NET_VENDOR_ALLWINNER 21if NET_VENDOR_ALLWINNER
22 22
23config SUN4I_EMAC 23config SUN4I_EMAC
24 tristate "Allwinner A10 EMAC support" 24 tristate "Allwinner A10 EMAC support"
25 depends on ARCH_SUNXI 25 depends on ARCH_SUNXI
26 depends on OF 26 depends on OF
27 select CRC32 27 select CRC32
28 select MII 28 select MII
29 select PHYLIB 29 select PHYLIB
30 select MDIO_SUN4I 30 select MDIO_SUN4I
31 ---help--- 31 ---help---
32 Support for Allwinner A10 EMAC ethernet driver. 32 Support for Allwinner A10 EMAC ethernet driver.
33 33
34 To compile this driver as a module, choose M here. The module 34 To compile this driver as a module, choose M here. The module
35 will be called sun4i-emac. 35 will be called sun4i-emac.
36 36
37endif # NET_VENDOR_ALLWINNER 37endif # NET_VENDOR_ALLWINNER
diff --git a/drivers/net/ethernet/amazon/Kconfig b/drivers/net/ethernet/amazon/Kconfig
index 69ca99d8ac26..cca72a75f551 100644
--- a/drivers/net/ethernet/amazon/Kconfig
+++ b/drivers/net/ethernet/amazon/Kconfig
@@ -19,6 +19,7 @@ if NET_VENDOR_AMAZON
19config ENA_ETHERNET 19config ENA_ETHERNET
20 tristate "Elastic Network Adapter (ENA) support" 20 tristate "Elastic Network Adapter (ENA) support"
21 depends on PCI_MSI && !CPU_BIG_ENDIAN 21 depends on PCI_MSI && !CPU_BIG_ENDIAN
22 select DIMLIB
22 ---help--- 23 ---help---
23 This driver supports Elastic Network Adapter (ENA)" 24 This driver supports Elastic Network Adapter (ENA)"
24 25
diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.c b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
index 38046bf0ff44..2845ac277724 100644
--- a/drivers/net/ethernet/amazon/ena/ena_eth_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
@@ -211,8 +211,8 @@ static int ena_com_sq_update_llq_tail(struct ena_com_io_sq *io_sq)
211 211
212 pkt_ctrl->curr_bounce_buf = 212 pkt_ctrl->curr_bounce_buf =
213 ena_com_get_next_bounce_buffer(&io_sq->bounce_buf_ctrl); 213 ena_com_get_next_bounce_buffer(&io_sq->bounce_buf_ctrl);
214 memset(io_sq->llq_buf_ctrl.curr_bounce_buf, 214 memset(io_sq->llq_buf_ctrl.curr_bounce_buf,
215 0x0, llq_info->desc_list_entry_size); 215 0x0, llq_info->desc_list_entry_size);
216 216
217 pkt_ctrl->idx = 0; 217 pkt_ctrl->idx = 0;
218 if (unlikely(llq_info->desc_stride_ctrl == ENA_ADMIN_SINGLE_DESC_PER_ENTRY)) 218 if (unlikely(llq_info->desc_stride_ctrl == ENA_ADMIN_SINGLE_DESC_PER_ENTRY))
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index 28892b8acd0e..a95c263a45aa 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -306,15 +306,13 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private)
306{ 306{
307 struct aq_vec_s *self = private; 307 struct aq_vec_s *self = private;
308 u64 irq_mask = 0U; 308 u64 irq_mask = 0U;
309 irqreturn_t err = 0; 309 int err;
310 310
311 if (!self) { 311 if (!self)
312 err = -EINVAL; 312 return IRQ_NONE;
313 goto err_exit;
314 }
315 err = self->aq_hw_ops->hw_irq_read(self->aq_hw, &irq_mask); 313 err = self->aq_hw_ops->hw_irq_read(self->aq_hw, &irq_mask);
316 if (err < 0) 314 if (err < 0)
317 goto err_exit; 315 return IRQ_NONE;
318 316
319 if (irq_mask) { 317 if (irq_mask) {
320 self->aq_hw_ops->hw_irq_disable(self->aq_hw, 318 self->aq_hw_ops->hw_irq_disable(self->aq_hw,
@@ -322,11 +320,10 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private)
322 napi_schedule(&self->napi); 320 napi_schedule(&self->napi);
323 } else { 321 } else {
324 self->aq_hw_ops->hw_irq_enable(self->aq_hw, 1U); 322 self->aq_hw_ops->hw_irq_enable(self->aq_hw, 1U);
325 err = IRQ_NONE; 323 return IRQ_NONE;
326 } 324 }
327 325
328err_exit: 326 return IRQ_HANDLED;
329 return err >= 0 ? IRQ_HANDLED : IRQ_NONE;
330} 327}
331 328
332cpumask_t *aq_vec_get_affinity_mask(struct aq_vec_s *self) 329cpumask_t *aq_vec_get_affinity_mask(struct aq_vec_s *self)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 7df887e4024c..a977a459bd20 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2481,7 +2481,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
2481 2481
2482 priv->phy_interface = of_get_phy_mode(dn); 2482 priv->phy_interface = of_get_phy_mode(dn);
2483 /* Default to GMII interface mode */ 2483 /* Default to GMII interface mode */
2484 if (priv->phy_interface < 0) 2484 if ((int)priv->phy_interface < 0)
2485 priv->phy_interface = PHY_INTERFACE_MODE_GMII; 2485 priv->phy_interface = PHY_INTERFACE_MODE_GMII;
2486 2486
2487 /* In the case of a fixed PHY, the DT node associated 2487 /* In the case of a fixed PHY, the DT node associated
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 35b59b5edf0f..8e8d557901a9 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -165,9 +165,8 @@ static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int desc_idx
165#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 165#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
166static struct macb_dma_desc_64 *macb_64b_desc(struct macb *bp, struct macb_dma_desc *desc) 166static struct macb_dma_desc_64 *macb_64b_desc(struct macb *bp, struct macb_dma_desc *desc)
167{ 167{
168 if (bp->hw_dma_cap & HW_DMA_CAP_64B) 168 return (struct macb_dma_desc_64 *)((void *)desc
169 return (struct macb_dma_desc_64 *)((void *)desc + sizeof(struct macb_dma_desc)); 169 + sizeof(struct macb_dma_desc));
170 return NULL;
171} 170}
172#endif 171#endif
173 172
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 71854a19cebe..38024877751c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -5701,7 +5701,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5701 whoami = t4_read_reg(adapter, PL_WHOAMI_A); 5701 whoami = t4_read_reg(adapter, PL_WHOAMI_A);
5702 pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id); 5702 pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
5703 chip = t4_get_chip_type(adapter, CHELSIO_PCI_ID_VER(device_id)); 5703 chip = t4_get_chip_type(adapter, CHELSIO_PCI_ID_VER(device_id));
5704 if (chip < 0) { 5704 if ((int)chip < 0) {
5705 dev_err(&pdev->dev, "Device %d is not supported\n", device_id); 5705 dev_err(&pdev->dev, "Device %d is not supported\n", device_id);
5706 err = chip; 5706 err = chip;
5707 goto out_free_adapter; 5707 goto out_free_adapter;
diff --git a/drivers/net/ethernet/emulex/benet/Kconfig b/drivers/net/ethernet/emulex/benet/Kconfig
index e8c7eb842dbe..17d300ea9955 100644
--- a/drivers/net/ethernet/emulex/benet/Kconfig
+++ b/drivers/net/ethernet/emulex/benet/Kconfig
@@ -48,5 +48,5 @@ config BE2NET_SKYHAWK
48 chipsets. (e.g. OneConnect OCe14xxx) 48 chipsets. (e.g. OneConnect OCe14xxx)
49 49
50comment "WARNING: be2net is useless without any enabled chip" 50comment "WARNING: be2net is useless without any enabled chip"
51 depends on BE2NET_BE2=n && BE2NET_BE3=n && BE2NET_LANCER=n && \ 51 depends on BE2NET_BE2=n && BE2NET_BE3=n && BE2NET_LANCER=n && \
52 BE2NET_SKYHAWK=n && BE2NET 52 BE2NET_SKYHAWK=n && BE2NET
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 7d6513ff8507..b73421c3e25b 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -785,7 +785,7 @@ static int enetc_of_get_phy(struct enetc_ndev_priv *priv)
785 } 785 }
786 786
787 priv->if_mode = of_get_phy_mode(np); 787 priv->if_mode = of_get_phy_mode(np);
788 if (priv->if_mode < 0) { 788 if ((int)priv->if_mode < 0) {
789 dev_err(priv->dev, "missing phy type\n"); 789 dev_err(priv->dev, "missing phy type\n");
790 of_node_put(priv->phy_node); 790 of_node_put(priv->phy_node);
791 if (of_phy_is_fixed_link(np)) 791 if (of_phy_is_fixed_link(np))
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 24bf7f68375f..51ad86417cb1 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2067,7 +2067,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
2067 return 0; 2067 return 0;
2068} 2068}
2069 2069
2070void reset_gfar(struct net_device *ndev) 2070static void reset_gfar(struct net_device *ndev)
2071{ 2071{
2072 struct gfar_private *priv = netdev_priv(ndev); 2072 struct gfar_private *priv = netdev_priv(ndev);
2073 2073
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index 95a6b0926170..c41b19c760f8 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1194,7 +1194,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
1194 goto err_free_mdio; 1194 goto err_free_mdio;
1195 1195
1196 priv->phy_mode = of_get_phy_mode(node); 1196 priv->phy_mode = of_get_phy_mode(node);
1197 if (priv->phy_mode < 0) { 1197 if ((int)priv->phy_mode < 0) {
1198 netdev_err(ndev, "not find phy-mode\n"); 1198 netdev_err(ndev, "not find phy-mode\n");
1199 ret = -EINVAL; 1199 ret = -EINVAL;
1200 goto err_mdiobus; 1200 goto err_mdiobus;
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 2e5172f61564..2b073a3c0b84 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1207,7 +1207,7 @@ static void ibmvnic_cleanup(struct net_device *netdev)
1207 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 1207 struct ibmvnic_adapter *adapter = netdev_priv(netdev);
1208 1208
1209 /* ensure that transmissions are stopped if called by do_reset */ 1209 /* ensure that transmissions are stopped if called by do_reset */
1210 if (adapter->resetting) 1210 if (test_bit(0, &adapter->resetting))
1211 netif_tx_disable(netdev); 1211 netif_tx_disable(netdev);
1212 else 1212 else
1213 netif_tx_stop_all_queues(netdev); 1213 netif_tx_stop_all_queues(netdev);
@@ -1428,7 +1428,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
1428 u8 proto = 0; 1428 u8 proto = 0;
1429 netdev_tx_t ret = NETDEV_TX_OK; 1429 netdev_tx_t ret = NETDEV_TX_OK;
1430 1430
1431 if (adapter->resetting) { 1431 if (test_bit(0, &adapter->resetting)) {
1432 if (!netif_subqueue_stopped(netdev, skb)) 1432 if (!netif_subqueue_stopped(netdev, skb))
1433 netif_stop_subqueue(netdev, queue_num); 1433 netif_stop_subqueue(netdev, queue_num);
1434 dev_kfree_skb_any(skb); 1434 dev_kfree_skb_any(skb);
@@ -1724,6 +1724,86 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
1724} 1724}
1725 1725
1726/** 1726/**
1727 * do_change_param_reset returns zero if we are able to keep processing reset
1728 * events, or non-zero if we hit a fatal error and must halt.
1729 */
1730static int do_change_param_reset(struct ibmvnic_adapter *adapter,
1731 struct ibmvnic_rwi *rwi,
1732 u32 reset_state)
1733{
1734 struct net_device *netdev = adapter->netdev;
1735 int i, rc;
1736
1737 netdev_dbg(adapter->netdev, "Change param resetting driver (%d)\n",
1738 rwi->reset_reason);
1739
1740 netif_carrier_off(netdev);
1741 adapter->reset_reason = rwi->reset_reason;
1742
1743 ibmvnic_cleanup(netdev);
1744
1745 if (reset_state == VNIC_OPEN) {
1746 rc = __ibmvnic_close(netdev);
1747 if (rc)
1748 return rc;
1749 }
1750
1751 release_resources(adapter);
1752 release_sub_crqs(adapter, 1);
1753 release_crq_queue(adapter);
1754
1755 adapter->state = VNIC_PROBED;
1756
1757 rc = init_crq_queue(adapter);
1758
1759 if (rc) {
1760 netdev_err(adapter->netdev,
1761 "Couldn't initialize crq. rc=%d\n", rc);
1762 return rc;
1763 }
1764
1765 rc = ibmvnic_reset_init(adapter);
1766 if (rc)
1767 return IBMVNIC_INIT_FAILED;
1768
1769 /* If the adapter was in PROBE state prior to the reset,
1770 * exit here.
1771 */
1772 if (reset_state == VNIC_PROBED)
1773 return 0;
1774
1775 rc = ibmvnic_login(netdev);
1776 if (rc) {
1777 adapter->state = reset_state;
1778 return rc;
1779 }
1780
1781 rc = init_resources(adapter);
1782 if (rc)
1783 return rc;
1784
1785 ibmvnic_disable_irqs(adapter);
1786
1787 adapter->state = VNIC_CLOSED;
1788
1789 if (reset_state == VNIC_CLOSED)
1790 return 0;
1791
1792 rc = __ibmvnic_open(netdev);
1793 if (rc)
1794 return IBMVNIC_OPEN_FAILED;
1795
1796 /* refresh device's multicast list */
1797 ibmvnic_set_multi(netdev);
1798
1799 /* kick napi */
1800 for (i = 0; i < adapter->req_rx_queues; i++)
1801 napi_schedule(&adapter->napi[i]);
1802
1803 return 0;
1804}
1805
1806/**
1727 * do_reset returns zero if we are able to keep processing reset events, or 1807 * do_reset returns zero if we are able to keep processing reset events, or
1728 * non-zero if we hit a fatal error and must halt. 1808 * non-zero if we hit a fatal error and must halt.
1729 */ 1809 */
@@ -1738,6 +1818,8 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1738 netdev_dbg(adapter->netdev, "Re-setting driver (%d)\n", 1818 netdev_dbg(adapter->netdev, "Re-setting driver (%d)\n",
1739 rwi->reset_reason); 1819 rwi->reset_reason);
1740 1820
1821 rtnl_lock();
1822
1741 netif_carrier_off(netdev); 1823 netif_carrier_off(netdev);
1742 adapter->reset_reason = rwi->reset_reason; 1824 adapter->reset_reason = rwi->reset_reason;
1743 1825
@@ -1751,16 +1833,25 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1751 if (reset_state == VNIC_OPEN && 1833 if (reset_state == VNIC_OPEN &&
1752 adapter->reset_reason != VNIC_RESET_MOBILITY && 1834 adapter->reset_reason != VNIC_RESET_MOBILITY &&
1753 adapter->reset_reason != VNIC_RESET_FAILOVER) { 1835 adapter->reset_reason != VNIC_RESET_FAILOVER) {
1754 rc = __ibmvnic_close(netdev); 1836 adapter->state = VNIC_CLOSING;
1837
1838 /* Release the RTNL lock before link state change and
1839 * re-acquire after the link state change to allow
1840 * linkwatch_event to grab the RTNL lock and run during
1841 * a reset.
1842 */
1843 rtnl_unlock();
1844 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
1845 rtnl_lock();
1755 if (rc) 1846 if (rc)
1756 return rc; 1847 goto out;
1757 }
1758 1848
1759 if (adapter->reset_reason == VNIC_RESET_CHANGE_PARAM || 1849 if (adapter->state != VNIC_CLOSING) {
1760 adapter->wait_for_reset) { 1850 rc = -1;
1761 release_resources(adapter); 1851 goto out;
1762 release_sub_crqs(adapter, 1); 1852 }
1763 release_crq_queue(adapter); 1853
1854 adapter->state = VNIC_CLOSED;
1764 } 1855 }
1765 1856
1766 if (adapter->reset_reason != VNIC_RESET_NON_FATAL) { 1857 if (adapter->reset_reason != VNIC_RESET_NON_FATAL) {
@@ -1769,9 +1860,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1769 */ 1860 */
1770 adapter->state = VNIC_PROBED; 1861 adapter->state = VNIC_PROBED;
1771 1862
1772 if (adapter->wait_for_reset) { 1863 if (adapter->reset_reason == VNIC_RESET_MOBILITY) {
1773 rc = init_crq_queue(adapter);
1774 } else if (adapter->reset_reason == VNIC_RESET_MOBILITY) {
1775 rc = ibmvnic_reenable_crq_queue(adapter); 1864 rc = ibmvnic_reenable_crq_queue(adapter);
1776 release_sub_crqs(adapter, 1); 1865 release_sub_crqs(adapter, 1);
1777 } else { 1866 } else {
@@ -1783,36 +1872,35 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1783 if (rc) { 1872 if (rc) {
1784 netdev_err(adapter->netdev, 1873 netdev_err(adapter->netdev,
1785 "Couldn't initialize crq. rc=%d\n", rc); 1874 "Couldn't initialize crq. rc=%d\n", rc);
1786 return rc; 1875 goto out;
1787 } 1876 }
1788 1877
1789 rc = ibmvnic_reset_init(adapter); 1878 rc = ibmvnic_reset_init(adapter);
1790 if (rc) 1879 if (rc) {
1791 return IBMVNIC_INIT_FAILED; 1880 rc = IBMVNIC_INIT_FAILED;
1881 goto out;
1882 }
1792 1883
1793 /* If the adapter was in PROBE state prior to the reset, 1884 /* If the adapter was in PROBE state prior to the reset,
1794 * exit here. 1885 * exit here.
1795 */ 1886 */
1796 if (reset_state == VNIC_PROBED) 1887 if (reset_state == VNIC_PROBED) {
1797 return 0; 1888 rc = 0;
1889 goto out;
1890 }
1798 1891
1799 rc = ibmvnic_login(netdev); 1892 rc = ibmvnic_login(netdev);
1800 if (rc) { 1893 if (rc) {
1801 adapter->state = reset_state; 1894 adapter->state = reset_state;
1802 return rc; 1895 goto out;
1803 } 1896 }
1804 1897
1805 if (adapter->reset_reason == VNIC_RESET_CHANGE_PARAM || 1898 if (adapter->req_rx_queues != old_num_rx_queues ||
1806 adapter->wait_for_reset) { 1899 adapter->req_tx_queues != old_num_tx_queues ||
1807 rc = init_resources(adapter); 1900 adapter->req_rx_add_entries_per_subcrq !=
1808 if (rc) 1901 old_num_rx_slots ||
1809 return rc; 1902 adapter->req_tx_entries_per_subcrq !=
1810 } else if (adapter->req_rx_queues != old_num_rx_queues || 1903 old_num_tx_slots) {
1811 adapter->req_tx_queues != old_num_tx_queues ||
1812 adapter->req_rx_add_entries_per_subcrq !=
1813 old_num_rx_slots ||
1814 adapter->req_tx_entries_per_subcrq !=
1815 old_num_tx_slots) {
1816 release_rx_pools(adapter); 1904 release_rx_pools(adapter);
1817 release_tx_pools(adapter); 1905 release_tx_pools(adapter);
1818 release_napi(adapter); 1906 release_napi(adapter);
@@ -1820,32 +1908,30 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1820 1908
1821 rc = init_resources(adapter); 1909 rc = init_resources(adapter);
1822 if (rc) 1910 if (rc)
1823 return rc; 1911 goto out;
1824 1912
1825 } else { 1913 } else {
1826 rc = reset_tx_pools(adapter); 1914 rc = reset_tx_pools(adapter);
1827 if (rc) 1915 if (rc)
1828 return rc; 1916 goto out;
1829 1917
1830 rc = reset_rx_pools(adapter); 1918 rc = reset_rx_pools(adapter);
1831 if (rc) 1919 if (rc)
1832 return rc; 1920 goto out;
1833 } 1921 }
1834 ibmvnic_disable_irqs(adapter); 1922 ibmvnic_disable_irqs(adapter);
1835 } 1923 }
1836 adapter->state = VNIC_CLOSED; 1924 adapter->state = VNIC_CLOSED;
1837 1925
1838 if (reset_state == VNIC_CLOSED) 1926 if (reset_state == VNIC_CLOSED) {
1839 return 0; 1927 rc = 0;
1928 goto out;
1929 }
1840 1930
1841 rc = __ibmvnic_open(netdev); 1931 rc = __ibmvnic_open(netdev);
1842 if (rc) { 1932 if (rc) {
1843 if (list_empty(&adapter->rwi_list)) 1933 rc = IBMVNIC_OPEN_FAILED;
1844 adapter->state = VNIC_CLOSED; 1934 goto out;
1845 else
1846 adapter->state = reset_state;
1847
1848 return 0;
1849 } 1935 }
1850 1936
1851 /* refresh device's multicast list */ 1937 /* refresh device's multicast list */
@@ -1855,11 +1941,15 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1855 for (i = 0; i < adapter->req_rx_queues; i++) 1941 for (i = 0; i < adapter->req_rx_queues; i++)
1856 napi_schedule(&adapter->napi[i]); 1942 napi_schedule(&adapter->napi[i]);
1857 1943
1858 if (adapter->reset_reason != VNIC_RESET_FAILOVER && 1944 if (adapter->reset_reason != VNIC_RESET_FAILOVER)
1859 adapter->reset_reason != VNIC_RESET_CHANGE_PARAM)
1860 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); 1945 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev);
1861 1946
1862 return 0; 1947 rc = 0;
1948
1949out:
1950 rtnl_unlock();
1951
1952 return rc;
1863} 1953}
1864 1954
1865static int do_hard_reset(struct ibmvnic_adapter *adapter, 1955static int do_hard_reset(struct ibmvnic_adapter *adapter,
@@ -1919,14 +2009,8 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
1919 return 0; 2009 return 0;
1920 2010
1921 rc = __ibmvnic_open(netdev); 2011 rc = __ibmvnic_open(netdev);
1922 if (rc) { 2012 if (rc)
1923 if (list_empty(&adapter->rwi_list)) 2013 return IBMVNIC_OPEN_FAILED;
1924 adapter->state = VNIC_CLOSED;
1925 else
1926 adapter->state = reset_state;
1927
1928 return 0;
1929 }
1930 2014
1931 return 0; 2015 return 0;
1932} 2016}
@@ -1965,20 +2049,17 @@ static void __ibmvnic_reset(struct work_struct *work)
1965{ 2049{
1966 struct ibmvnic_rwi *rwi; 2050 struct ibmvnic_rwi *rwi;
1967 struct ibmvnic_adapter *adapter; 2051 struct ibmvnic_adapter *adapter;
1968 bool we_lock_rtnl = false;
1969 u32 reset_state; 2052 u32 reset_state;
1970 int rc = 0; 2053 int rc = 0;
1971 2054
1972 adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset); 2055 adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset);
1973 2056
1974 /* netif_set_real_num_xx_queues needs to take rtnl lock here 2057 if (test_and_set_bit_lock(0, &adapter->resetting)) {
1975 * unless wait_for_reset is set, in which case the rtnl lock 2058 schedule_delayed_work(&adapter->ibmvnic_delayed_reset,
1976 * has already been taken before initializing the reset 2059 IBMVNIC_RESET_DELAY);
1977 */ 2060 return;
1978 if (!adapter->wait_for_reset) {
1979 rtnl_lock();
1980 we_lock_rtnl = true;
1981 } 2061 }
2062
1982 reset_state = adapter->state; 2063 reset_state = adapter->state;
1983 2064
1984 rwi = get_next_rwi(adapter); 2065 rwi = get_next_rwi(adapter);
@@ -1990,22 +2071,43 @@ static void __ibmvnic_reset(struct work_struct *work)
1990 break; 2071 break;
1991 } 2072 }
1992 2073
1993 if (adapter->force_reset_recovery) { 2074 if (rwi->reset_reason == VNIC_RESET_CHANGE_PARAM) {
1994 adapter->force_reset_recovery = false; 2075 /* CHANGE_PARAM requestor holds rtnl_lock */
1995 rc = do_hard_reset(adapter, rwi, reset_state); 2076 rc = do_change_param_reset(adapter, rwi, reset_state);
2077 } else if (adapter->force_reset_recovery) {
2078 /* Transport event occurred during previous reset */
2079 if (adapter->wait_for_reset) {
2080 /* Previous was CHANGE_PARAM; caller locked */
2081 adapter->force_reset_recovery = false;
2082 rc = do_hard_reset(adapter, rwi, reset_state);
2083 } else {
2084 rtnl_lock();
2085 adapter->force_reset_recovery = false;
2086 rc = do_hard_reset(adapter, rwi, reset_state);
2087 rtnl_unlock();
2088 }
1996 } else { 2089 } else {
1997 rc = do_reset(adapter, rwi, reset_state); 2090 rc = do_reset(adapter, rwi, reset_state);
1998 } 2091 }
1999 kfree(rwi); 2092 kfree(rwi);
2000 if (rc && rc != IBMVNIC_INIT_FAILED && 2093 if (rc == IBMVNIC_OPEN_FAILED) {
2094 if (list_empty(&adapter->rwi_list))
2095 adapter->state = VNIC_CLOSED;
2096 else
2097 adapter->state = reset_state;
2098 rc = 0;
2099 } else if (rc && rc != IBMVNIC_INIT_FAILED &&
2001 !adapter->force_reset_recovery) 2100 !adapter->force_reset_recovery)
2002 break; 2101 break;
2003 2102
2004 rwi = get_next_rwi(adapter); 2103 rwi = get_next_rwi(adapter);
2104
2105 if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER ||
2106 rwi->reset_reason == VNIC_RESET_MOBILITY))
2107 adapter->force_reset_recovery = true;
2005 } 2108 }
2006 2109
2007 if (adapter->wait_for_reset) { 2110 if (adapter->wait_for_reset) {
2008 adapter->wait_for_reset = false;
2009 adapter->reset_done_rc = rc; 2111 adapter->reset_done_rc = rc;
2010 complete(&adapter->reset_done); 2112 complete(&adapter->reset_done);
2011 } 2113 }
@@ -2015,9 +2117,16 @@ static void __ibmvnic_reset(struct work_struct *work)
2015 free_all_rwi(adapter); 2117 free_all_rwi(adapter);
2016 } 2118 }
2017 2119
2018 adapter->resetting = false; 2120 clear_bit_unlock(0, &adapter->resetting);
2019 if (we_lock_rtnl) 2121}
2020 rtnl_unlock(); 2122
2123static void __ibmvnic_delayed_reset(struct work_struct *work)
2124{
2125 struct ibmvnic_adapter *adapter;
2126
2127 adapter = container_of(work, struct ibmvnic_adapter,
2128 ibmvnic_delayed_reset.work);
2129 __ibmvnic_reset(&adapter->ibmvnic_reset);
2021} 2130}
2022 2131
2023static int ibmvnic_reset(struct ibmvnic_adapter *adapter, 2132static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
@@ -2072,14 +2181,11 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
2072 rwi->reset_reason = reason; 2181 rwi->reset_reason = reason;
2073 list_add_tail(&rwi->list, &adapter->rwi_list); 2182 list_add_tail(&rwi->list, &adapter->rwi_list);
2074 spin_unlock_irqrestore(&adapter->rwi_lock, flags); 2183 spin_unlock_irqrestore(&adapter->rwi_lock, flags);
2075 adapter->resetting = true;
2076 netdev_dbg(adapter->netdev, "Scheduling reset (reason %d)\n", reason); 2184 netdev_dbg(adapter->netdev, "Scheduling reset (reason %d)\n", reason);
2077 schedule_work(&adapter->ibmvnic_reset); 2185 schedule_work(&adapter->ibmvnic_reset);
2078 2186
2079 return 0; 2187 return 0;
2080err: 2188err:
2081 if (adapter->wait_for_reset)
2082 adapter->wait_for_reset = false;
2083 return -ret; 2189 return -ret;
2084} 2190}
2085 2191
@@ -2119,7 +2225,7 @@ restart_poll:
2119 u16 offset; 2225 u16 offset;
2120 u8 flags = 0; 2226 u8 flags = 0;
2121 2227
2122 if (unlikely(adapter->resetting && 2228 if (unlikely(test_bit(0, &adapter->resetting) &&
2123 adapter->reset_reason != VNIC_RESET_NON_FATAL)) { 2229 adapter->reset_reason != VNIC_RESET_NON_FATAL)) {
2124 enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); 2230 enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]);
2125 napi_complete_done(napi, frames_processed); 2231 napi_complete_done(napi, frames_processed);
@@ -2770,7 +2876,7 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,
2770 return 1; 2876 return 1;
2771 } 2877 }
2772 2878
2773 if (adapter->resetting && 2879 if (test_bit(0, &adapter->resetting) &&
2774 adapter->reset_reason == VNIC_RESET_MOBILITY) { 2880 adapter->reset_reason == VNIC_RESET_MOBILITY) {
2775 u64 val = (0xff000000) | scrq->hw_irq; 2881 u64 val = (0xff000000) | scrq->hw_irq;
2776 2882
@@ -3320,7 +3426,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter *adapter,
3320 if (rc) { 3426 if (rc) {
3321 if (rc == H_CLOSED) { 3427 if (rc == H_CLOSED) {
3322 dev_warn(dev, "CRQ Queue closed\n"); 3428 dev_warn(dev, "CRQ Queue closed\n");
3323 if (adapter->resetting) 3429 if (test_bit(0, &adapter->resetting))
3324 ibmvnic_reset(adapter, VNIC_RESET_FATAL); 3430 ibmvnic_reset(adapter, VNIC_RESET_FATAL);
3325 } 3431 }
3326 3432
@@ -4312,13 +4418,14 @@ static int handle_query_phys_parms_rsp(union ibmvnic_crq *crq,
4312{ 4418{
4313 struct net_device *netdev = adapter->netdev; 4419 struct net_device *netdev = adapter->netdev;
4314 int rc; 4420 int rc;
4421 __be32 rspeed = cpu_to_be32(crq->query_phys_parms_rsp.speed);
4315 4422
4316 rc = crq->query_phys_parms_rsp.rc.code; 4423 rc = crq->query_phys_parms_rsp.rc.code;
4317 if (rc) { 4424 if (rc) {
4318 netdev_err(netdev, "Error %d in QUERY_PHYS_PARMS\n", rc); 4425 netdev_err(netdev, "Error %d in QUERY_PHYS_PARMS\n", rc);
4319 return rc; 4426 return rc;
4320 } 4427 }
4321 switch (cpu_to_be32(crq->query_phys_parms_rsp.speed)) { 4428 switch (rspeed) {
4322 case IBMVNIC_10MBPS: 4429 case IBMVNIC_10MBPS:
4323 adapter->speed = SPEED_10; 4430 adapter->speed = SPEED_10;
4324 break; 4431 break;
@@ -4344,8 +4451,8 @@ static int handle_query_phys_parms_rsp(union ibmvnic_crq *crq,
4344 adapter->speed = SPEED_100000; 4451 adapter->speed = SPEED_100000;
4345 break; 4452 break;
4346 default: 4453 default:
4347 netdev_warn(netdev, "Unknown speed 0x%08x\n", 4454 if (netif_carrier_ok(netdev))
4348 cpu_to_be32(crq->query_phys_parms_rsp.speed)); 4455 netdev_warn(netdev, "Unknown speed 0x%08x\n", rspeed);
4349 adapter->speed = SPEED_UNKNOWN; 4456 adapter->speed = SPEED_UNKNOWN;
4350 } 4457 }
4351 if (crq->query_phys_parms_rsp.flags1 & IBMVNIC_FULL_DUPLEX) 4458 if (crq->query_phys_parms_rsp.flags1 & IBMVNIC_FULL_DUPLEX)
@@ -4395,7 +4502,7 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
4395 case IBMVNIC_CRQ_XPORT_EVENT: 4502 case IBMVNIC_CRQ_XPORT_EVENT:
4396 netif_carrier_off(netdev); 4503 netif_carrier_off(netdev);
4397 adapter->crq.active = false; 4504 adapter->crq.active = false;
4398 if (adapter->resetting) 4505 if (test_bit(0, &adapter->resetting))
4399 adapter->force_reset_recovery = true; 4506 adapter->force_reset_recovery = true;
4400 if (gen_crq->cmd == IBMVNIC_PARTITION_MIGRATED) { 4507 if (gen_crq->cmd == IBMVNIC_PARTITION_MIGRATED) {
4401 dev_info(dev, "Migrated, re-enabling adapter\n"); 4508 dev_info(dev, "Migrated, re-enabling adapter\n");
@@ -4733,7 +4840,7 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
4733 return -1; 4840 return -1;
4734 } 4841 }
4735 4842
4736 if (adapter->resetting && !adapter->wait_for_reset && 4843 if (test_bit(0, &adapter->resetting) && !adapter->wait_for_reset &&
4737 adapter->reset_reason != VNIC_RESET_MOBILITY) { 4844 adapter->reset_reason != VNIC_RESET_MOBILITY) {
4738 if (adapter->req_rx_queues != old_num_rx_queues || 4845 if (adapter->req_rx_queues != old_num_rx_queues ||
4739 adapter->req_tx_queues != old_num_tx_queues) { 4846 adapter->req_tx_queues != old_num_tx_queues) {
@@ -4845,10 +4952,12 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
4845 spin_lock_init(&adapter->stats_lock); 4952 spin_lock_init(&adapter->stats_lock);
4846 4953
4847 INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset); 4954 INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset);
4955 INIT_DELAYED_WORK(&adapter->ibmvnic_delayed_reset,
4956 __ibmvnic_delayed_reset);
4848 INIT_LIST_HEAD(&adapter->rwi_list); 4957 INIT_LIST_HEAD(&adapter->rwi_list);
4849 spin_lock_init(&adapter->rwi_lock); 4958 spin_lock_init(&adapter->rwi_lock);
4850 init_completion(&adapter->init_done); 4959 init_completion(&adapter->init_done);
4851 adapter->resetting = false; 4960 clear_bit(0, &adapter->resetting);
4852 4961
4853 do { 4962 do {
4854 rc = init_crq_queue(adapter); 4963 rc = init_crq_queue(adapter);
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 70bd286f8932..ebc39248b334 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -20,6 +20,7 @@
20#define IBMVNIC_INVALID_MAP -1 20#define IBMVNIC_INVALID_MAP -1
21#define IBMVNIC_STATS_TIMEOUT 1 21#define IBMVNIC_STATS_TIMEOUT 1
22#define IBMVNIC_INIT_FAILED 2 22#define IBMVNIC_INIT_FAILED 2
23#define IBMVNIC_OPEN_FAILED 3
23 24
24/* basic structures plus 100 2k buffers */ 25/* basic structures plus 100 2k buffers */
25#define IBMVNIC_IO_ENTITLEMENT_DEFAULT 610305 26#define IBMVNIC_IO_ENTITLEMENT_DEFAULT 610305
@@ -38,6 +39,8 @@
38#define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE) 39#define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE)
39#define IBMVNIC_BUFFER_HLEN 500 40#define IBMVNIC_BUFFER_HLEN 500
40 41
42#define IBMVNIC_RESET_DELAY 100
43
41static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = { 44static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = {
42#define IBMVNIC_USE_SERVER_MAXES 0x1 45#define IBMVNIC_USE_SERVER_MAXES 0x1
43 "use-server-maxes" 46 "use-server-maxes"
@@ -1076,7 +1079,8 @@ struct ibmvnic_adapter {
1076 spinlock_t rwi_lock; 1079 spinlock_t rwi_lock;
1077 struct list_head rwi_list; 1080 struct list_head rwi_list;
1078 struct work_struct ibmvnic_reset; 1081 struct work_struct ibmvnic_reset;
1079 bool resetting; 1082 struct delayed_work ibmvnic_delayed_reset;
1083 unsigned long resetting;
1080 bool napi_enabled, from_passive_init; 1084 bool napi_enabled, from_passive_init;
1081 1085
1082 bool failover_pending; 1086 bool failover_pending;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 0a2ec387a482..095f6c71b4fa 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -3108,7 +3108,7 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
3108 skb_put(skb, len); 3108 skb_put(skb, len);
3109 3109
3110 if (dev->features & NETIF_F_RXCSUM) { 3110 if (dev->features & NETIF_F_RXCSUM) {
3111 skb->csum = csum; 3111 skb->csum = le16_to_cpu(csum);
3112 skb->ip_summed = CHECKSUM_COMPLETE; 3112 skb->ip_summed = CHECKSUM_COMPLETE;
3113 } 3113 }
3114 3114
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 0dba272a5b2f..a1f20b205299 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -20,15 +20,15 @@ config MLX5_ACCEL
20 bool 20 bool
21 21
22config MLX5_FPGA 22config MLX5_FPGA
23 bool "Mellanox Technologies Innova support" 23 bool "Mellanox Technologies Innova support"
24 depends on MLX5_CORE 24 depends on MLX5_CORE
25 select MLX5_ACCEL 25 select MLX5_ACCEL
26 ---help--- 26 ---help---
27 Build support for the Innova family of network cards by Mellanox 27 Build support for the Innova family of network cards by Mellanox
28 Technologies. Innova network cards are comprised of a ConnectX chip 28 Technologies. Innova network cards are comprised of a ConnectX chip
29 and an FPGA chip on one board. If you select this option, the 29 and an FPGA chip on one board. If you select this option, the
30 mlx5_core driver will include the Innova FPGA core and allow building 30 mlx5_core driver will include the Innova FPGA core and allow building
31 sandbox-specific client drivers. 31 sandbox-specific client drivers.
32 32
33config MLX5_CORE_EN 33config MLX5_CORE_EN
34 bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support" 34 bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support"
@@ -58,14 +58,14 @@ config MLX5_EN_RXNFC
58 API. 58 API.
59 59
60config MLX5_MPFS 60config MLX5_MPFS
61 bool "Mellanox Technologies MLX5 MPFS support" 61 bool "Mellanox Technologies MLX5 MPFS support"
62 depends on MLX5_CORE_EN 62 depends on MLX5_CORE_EN
63 default y 63 default y
64 ---help--- 64 ---help---
65 Mellanox Technologies Ethernet Multi-Physical Function Switch (MPFS) 65 Mellanox Technologies Ethernet Multi-Physical Function Switch (MPFS)
66 support in ConnectX NIC. MPFs is required for when multi-PF configuration 66 support in ConnectX NIC. MPFs is required for when multi-PF configuration
67 is enabled to allow passing user configured unicast MAC addresses to the 67 is enabled to allow passing user configured unicast MAC addresses to the
68 requesting PF. 68 requesting PF.
69 69
70config MLX5_ESWITCH 70config MLX5_ESWITCH
71 bool "Mellanox Technologies MLX5 SRIOV E-Switch support" 71 bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
@@ -73,10 +73,10 @@ config MLX5_ESWITCH
73 default y 73 default y
74 ---help--- 74 ---help---
75 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC. 75 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
76 E-Switch provides internal SRIOV packet steering and switching for the 76 E-Switch provides internal SRIOV packet steering and switching for the
77 enabled VFs and PF in two available modes: 77 enabled VFs and PF in two available modes:
78 Legacy SRIOV mode (L2 mac vlan steering based). 78 Legacy SRIOV mode (L2 mac vlan steering based).
79 Switchdev mode (eswitch offloads). 79 Switchdev mode (eswitch offloads).
80 80
81config MLX5_CORE_EN_DCB 81config MLX5_CORE_EN_DCB
82 bool "Data Center Bridging (DCB) Support" 82 bool "Data Center Bridging (DCB) Support"
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
index eed7101e8bb7..acd946f2ddbe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
@@ -399,10 +399,10 @@ add_ethtool_flow_rule(struct mlx5e_priv *priv,
399 struct mlx5_flow_table *ft, 399 struct mlx5_flow_table *ft,
400 struct ethtool_rx_flow_spec *fs) 400 struct ethtool_rx_flow_spec *fs)
401{ 401{
402 struct mlx5_flow_act flow_act = { .flags = FLOW_ACT_NO_APPEND };
402 struct mlx5_flow_destination *dst = NULL; 403 struct mlx5_flow_destination *dst = NULL;
403 struct mlx5_flow_act flow_act = {0};
404 struct mlx5_flow_spec *spec;
405 struct mlx5_flow_handle *rule; 404 struct mlx5_flow_handle *rule;
405 struct mlx5_flow_spec *spec;
406 int err = 0; 406 int err = 0;
407 407
408 spec = kvzalloc(sizeof(*spec), GFP_KERNEL); 408 spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index da7555fdb4d5..3e78a727f3e6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1664,46 +1664,63 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
1664 return err; 1664 return err;
1665 } 1665 }
1666 1666
1667 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) { 1667 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
1668 struct flow_match_ipv4_addrs match; 1668 struct flow_match_control match;
1669 u16 addr_type;
1669 1670
1670 flow_rule_match_enc_ipv4_addrs(rule, &match); 1671 flow_rule_match_enc_control(rule, &match);
1671 MLX5_SET(fte_match_set_lyr_2_4, headers_c, 1672 addr_type = match.key->addr_type;
1672 src_ipv4_src_ipv6.ipv4_layout.ipv4,
1673 ntohl(match.mask->src));
1674 MLX5_SET(fte_match_set_lyr_2_4, headers_v,
1675 src_ipv4_src_ipv6.ipv4_layout.ipv4,
1676 ntohl(match.key->src));
1677
1678 MLX5_SET(fte_match_set_lyr_2_4, headers_c,
1679 dst_ipv4_dst_ipv6.ipv4_layout.ipv4,
1680 ntohl(match.mask->dst));
1681 MLX5_SET(fte_match_set_lyr_2_4, headers_v,
1682 dst_ipv4_dst_ipv6.ipv4_layout.ipv4,
1683 ntohl(match.key->dst));
1684
1685 MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, ethertype);
1686 MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, ETH_P_IP);
1687 } else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) {
1688 struct flow_match_ipv6_addrs match;
1689 1673
1690 flow_rule_match_enc_ipv6_addrs(rule, &match); 1674 /* For tunnel addr_type used same key id`s as for non-tunnel */
1691 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1675 if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
1692 src_ipv4_src_ipv6.ipv6_layout.ipv6), 1676 struct flow_match_ipv4_addrs match;
1693 &match.mask->src, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6));
1694 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v,
1695 src_ipv4_src_ipv6.ipv6_layout.ipv6),
1696 &match.key->src, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6));
1697 1677
1698 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, 1678 flow_rule_match_enc_ipv4_addrs(rule, &match);
1699 dst_ipv4_dst_ipv6.ipv6_layout.ipv6), 1679 MLX5_SET(fte_match_set_lyr_2_4, headers_c,
1700 &match.mask->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); 1680 src_ipv4_src_ipv6.ipv4_layout.ipv4,
1701 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, 1681 ntohl(match.mask->src));
1702 dst_ipv4_dst_ipv6.ipv6_layout.ipv6), 1682 MLX5_SET(fte_match_set_lyr_2_4, headers_v,
1703 &match.key->dst, MLX5_FLD_SZ_BYTES(ipv6_layout, ipv6)); 1683 src_ipv4_src_ipv6.ipv4_layout.ipv4,
1684 ntohl(match.key->src));
1704 1685
1705 MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, ethertype); 1686 MLX5_SET(fte_match_set_lyr_2_4, headers_c,
1706 MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, ETH_P_IPV6); 1687 dst_ipv4_dst_ipv6.ipv4_layout.ipv4,
1688 ntohl(match.mask->dst));
1689 MLX5_SET(fte_match_set_lyr_2_4, headers_v,
1690 dst_ipv4_dst_ipv6.ipv4_layout.ipv4,
1691 ntohl(match.key->dst));
1692
1693 MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c,
1694 ethertype);
1695 MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype,
1696 ETH_P_IP);
1697 } else if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
1698 struct flow_match_ipv6_addrs match;
1699
1700 flow_rule_match_enc_ipv6_addrs(rule, &match);
1701 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c,
1702 src_ipv4_src_ipv6.ipv6_layout.ipv6),
1703 &match.mask->src, MLX5_FLD_SZ_BYTES(ipv6_layout,
1704 ipv6));
1705 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v,
1706 src_ipv4_src_ipv6.ipv6_layout.ipv6),
1707 &match.key->src, MLX5_FLD_SZ_BYTES(ipv6_layout,
1708 ipv6));
1709
1710 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c,
1711 dst_ipv4_dst_ipv6.ipv6_layout.ipv6),
1712 &match.mask->dst, MLX5_FLD_SZ_BYTES(ipv6_layout,
1713 ipv6));
1714 memcpy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v,
1715 dst_ipv4_dst_ipv6.ipv6_layout.ipv6),
1716 &match.key->dst, MLX5_FLD_SZ_BYTES(ipv6_layout,
1717 ipv6));
1718
1719 MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c,
1720 ethertype);
1721 MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype,
1722 ETH_P_IPV6);
1723 }
1707 } 1724 }
1708 1725
1709 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) { 1726 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 9648c2297803..e47dd7c1b909 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1568,6 +1568,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
1568 { PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */ 1568 { PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */
1569 { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ 1569 { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */
1570 { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */ 1570 { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */
1571 { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */
1571 { 0, } 1572 { 0, }
1572}; 1573};
1573 1574
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
index 7d81a7735de5..b74b7d0f6590 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
@@ -615,7 +615,7 @@ static int dr_action_handle_cs_recalc(struct mlx5dr_domain *dmn,
615 * that recalculates the CS and forwards to the vport. 615 * that recalculates the CS and forwards to the vport.
616 */ 616 */
617 ret = mlx5dr_domain_cache_get_recalc_cs_ft_addr(dest_action->vport.dmn, 617 ret = mlx5dr_domain_cache_get_recalc_cs_ft_addr(dest_action->vport.dmn,
618 dest_action->vport.num, 618 dest_action->vport.caps->num,
619 final_icm_addr); 619 final_icm_addr);
620 if (ret) { 620 if (ret) {
621 mlx5dr_err(dmn, "Failed to get FW cs recalc flow table\n"); 621 mlx5dr_err(dmn, "Failed to get FW cs recalc flow table\n");
@@ -744,7 +744,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
744 dest_action = action; 744 dest_action = action;
745 if (rx_rule) { 745 if (rx_rule) {
746 /* Loopback on WIRE vport is not supported */ 746 /* Loopback on WIRE vport is not supported */
747 if (action->vport.num == WIRE_PORT) 747 if (action->vport.caps->num == WIRE_PORT)
748 goto out_invalid_arg; 748 goto out_invalid_arg;
749 749
750 attr.final_icm_addr = action->vport.caps->icm_address_rx; 750 attr.final_icm_addr = action->vport.caps->icm_address_rx;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
index 01008cd66f75..67dea7698fc9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
@@ -230,8 +230,7 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
230 (dmn->type == MLX5DR_DOMAIN_TYPE_FDB || 230 (dmn->type == MLX5DR_DOMAIN_TYPE_FDB ||
231 dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX)) { 231 dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX)) {
232 ret = mlx5dr_ste_build_src_gvmi_qpn(&sb[idx++], &mask, 232 ret = mlx5dr_ste_build_src_gvmi_qpn(&sb[idx++], &mask,
233 &dmn->info.caps, 233 dmn, inner, rx);
234 inner, rx);
235 if (ret) 234 if (ret)
236 return ret; 235 return ret;
237 } 236 }
@@ -458,13 +457,11 @@ static int dr_matcher_add_to_tbl(struct mlx5dr_matcher *matcher)
458 457
459 prev_matcher = NULL; 458 prev_matcher = NULL;
460 if (next_matcher && !first) 459 if (next_matcher && !first)
461 prev_matcher = list_entry(next_matcher->matcher_list.prev, 460 prev_matcher = list_prev_entry(next_matcher, matcher_list);
462 struct mlx5dr_matcher,
463 matcher_list);
464 else if (!first) 461 else if (!first)
465 prev_matcher = list_entry(tbl->matcher_list.prev, 462 prev_matcher = list_last_entry(&tbl->matcher_list,
466 struct mlx5dr_matcher, 463 struct mlx5dr_matcher,
467 matcher_list); 464 matcher_list);
468 465
469 if (dmn->type == MLX5DR_DOMAIN_TYPE_FDB || 466 if (dmn->type == MLX5DR_DOMAIN_TYPE_FDB ||
470 dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX) { 467 dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
index 3bc3f66b8fa8..4187f2b112b8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
@@ -18,7 +18,7 @@ static int dr_rule_append_to_miss_list(struct mlx5dr_ste *new_last_ste,
18 struct mlx5dr_ste *last_ste; 18 struct mlx5dr_ste *last_ste;
19 19
20 /* The new entry will be inserted after the last */ 20 /* The new entry will be inserted after the last */
21 last_ste = list_entry(miss_list->prev, struct mlx5dr_ste, miss_list_node); 21 last_ste = list_last_entry(miss_list, struct mlx5dr_ste, miss_list_node);
22 WARN_ON(!last_ste); 22 WARN_ON(!last_ste);
23 23
24 ste_info_last = kzalloc(sizeof(*ste_info_last), GFP_KERNEL); 24 ste_info_last = kzalloc(sizeof(*ste_info_last), GFP_KERNEL);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
index 6b0af64536d8..4efe1b0be4a8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
@@ -429,12 +429,9 @@ static void dr_ste_remove_middle_ste(struct mlx5dr_ste *ste,
429 struct mlx5dr_ste *prev_ste; 429 struct mlx5dr_ste *prev_ste;
430 u64 miss_addr; 430 u64 miss_addr;
431 431
432 prev_ste = list_entry(mlx5dr_ste_get_miss_list(ste)->prev, struct mlx5dr_ste, 432 prev_ste = list_prev_entry(ste, miss_list_node);
433 miss_list_node); 433 if (WARN_ON(!prev_ste))
434 if (!prev_ste) {
435 WARN_ON(true);
436 return; 434 return;
437 }
438 435
439 miss_addr = mlx5dr_ste_get_miss_addr(ste->hw_ste); 436 miss_addr = mlx5dr_ste_get_miss_addr(ste->hw_ste);
440 mlx5dr_ste_set_miss_addr(prev_ste->hw_ste, miss_addr); 437 mlx5dr_ste_set_miss_addr(prev_ste->hw_ste, miss_addr);
@@ -461,8 +458,8 @@ void mlx5dr_ste_free(struct mlx5dr_ste *ste,
461 struct mlx5dr_ste_htbl *stats_tbl; 458 struct mlx5dr_ste_htbl *stats_tbl;
462 LIST_HEAD(send_ste_list); 459 LIST_HEAD(send_ste_list);
463 460
464 first_ste = list_entry(mlx5dr_ste_get_miss_list(ste)->next, 461 first_ste = list_first_entry(mlx5dr_ste_get_miss_list(ste),
465 struct mlx5dr_ste, miss_list_node); 462 struct mlx5dr_ste, miss_list_node);
466 stats_tbl = first_ste->htbl; 463 stats_tbl = first_ste->htbl;
467 464
468 /* Two options: 465 /* Two options:
@@ -479,8 +476,7 @@ void mlx5dr_ste_free(struct mlx5dr_ste *ste,
479 if (last_ste == first_ste) 476 if (last_ste == first_ste)
480 next_ste = NULL; 477 next_ste = NULL;
481 else 478 else
482 next_ste = list_entry(ste->miss_list_node.next, 479 next_ste = list_next_entry(ste, miss_list_node);
483 struct mlx5dr_ste, miss_list_node);
484 480
485 if (!next_ste) { 481 if (!next_ste) {
486 /* One and only entry in the list */ 482 /* One and only entry in the list */
@@ -841,6 +837,8 @@ static void dr_ste_copy_mask_misc(char *mask, struct mlx5dr_match_misc *spec)
841 spec->source_sqn = MLX5_GET(fte_match_set_misc, mask, source_sqn); 837 spec->source_sqn = MLX5_GET(fte_match_set_misc, mask, source_sqn);
842 838
843 spec->source_port = MLX5_GET(fte_match_set_misc, mask, source_port); 839 spec->source_port = MLX5_GET(fte_match_set_misc, mask, source_port);
840 spec->source_eswitch_owner_vhca_id = MLX5_GET(fte_match_set_misc, mask,
841 source_eswitch_owner_vhca_id);
844 842
845 spec->outer_second_prio = MLX5_GET(fte_match_set_misc, mask, outer_second_prio); 843 spec->outer_second_prio = MLX5_GET(fte_match_set_misc, mask, outer_second_prio);
846 spec->outer_second_cfi = MLX5_GET(fte_match_set_misc, mask, outer_second_cfi); 844 spec->outer_second_cfi = MLX5_GET(fte_match_set_misc, mask, outer_second_cfi);
@@ -2254,11 +2252,18 @@ static int dr_ste_build_src_gvmi_qpn_bit_mask(struct mlx5dr_match_param *value,
2254{ 2252{
2255 struct mlx5dr_match_misc *misc_mask = &value->misc; 2253 struct mlx5dr_match_misc *misc_mask = &value->misc;
2256 2254
2257 if (misc_mask->source_port != 0xffff) 2255 /* Partial misc source_port is not supported */
2256 if (misc_mask->source_port && misc_mask->source_port != 0xffff)
2257 return -EINVAL;
2258
2259 /* Partial misc source_eswitch_owner_vhca_id is not supported */
2260 if (misc_mask->source_eswitch_owner_vhca_id &&
2261 misc_mask->source_eswitch_owner_vhca_id != 0xffff)
2258 return -EINVAL; 2262 return -EINVAL;
2259 2263
2260 DR_STE_SET_MASK(src_gvmi_qp, bit_mask, source_gvmi, misc_mask, source_port); 2264 DR_STE_SET_MASK(src_gvmi_qp, bit_mask, source_gvmi, misc_mask, source_port);
2261 DR_STE_SET_MASK(src_gvmi_qp, bit_mask, source_qp, misc_mask, source_sqn); 2265 DR_STE_SET_MASK(src_gvmi_qp, bit_mask, source_qp, misc_mask, source_sqn);
2266 misc_mask->source_eswitch_owner_vhca_id = 0;
2262 2267
2263 return 0; 2268 return 0;
2264} 2269}
@@ -2270,17 +2275,33 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,
2270 struct dr_hw_ste_format *hw_ste = (struct dr_hw_ste_format *)hw_ste_p; 2275 struct dr_hw_ste_format *hw_ste = (struct dr_hw_ste_format *)hw_ste_p;
2271 struct mlx5dr_match_misc *misc = &value->misc; 2276 struct mlx5dr_match_misc *misc = &value->misc;
2272 struct mlx5dr_cmd_vport_cap *vport_cap; 2277 struct mlx5dr_cmd_vport_cap *vport_cap;
2278 struct mlx5dr_domain *dmn = sb->dmn;
2279 struct mlx5dr_cmd_caps *caps;
2273 u8 *tag = hw_ste->tag; 2280 u8 *tag = hw_ste->tag;
2274 2281
2275 DR_STE_SET_TAG(src_gvmi_qp, tag, source_qp, misc, source_sqn); 2282 DR_STE_SET_TAG(src_gvmi_qp, tag, source_qp, misc, source_sqn);
2276 2283
2277 vport_cap = mlx5dr_get_vport_cap(sb->caps, misc->source_port); 2284 if (sb->vhca_id_valid) {
2285 /* Find port GVMI based on the eswitch_owner_vhca_id */
2286 if (misc->source_eswitch_owner_vhca_id == dmn->info.caps.gvmi)
2287 caps = &dmn->info.caps;
2288 else if (dmn->peer_dmn && (misc->source_eswitch_owner_vhca_id ==
2289 dmn->peer_dmn->info.caps.gvmi))
2290 caps = &dmn->peer_dmn->info.caps;
2291 else
2292 return -EINVAL;
2293 } else {
2294 caps = &dmn->info.caps;
2295 }
2296
2297 vport_cap = mlx5dr_get_vport_cap(caps, misc->source_port);
2278 if (!vport_cap) 2298 if (!vport_cap)
2279 return -EINVAL; 2299 return -EINVAL;
2280 2300
2281 if (vport_cap->vport_gvmi) 2301 if (vport_cap->vport_gvmi)
2282 MLX5_SET(ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi); 2302 MLX5_SET(ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi);
2283 2303
2304 misc->source_eswitch_owner_vhca_id = 0;
2284 misc->source_port = 0; 2305 misc->source_port = 0;
2285 2306
2286 return 0; 2307 return 0;
@@ -2288,17 +2309,20 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,
2288 2309
2289int mlx5dr_ste_build_src_gvmi_qpn(struct mlx5dr_ste_build *sb, 2310int mlx5dr_ste_build_src_gvmi_qpn(struct mlx5dr_ste_build *sb,
2290 struct mlx5dr_match_param *mask, 2311 struct mlx5dr_match_param *mask,
2291 struct mlx5dr_cmd_caps *caps, 2312 struct mlx5dr_domain *dmn,
2292 bool inner, bool rx) 2313 bool inner, bool rx)
2293{ 2314{
2294 int ret; 2315 int ret;
2295 2316
2317 /* Set vhca_id_valid before we reset source_eswitch_owner_vhca_id */
2318 sb->vhca_id_valid = mask->misc.source_eswitch_owner_vhca_id;
2319
2296 ret = dr_ste_build_src_gvmi_qpn_bit_mask(mask, sb->bit_mask); 2320 ret = dr_ste_build_src_gvmi_qpn_bit_mask(mask, sb->bit_mask);
2297 if (ret) 2321 if (ret)
2298 return ret; 2322 return ret;
2299 2323
2300 sb->rx = rx; 2324 sb->rx = rx;
2301 sb->caps = caps; 2325 sb->dmn = dmn;
2302 sb->inner = inner; 2326 sb->inner = inner;
2303 sb->lu_type = MLX5DR_STE_LU_TYPE_SRC_GVMI_AND_QP; 2327 sb->lu_type = MLX5DR_STE_LU_TYPE_SRC_GVMI_AND_QP;
2304 sb->byte_mask = dr_ste_conv_bit_to_byte_mask(sb->bit_mask); 2328 sb->byte_mask = dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
index a37ee6359be2..1cb3769d4e3c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
@@ -180,6 +180,8 @@ void mlx5dr_send_fill_and_append_ste_send_info(struct mlx5dr_ste *ste, u16 size,
180struct mlx5dr_ste_build { 180struct mlx5dr_ste_build {
181 u8 inner:1; 181 u8 inner:1;
182 u8 rx:1; 182 u8 rx:1;
183 u8 vhca_id_valid:1;
184 struct mlx5dr_domain *dmn;
183 struct mlx5dr_cmd_caps *caps; 185 struct mlx5dr_cmd_caps *caps;
184 u8 lu_type; 186 u8 lu_type;
185 u16 byte_mask; 187 u16 byte_mask;
@@ -331,7 +333,7 @@ void mlx5dr_ste_build_register_1(struct mlx5dr_ste_build *sb,
331 bool inner, bool rx); 333 bool inner, bool rx);
332int mlx5dr_ste_build_src_gvmi_qpn(struct mlx5dr_ste_build *sb, 334int mlx5dr_ste_build_src_gvmi_qpn(struct mlx5dr_ste_build *sb,
333 struct mlx5dr_match_param *mask, 335 struct mlx5dr_match_param *mask,
334 struct mlx5dr_cmd_caps *caps, 336 struct mlx5dr_domain *dmn,
335 bool inner, bool rx); 337 bool inner, bool rx);
336void mlx5dr_ste_build_empty_always_hit(struct mlx5dr_ste_build *sb, bool rx); 338void mlx5dr_ste_build_empty_always_hit(struct mlx5dr_ste_build *sb, bool rx);
337 339
@@ -453,7 +455,7 @@ struct mlx5dr_match_misc {
453 u32 gre_c_present:1; 455 u32 gre_c_present:1;
454 /* Source port.;0xffff determines wire port */ 456 /* Source port.;0xffff determines wire port */
455 u32 source_port:16; 457 u32 source_port:16;
456 u32 reserved_auto2:16; 458 u32 source_eswitch_owner_vhca_id:16;
457 /* VLAN ID of first VLAN tag the inner header of the incoming packet. 459 /* VLAN ID of first VLAN tag the inner header of the incoming packet.
458 * Valid only when inner_second_cvlan_tag ==1 or inner_second_svlan_tag ==1 460 * Valid only when inner_second_cvlan_tag ==1 or inner_second_svlan_tag ==1
459 */ 461 */
@@ -745,7 +747,6 @@ struct mlx5dr_action {
745 struct { 747 struct {
746 struct mlx5dr_domain *dmn; 748 struct mlx5dr_domain *dmn;
747 struct mlx5dr_cmd_vport_cap *caps; 749 struct mlx5dr_cmd_vport_cap *caps;
748 u32 num;
749 } vport; 750 } vport;
750 struct { 751 struct {
751 u32 vlan_hdr; /* tpid_pcp_dei_vid */ 752 u32 vlan_hdr; /* tpid_pcp_dei_vid */
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index dd234cf7b39d..dcf9562bce8a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3771,6 +3771,14 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
3771 goto err_port_qdiscs_init; 3771 goto err_port_qdiscs_init;
3772 } 3772 }
3773 3773
3774 err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 0, VLAN_N_VID - 1, false,
3775 false);
3776 if (err) {
3777 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to clear VLAN filter\n",
3778 mlxsw_sp_port->local_port);
3779 goto err_port_vlan_clear;
3780 }
3781
3774 err = mlxsw_sp_port_nve_init(mlxsw_sp_port); 3782 err = mlxsw_sp_port_nve_init(mlxsw_sp_port);
3775 if (err) { 3783 if (err) {
3776 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n", 3784 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n",
@@ -3818,6 +3826,7 @@ err_port_vlan_create:
3818err_port_pvid_set: 3826err_port_pvid_set:
3819 mlxsw_sp_port_nve_fini(mlxsw_sp_port); 3827 mlxsw_sp_port_nve_fini(mlxsw_sp_port);
3820err_port_nve_init: 3828err_port_nve_init:
3829err_port_vlan_clear:
3821 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); 3830 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
3822err_port_qdiscs_init: 3831err_port_qdiscs_init:
3823 mlxsw_sp_port_fids_fini(mlxsw_sp_port); 3832 mlxsw_sp_port_fids_fini(mlxsw_sp_port);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
index 0ad1a24abfc6..b607919c8ad0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
@@ -21,6 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
21 struct netlink_ext_ack *extack) 21 struct netlink_ext_ack *extack)
22{ 22{
23 const struct flow_action_entry *act; 23 const struct flow_action_entry *act;
24 int mirror_act_count = 0;
24 int err, i; 25 int err, i;
25 26
26 if (!flow_action_has_entries(flow_action)) 27 if (!flow_action_has_entries(flow_action))
@@ -105,6 +106,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
105 case FLOW_ACTION_MIRRED: { 106 case FLOW_ACTION_MIRRED: {
106 struct net_device *out_dev = act->dev; 107 struct net_device *out_dev = act->dev;
107 108
109 if (mirror_act_count++) {
110 NL_SET_ERR_MSG_MOD(extack, "Multiple mirror actions per rule are not supported");
111 return -EOPNOTSUPP;
112 }
113
108 err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei, 114 err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
109 block, out_dev, 115 block, out_dev,
110 extack); 116 extack);
diff --git a/drivers/net/ethernet/netronome/nfp/abm/cls.c b/drivers/net/ethernet/netronome/nfp/abm/cls.c
index 23ebddfb9532..9f8a1f69c0c4 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/cls.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/cls.c
@@ -176,8 +176,10 @@ nfp_abm_u32_knode_replace(struct nfp_abm_link *alink,
176 u8 mask, val; 176 u8 mask, val;
177 int err; 177 int err;
178 178
179 if (!nfp_abm_u32_check_knode(alink->abm, knode, proto, extack)) 179 if (!nfp_abm_u32_check_knode(alink->abm, knode, proto, extack)) {
180 err = -EOPNOTSUPP;
180 goto err_delete; 181 goto err_delete;
182 }
181 183
182 tos_off = proto == htons(ETH_P_IP) ? 16 : 20; 184 tos_off = proto == htons(ETH_P_IP) ? 16 : 20;
183 185
@@ -198,14 +200,18 @@ nfp_abm_u32_knode_replace(struct nfp_abm_link *alink,
198 if ((iter->val & cmask) == (val & cmask) && 200 if ((iter->val & cmask) == (val & cmask) &&
199 iter->band != knode->res->classid) { 201 iter->band != knode->res->classid) {
200 NL_SET_ERR_MSG_MOD(extack, "conflict with already offloaded filter"); 202 NL_SET_ERR_MSG_MOD(extack, "conflict with already offloaded filter");
203 err = -EOPNOTSUPP;
201 goto err_delete; 204 goto err_delete;
202 } 205 }
203 } 206 }
204 207
205 if (!match) { 208 if (!match) {
206 match = kzalloc(sizeof(*match), GFP_KERNEL); 209 match = kzalloc(sizeof(*match), GFP_KERNEL);
207 if (!match) 210 if (!match) {
208 return -ENOMEM; 211 err = -ENOMEM;
212 goto err_delete;
213 }
214
209 list_add(&match->list, &alink->dscp_map); 215 list_add(&match->list, &alink->dscp_map);
210 } 216 }
211 match->handle = knode->handle; 217 match->handle = knode->handle;
@@ -221,7 +227,7 @@ nfp_abm_u32_knode_replace(struct nfp_abm_link *alink,
221 227
222err_delete: 228err_delete:
223 nfp_abm_u32_knode_delete(alink, knode); 229 nfp_abm_u32_knode_delete(alink, knode);
224 return -EOPNOTSUPP; 230 return err;
225} 231}
226 232
227static int nfp_abm_setup_tc_block_cb(enum tc_setup_type type, 233static int nfp_abm_setup_tc_block_cb(enum tc_setup_type type,
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c
index 7a20447cca19..d8ad9346a26a 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.c
@@ -400,6 +400,7 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
400 repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL); 400 repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL);
401 if (!repr_priv) { 401 if (!repr_priv) {
402 err = -ENOMEM; 402 err = -ENOMEM;
403 nfp_repr_free(repr);
403 goto err_reprs_clean; 404 goto err_reprs_clean;
404 } 405 }
405 406
@@ -413,6 +414,7 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
413 port = nfp_port_alloc(app, port_type, repr); 414 port = nfp_port_alloc(app, port_type, repr);
414 if (IS_ERR(port)) { 415 if (IS_ERR(port)) {
415 err = PTR_ERR(port); 416 err = PTR_ERR(port);
417 kfree(repr_priv);
416 nfp_repr_free(repr); 418 nfp_repr_free(repr);
417 goto err_reprs_clean; 419 goto err_reprs_clean;
418 } 420 }
@@ -433,6 +435,7 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
433 err = nfp_repr_init(app, repr, 435 err = nfp_repr_init(app, repr,
434 port_id, port, priv->nn->dp.netdev); 436 port_id, port, priv->nn->dp.netdev);
435 if (err) { 437 if (err) {
438 kfree(repr_priv);
436 nfp_port_free(port); 439 nfp_port_free(port);
437 nfp_repr_free(repr); 440 nfp_repr_free(repr);
438 goto err_reprs_clean; 441 goto err_reprs_clean;
@@ -515,6 +518,7 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
515 repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL); 518 repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL);
516 if (!repr_priv) { 519 if (!repr_priv) {
517 err = -ENOMEM; 520 err = -ENOMEM;
521 nfp_repr_free(repr);
518 goto err_reprs_clean; 522 goto err_reprs_clean;
519 } 523 }
520 524
@@ -525,11 +529,13 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
525 port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr); 529 port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr);
526 if (IS_ERR(port)) { 530 if (IS_ERR(port)) {
527 err = PTR_ERR(port); 531 err = PTR_ERR(port);
532 kfree(repr_priv);
528 nfp_repr_free(repr); 533 nfp_repr_free(repr);
529 goto err_reprs_clean; 534 goto err_reprs_clean;
530 } 535 }
531 err = nfp_port_init_phy_port(app->pf, app, port, i); 536 err = nfp_port_init_phy_port(app->pf, app, port, i);
532 if (err) { 537 if (err) {
538 kfree(repr_priv);
533 nfp_port_free(port); 539 nfp_port_free(port);
534 nfp_repr_free(repr); 540 nfp_repr_free(repr);
535 goto err_reprs_clean; 541 goto err_reprs_clean;
@@ -542,6 +548,7 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
542 err = nfp_repr_init(app, repr, 548 err = nfp_repr_init(app, repr,
543 cmsg_port_id, port, priv->nn->dp.netdev); 549 cmsg_port_id, port, priv->nn->dp.netdev);
544 if (err) { 550 if (err) {
551 kfree(repr_priv);
545 nfp_port_free(port); 552 nfp_port_free(port);
546 nfp_repr_free(repr); 553 nfp_repr_free(repr);
547 goto err_reprs_clean; 554 goto err_reprs_clean;
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c
deleted file mode 100644
index cf6e7eb1b1e1..000000000000
--- a/drivers/net/ethernet/netx-eth.c
+++ /dev/null
@@ -1,497 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * drivers/net/ethernet/netx-eth.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/init.h>
9#include <linux/interrupt.h>
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/delay.h>
13
14#include <linux/netdevice.h>
15#include <linux/platform_device.h>
16#include <linux/etherdevice.h>
17#include <linux/skbuff.h>
18#include <linux/mii.h>
19
20#include <asm/io.h>
21#include <mach/hardware.h>
22#include <mach/netx-regs.h>
23#include <mach/pfifo.h>
24#include <mach/xc.h>
25#include <linux/platform_data/eth-netx.h>
26
27/* XC Fifo Offsets */
28#define EMPTY_PTR_FIFO(xcno) (0 + ((xcno) << 3)) /* Index of the empty pointer FIFO */
29#define IND_FIFO_PORT_HI(xcno) (1 + ((xcno) << 3)) /* Index of the FIFO where received */
30 /* Data packages are indicated by XC */
31#define IND_FIFO_PORT_LO(xcno) (2 + ((xcno) << 3)) /* Index of the FIFO where received */
32 /* Data packages are indicated by XC */
33#define REQ_FIFO_PORT_HI(xcno) (3 + ((xcno) << 3)) /* Index of the FIFO where Data packages */
34 /* have to be indicated by ARM which */
35 /* shall be sent */
36#define REQ_FIFO_PORT_LO(xcno) (4 + ((xcno) << 3)) /* Index of the FIFO where Data packages */
37 /* have to be indicated by ARM which shall */
38 /* be sent */
39#define CON_FIFO_PORT_HI(xcno) (5 + ((xcno) << 3)) /* Index of the FIFO where sent Data packages */
40 /* are confirmed */
41#define CON_FIFO_PORT_LO(xcno) (6 + ((xcno) << 3)) /* Index of the FIFO where sent Data */
42 /* packages are confirmed */
43#define PFIFO_MASK(xcno) (0x7f << (xcno*8))
44
45#define FIFO_PTR_FRAMELEN_SHIFT 0
46#define FIFO_PTR_FRAMELEN_MASK (0x7ff << 0)
47#define FIFO_PTR_FRAMELEN(len) (((len) << 0) & FIFO_PTR_FRAMELEN_MASK)
48#define FIFO_PTR_TIMETRIG (1<<11)
49#define FIFO_PTR_MULTI_REQ
50#define FIFO_PTR_ORIGIN (1<<14)
51#define FIFO_PTR_VLAN (1<<15)
52#define FIFO_PTR_FRAMENO_SHIFT 16
53#define FIFO_PTR_FRAMENO_MASK (0x3f << 16)
54#define FIFO_PTR_FRAMENO(no) (((no) << 16) & FIFO_PTR_FRAMENO_MASK)
55#define FIFO_PTR_SEGMENT_SHIFT 22
56#define FIFO_PTR_SEGMENT_MASK (0xf << 22)
57#define FIFO_PTR_SEGMENT(seg) (((seg) & 0xf) << 22)
58#define FIFO_PTR_ERROR_SHIFT 28
59#define FIFO_PTR_ERROR_MASK (0xf << 28)
60
61#define ISR_LINK_STATUS_CHANGE (1<<4)
62#define ISR_IND_LO (1<<3)
63#define ISR_CON_LO (1<<2)
64#define ISR_IND_HI (1<<1)
65#define ISR_CON_HI (1<<0)
66
67#define ETH_MAC_LOCAL_CONFIG 0x1560
68#define ETH_MAC_4321 0x1564
69#define ETH_MAC_65 0x1568
70
71#define MAC_TRAFFIC_CLASS_ARRANGEMENT_SHIFT 16
72#define MAC_TRAFFIC_CLASS_ARRANGEMENT_MASK (0xf<<MAC_TRAFFIC_CLASS_ARRANGEMENT_SHIFT)
73#define MAC_TRAFFIC_CLASS_ARRANGEMENT(x) (((x)<<MAC_TRAFFIC_CLASS_ARRANGEMENT_SHIFT) & MAC_TRAFFIC_CLASS_ARRANGEMENT_MASK)
74#define LOCAL_CONFIG_LINK_STATUS_IRQ_EN (1<<24)
75#define LOCAL_CONFIG_CON_LO_IRQ_EN (1<<23)
76#define LOCAL_CONFIG_CON_HI_IRQ_EN (1<<22)
77#define LOCAL_CONFIG_IND_LO_IRQ_EN (1<<21)
78#define LOCAL_CONFIG_IND_HI_IRQ_EN (1<<20)
79
80#define CARDNAME "netx-eth"
81
82/* LSB must be zero */
83#define INTERNAL_PHY_ADR 0x1c
84
85struct netx_eth_priv {
86 void __iomem *sram_base, *xpec_base, *xmac_base;
87 int id;
88 struct mii_if_info mii;
89 u32 msg_enable;
90 struct xc *xc;
91 spinlock_t lock;
92};
93
94static void netx_eth_set_multicast_list(struct net_device *ndev)
95{
96 /* implement me */
97}
98
99static int
100netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
101{
102 struct netx_eth_priv *priv = netdev_priv(ndev);
103 unsigned char *buf = skb->data;
104 unsigned int len = skb->len;
105
106 spin_lock_irq(&priv->lock);
107 memcpy_toio(priv->sram_base + 1560, (void *)buf, len);
108 if (len < 60) {
109 memset_io(priv->sram_base + 1560 + len, 0, 60 - len);
110 len = 60;
111 }
112
113 pfifo_push(REQ_FIFO_PORT_LO(priv->id),
114 FIFO_PTR_SEGMENT(priv->id) |
115 FIFO_PTR_FRAMENO(1) |
116 FIFO_PTR_FRAMELEN(len));
117
118 ndev->stats.tx_packets++;
119 ndev->stats.tx_bytes += skb->len;
120
121 netif_stop_queue(ndev);
122 spin_unlock_irq(&priv->lock);
123 dev_kfree_skb(skb);
124
125 return NETDEV_TX_OK;
126}
127
128static void netx_eth_receive(struct net_device *ndev)
129{
130 struct netx_eth_priv *priv = netdev_priv(ndev);
131 unsigned int val, frameno, seg, len;
132 unsigned char *data;
133 struct sk_buff *skb;
134
135 val = pfifo_pop(IND_FIFO_PORT_LO(priv->id));
136
137 frameno = (val & FIFO_PTR_FRAMENO_MASK) >> FIFO_PTR_FRAMENO_SHIFT;
138 seg = (val & FIFO_PTR_SEGMENT_MASK) >> FIFO_PTR_SEGMENT_SHIFT;
139 len = (val & FIFO_PTR_FRAMELEN_MASK) >> FIFO_PTR_FRAMELEN_SHIFT;
140
141 skb = netdev_alloc_skb(ndev, len);
142 if (unlikely(skb == NULL)) {
143 ndev->stats.rx_dropped++;
144 return;
145 }
146
147 data = skb_put(skb, len);
148
149 memcpy_fromio(data, priv->sram_base + frameno * 1560, len);
150
151 pfifo_push(EMPTY_PTR_FIFO(priv->id),
152 FIFO_PTR_SEGMENT(seg) | FIFO_PTR_FRAMENO(frameno));
153
154 skb->protocol = eth_type_trans(skb, ndev);
155 netif_rx(skb);
156 ndev->stats.rx_packets++;
157 ndev->stats.rx_bytes += len;
158}
159
160static irqreturn_t
161netx_eth_interrupt(int irq, void *dev_id)
162{
163 struct net_device *ndev = dev_id;
164 struct netx_eth_priv *priv = netdev_priv(ndev);
165 int status;
166 unsigned long flags;
167
168 spin_lock_irqsave(&priv->lock, flags);
169
170 status = readl(NETX_PFIFO_XPEC_ISR(priv->id));
171 while (status) {
172 int fill_level;
173 writel(status, NETX_PFIFO_XPEC_ISR(priv->id));
174
175 if ((status & ISR_CON_HI) || (status & ISR_IND_HI))
176 printk("%s: unexpected status: 0x%08x\n",
177 __func__, status);
178
179 fill_level =
180 readl(NETX_PFIFO_FILL_LEVEL(IND_FIFO_PORT_LO(priv->id)));
181 while (fill_level--)
182 netx_eth_receive(ndev);
183
184 if (status & ISR_CON_LO)
185 netif_wake_queue(ndev);
186
187 if (status & ISR_LINK_STATUS_CHANGE)
188 mii_check_media(&priv->mii, netif_msg_link(priv), 1);
189
190 status = readl(NETX_PFIFO_XPEC_ISR(priv->id));
191 }
192 spin_unlock_irqrestore(&priv->lock, flags);
193 return IRQ_HANDLED;
194}
195
196static int netx_eth_open(struct net_device *ndev)
197{
198 struct netx_eth_priv *priv = netdev_priv(ndev);
199
200 if (request_irq
201 (ndev->irq, netx_eth_interrupt, IRQF_SHARED, ndev->name, ndev))
202 return -EAGAIN;
203
204 writel(ndev->dev_addr[0] |
205 ndev->dev_addr[1]<<8 |
206 ndev->dev_addr[2]<<16 |
207 ndev->dev_addr[3]<<24,
208 priv->xpec_base + NETX_XPEC_RAM_START_OFS + ETH_MAC_4321);
209 writel(ndev->dev_addr[4] |
210 ndev->dev_addr[5]<<8,
211 priv->xpec_base + NETX_XPEC_RAM_START_OFS + ETH_MAC_65);
212
213 writel(LOCAL_CONFIG_LINK_STATUS_IRQ_EN |
214 LOCAL_CONFIG_CON_LO_IRQ_EN |
215 LOCAL_CONFIG_CON_HI_IRQ_EN |
216 LOCAL_CONFIG_IND_LO_IRQ_EN |
217 LOCAL_CONFIG_IND_HI_IRQ_EN,
218 priv->xpec_base + NETX_XPEC_RAM_START_OFS +
219 ETH_MAC_LOCAL_CONFIG);
220
221 mii_check_media(&priv->mii, netif_msg_link(priv), 1);
222 netif_start_queue(ndev);
223
224 return 0;
225}
226
227static int netx_eth_close(struct net_device *ndev)
228{
229 struct netx_eth_priv *priv = netdev_priv(ndev);
230
231 netif_stop_queue(ndev);
232
233 writel(0,
234 priv->xpec_base + NETX_XPEC_RAM_START_OFS + ETH_MAC_LOCAL_CONFIG);
235
236 free_irq(ndev->irq, ndev);
237
238 return 0;
239}
240
241static void netx_eth_timeout(struct net_device *ndev)
242{
243 struct netx_eth_priv *priv = netdev_priv(ndev);
244 int i;
245
246 printk(KERN_ERR "%s: transmit timed out, resetting\n", ndev->name);
247
248 spin_lock_irq(&priv->lock);
249
250 xc_reset(priv->xc);
251 xc_start(priv->xc);
252
253 for (i=2; i<=18; i++)
254 pfifo_push(EMPTY_PTR_FIFO(priv->id),
255 FIFO_PTR_FRAMENO(i) | FIFO_PTR_SEGMENT(priv->id));
256
257 spin_unlock_irq(&priv->lock);
258
259 netif_wake_queue(ndev);
260}
261
262static int
263netx_eth_phy_read(struct net_device *ndev, int phy_id, int reg)
264{
265 unsigned int val;
266
267 val = MIIMU_SNRDY | MIIMU_PREAMBLE | MIIMU_PHYADDR(phy_id) |
268 MIIMU_REGADDR(reg) | MIIMU_PHY_NRES;
269
270 writel(val, NETX_MIIMU);
271 while (readl(NETX_MIIMU) & MIIMU_SNRDY);
272
273 return readl(NETX_MIIMU) >> 16;
274
275}
276
277static void
278netx_eth_phy_write(struct net_device *ndev, int phy_id, int reg, int value)
279{
280 unsigned int val;
281
282 val = MIIMU_SNRDY | MIIMU_PREAMBLE | MIIMU_PHYADDR(phy_id) |
283 MIIMU_REGADDR(reg) | MIIMU_PHY_NRES | MIIMU_OPMODE_WRITE |
284 MIIMU_DATA(value);
285
286 writel(val, NETX_MIIMU);
287 while (readl(NETX_MIIMU) & MIIMU_SNRDY);
288}
289
290static const struct net_device_ops netx_eth_netdev_ops = {
291 .ndo_open = netx_eth_open,
292 .ndo_stop = netx_eth_close,
293 .ndo_start_xmit = netx_eth_hard_start_xmit,
294 .ndo_tx_timeout = netx_eth_timeout,
295 .ndo_set_rx_mode = netx_eth_set_multicast_list,
296 .ndo_validate_addr = eth_validate_addr,
297 .ndo_set_mac_address = eth_mac_addr,
298};
299
300static int netx_eth_enable(struct net_device *ndev)
301{
302 struct netx_eth_priv *priv = netdev_priv(ndev);
303 unsigned int mac4321, mac65;
304 int running, i, ret;
305 bool inv_mac_addr = false;
306
307 ndev->netdev_ops = &netx_eth_netdev_ops;
308 ndev->watchdog_timeo = msecs_to_jiffies(5000);
309
310 priv->msg_enable = NETIF_MSG_LINK;
311 priv->mii.phy_id_mask = 0x1f;
312 priv->mii.reg_num_mask = 0x1f;
313 priv->mii.force_media = 0;
314 priv->mii.full_duplex = 0;
315 priv->mii.dev = ndev;
316 priv->mii.mdio_read = netx_eth_phy_read;
317 priv->mii.mdio_write = netx_eth_phy_write;
318 priv->mii.phy_id = INTERNAL_PHY_ADR + priv->id;
319
320 running = xc_running(priv->xc);
321 xc_stop(priv->xc);
322
323 /* if the xc engine is already running, assume the bootloader has
324 * loaded the firmware for us
325 */
326 if (running) {
327 /* get Node Address from hardware */
328 mac4321 = readl(priv->xpec_base +
329 NETX_XPEC_RAM_START_OFS + ETH_MAC_4321);
330 mac65 = readl(priv->xpec_base +
331 NETX_XPEC_RAM_START_OFS + ETH_MAC_65);
332
333 ndev->dev_addr[0] = mac4321 & 0xff;
334 ndev->dev_addr[1] = (mac4321 >> 8) & 0xff;
335 ndev->dev_addr[2] = (mac4321 >> 16) & 0xff;
336 ndev->dev_addr[3] = (mac4321 >> 24) & 0xff;
337 ndev->dev_addr[4] = mac65 & 0xff;
338 ndev->dev_addr[5] = (mac65 >> 8) & 0xff;
339 } else {
340 if (xc_request_firmware(priv->xc)) {
341 printk(CARDNAME ": requesting firmware failed\n");
342 return -ENODEV;
343 }
344 }
345
346 xc_reset(priv->xc);
347 xc_start(priv->xc);
348
349 if (!is_valid_ether_addr(ndev->dev_addr))
350 inv_mac_addr = true;
351
352 for (i=2; i<=18; i++)
353 pfifo_push(EMPTY_PTR_FIFO(priv->id),
354 FIFO_PTR_FRAMENO(i) | FIFO_PTR_SEGMENT(priv->id));
355
356 ret = register_netdev(ndev);
357 if (inv_mac_addr)
358 printk("%s: Invalid ethernet MAC address. Please set using ip\n",
359 ndev->name);
360
361 return ret;
362}
363
364static int netx_eth_drv_probe(struct platform_device *pdev)
365{
366 struct netx_eth_priv *priv;
367 struct net_device *ndev;
368 struct netxeth_platform_data *pdata;
369 int ret;
370
371 ndev = alloc_etherdev(sizeof (struct netx_eth_priv));
372 if (!ndev) {
373 ret = -ENOMEM;
374 goto exit;
375 }
376 SET_NETDEV_DEV(ndev, &pdev->dev);
377
378 platform_set_drvdata(pdev, ndev);
379
380 priv = netdev_priv(ndev);
381
382 pdata = dev_get_platdata(&pdev->dev);
383 priv->xc = request_xc(pdata->xcno, &pdev->dev);
384 if (!priv->xc) {
385 dev_err(&pdev->dev, "unable to request xc engine\n");
386 ret = -ENODEV;
387 goto exit_free_netdev;
388 }
389
390 ndev->irq = priv->xc->irq;
391 priv->id = pdev->id;
392 priv->xpec_base = priv->xc->xpec_base;
393 priv->xmac_base = priv->xc->xmac_base;
394 priv->sram_base = priv->xc->sram_base;
395
396 spin_lock_init(&priv->lock);
397
398 ret = pfifo_request(PFIFO_MASK(priv->id));
399 if (ret) {
400 printk("unable to request PFIFO\n");
401 goto exit_free_xc;
402 }
403
404 ret = netx_eth_enable(ndev);
405 if (ret)
406 goto exit_free_pfifo;
407
408 return 0;
409exit_free_pfifo:
410 pfifo_free(PFIFO_MASK(priv->id));
411exit_free_xc:
412 free_xc(priv->xc);
413exit_free_netdev:
414 free_netdev(ndev);
415exit:
416 return ret;
417}
418
419static int netx_eth_drv_remove(struct platform_device *pdev)
420{
421 struct net_device *ndev = platform_get_drvdata(pdev);
422 struct netx_eth_priv *priv = netdev_priv(ndev);
423
424 unregister_netdev(ndev);
425 xc_stop(priv->xc);
426 free_xc(priv->xc);
427 free_netdev(ndev);
428 pfifo_free(PFIFO_MASK(priv->id));
429
430 return 0;
431}
432
433static int netx_eth_drv_suspend(struct platform_device *pdev, pm_message_t state)
434{
435 dev_err(&pdev->dev, "suspend not implemented\n");
436 return 0;
437}
438
439static int netx_eth_drv_resume(struct platform_device *pdev)
440{
441 dev_err(&pdev->dev, "resume not implemented\n");
442 return 0;
443}
444
445static struct platform_driver netx_eth_driver = {
446 .probe = netx_eth_drv_probe,
447 .remove = netx_eth_drv_remove,
448 .suspend = netx_eth_drv_suspend,
449 .resume = netx_eth_drv_resume,
450 .driver = {
451 .name = CARDNAME,
452 },
453};
454
455static int __init netx_eth_init(void)
456{
457 unsigned int phy_control, val;
458
459 printk("NetX Ethernet driver\n");
460
461 phy_control = PHY_CONTROL_PHY_ADDRESS(INTERNAL_PHY_ADR>>1) |
462 PHY_CONTROL_PHY1_MODE(PHY_MODE_ALL) |
463 PHY_CONTROL_PHY1_AUTOMDIX |
464 PHY_CONTROL_PHY1_EN |
465 PHY_CONTROL_PHY0_MODE(PHY_MODE_ALL) |
466 PHY_CONTROL_PHY0_AUTOMDIX |
467 PHY_CONTROL_PHY0_EN |
468 PHY_CONTROL_CLK_XLATIN;
469
470 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
471 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
472
473 writel(phy_control | PHY_CONTROL_RESET, NETX_SYSTEM_PHY_CONTROL);
474 udelay(100);
475
476 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
477 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
478
479 writel(phy_control, NETX_SYSTEM_PHY_CONTROL);
480
481 return platform_driver_register(&netx_eth_driver);
482}
483
484static void __exit netx_eth_cleanup(void)
485{
486 platform_driver_unregister(&netx_eth_driver);
487}
488
489module_init(netx_eth_init);
490module_exit(netx_eth_cleanup);
491
492MODULE_AUTHOR("Sascha Hauer, Pengutronix");
493MODULE_LICENSE("GPL");
494MODULE_ALIAS("platform:" CARDNAME);
495MODULE_FIRMWARE("xc0.bin");
496MODULE_FIRMWARE("xc1.bin");
497MODULE_FIRMWARE("xc2.bin");
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 0b384f97d2fd..2761f3a3ae50 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1347,7 +1347,7 @@ static int nixge_probe(struct platform_device *pdev)
1347 } 1347 }
1348 1348
1349 priv->phy_mode = of_get_phy_mode(pdev->dev.of_node); 1349 priv->phy_mode = of_get_phy_mode(pdev->dev.of_node);
1350 if (priv->phy_mode < 0) { 1350 if ((int)priv->phy_mode < 0) {
1351 netdev_err(ndev, "not find \"phy-mode\" property\n"); 1351 netdev_err(ndev, "not find \"phy-mode\" property\n");
1352 err = -EINVAL; 1352 err = -EINVAL;
1353 goto unregister_mdio; 1353 goto unregister_mdio;
diff --git a/drivers/net/ethernet/nxp/Kconfig b/drivers/net/ethernet/nxp/Kconfig
index 418afb84c84b..ee83a71c2509 100644
--- a/drivers/net/ethernet/nxp/Kconfig
+++ b/drivers/net/ethernet/nxp/Kconfig
@@ -1,9 +1,9 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2config LPC_ENET 2config LPC_ENET
3 tristate "NXP ethernet MAC on LPC devices" 3 tristate "NXP ethernet MAC on LPC devices"
4 depends on ARCH_LPC32XX || COMPILE_TEST 4 depends on ARCH_LPC32XX || COMPILE_TEST
5 select PHYLIB 5 select PHYLIB
6 help 6 help
7 Say Y or M here if you want to use the NXP ethernet MAC included on 7 Say Y or M here if you want to use the NXP ethernet MAC included on
8 some NXP LPC devices. You can safely enable this option for LPC32xx 8 some NXP LPC devices. You can safely enable this option for LPC32xx
9 SoC. Also available as a module. 9 SoC. Also available as a module.
diff --git a/drivers/net/ethernet/pensando/Kconfig b/drivers/net/ethernet/pensando/Kconfig
index 5ea570be8379..bd0583e409df 100644
--- a/drivers/net/ethernet/pensando/Kconfig
+++ b/drivers/net/ethernet/pensando/Kconfig
@@ -26,7 +26,7 @@ config IONIC
26 found in 26 found in
27 <file:Documentation/networking/device_drivers/pensando/ionic.rst>. 27 <file:Documentation/networking/device_drivers/pensando/ionic.rst>.
28 28
29 To compile this driver as a module, choose M here. The module 29 To compile this driver as a module, choose M here. The module
30 will be called ionic. 30 will be called ionic.
31 31
32endif # NET_VENDOR_PENSANDO 32endif # NET_VENDOR_PENSANDO
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
index 7afc4a365b75..bc03cecf80cc 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
@@ -57,7 +57,7 @@ DEFINE_SHOW_ATTRIBUTE(identity);
57void ionic_debugfs_add_ident(struct ionic *ionic) 57void ionic_debugfs_add_ident(struct ionic *ionic)
58{ 58{
59 debugfs_create_file("identity", 0400, ionic->dentry, 59 debugfs_create_file("identity", 0400, ionic->dentry,
60 ionic, &identity_fops) ? 0 : -EOPNOTSUPP; 60 ionic, &identity_fops);
61} 61}
62 62
63void ionic_debugfs_add_sizes(struct ionic *ionic) 63void ionic_debugfs_add_sizes(struct ionic *ionic)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index db7c82742828..72107a0627a9 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -1704,6 +1704,7 @@ static struct ionic_lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index
1704 GFP_KERNEL); 1704 GFP_KERNEL);
1705 1705
1706 if (!lif->rss_ind_tbl) { 1706 if (!lif->rss_ind_tbl) {
1707 err = -ENOMEM;
1707 dev_err(dev, "Failed to allocate rss indirection table, aborting\n"); 1708 dev_err(dev, "Failed to allocate rss indirection table, aborting\n");
1708 goto err_out_free_qcqs; 1709 goto err_out_free_qcqs;
1709 } 1710 }
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index 0ae28f0d2523..004c0bfec41d 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -779,8 +779,7 @@ qede_rx_build_skb(struct qede_dev *edev,
779 return NULL; 779 return NULL;
780 780
781 skb_reserve(skb, pad); 781 skb_reserve(skb, pad);
782 memcpy(skb_put(skb, len), 782 skb_put_data(skb, page_address(bd->data) + offset, len);
783 page_address(bd->data) + offset, len);
784 qede_reuse_page(rxq, bd); 783 qede_reuse_page(rxq, bd);
785 goto out; 784 goto out;
786 } 785 }
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 1502fe8b0456..55db7fbd43cc 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -2007,7 +2007,7 @@ static int netsec_probe(struct platform_device *pdev)
2007 NETIF_MSG_LINK | NETIF_MSG_PROBE; 2007 NETIF_MSG_LINK | NETIF_MSG_PROBE;
2008 2008
2009 priv->phy_interface = device_get_phy_mode(&pdev->dev); 2009 priv->phy_interface = device_get_phy_mode(&pdev->dev);
2010 if (priv->phy_interface < 0) { 2010 if ((int)priv->phy_interface < 0) {
2011 dev_err(&pdev->dev, "missing required property 'phy-mode'\n"); 2011 dev_err(&pdev->dev, "missing required property 'phy-mode'\n");
2012 ret = -ENODEV; 2012 ret = -ENODEV;
2013 goto free_ndev; 2013 goto free_ndev;
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index 10d0c3e478ab..6e984d5a729f 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1566,7 +1566,7 @@ static int ave_probe(struct platform_device *pdev)
1566 1566
1567 np = dev->of_node; 1567 np = dev->of_node;
1568 phy_mode = of_get_phy_mode(np); 1568 phy_mode = of_get_phy_mode(np);
1569 if (phy_mode < 0) { 1569 if ((int)phy_mode < 0) {
1570 dev_err(dev, "phy-mode not found\n"); 1570 dev_err(dev, "phy-mode not found\n");
1571 return -EINVAL; 1571 return -EINVAL;
1572 } 1572 }
@@ -1662,19 +1662,19 @@ static int ave_probe(struct platform_device *pdev)
1662 "socionext,syscon-phy-mode", 1662 "socionext,syscon-phy-mode",
1663 1, 0, &args); 1663 1, 0, &args);
1664 if (ret) { 1664 if (ret) {
1665 netdev_err(ndev, "can't get syscon-phy-mode property\n"); 1665 dev_err(dev, "can't get syscon-phy-mode property\n");
1666 goto out_free_netdev; 1666 goto out_free_netdev;
1667 } 1667 }
1668 priv->regmap = syscon_node_to_regmap(args.np); 1668 priv->regmap = syscon_node_to_regmap(args.np);
1669 of_node_put(args.np); 1669 of_node_put(args.np);
1670 if (IS_ERR(priv->regmap)) { 1670 if (IS_ERR(priv->regmap)) {
1671 netdev_err(ndev, "can't map syscon-phy-mode\n"); 1671 dev_err(dev, "can't map syscon-phy-mode\n");
1672 ret = PTR_ERR(priv->regmap); 1672 ret = PTR_ERR(priv->regmap);
1673 goto out_free_netdev; 1673 goto out_free_netdev;
1674 } 1674 }
1675 ret = priv->data->get_pinmode(priv, phy_mode, args.args[0]); 1675 ret = priv->data->get_pinmode(priv, phy_mode, args.args[0]);
1676 if (ret) { 1676 if (ret) {
1677 netdev_err(ndev, "invalid phy-mode setting\n"); 1677 dev_err(dev, "invalid phy-mode setting\n");
1678 goto out_free_netdev; 1678 goto out_free_netdev;
1679 } 1679 }
1680 1680
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
index 2c6d7c69c8f7..0d21082ceb93 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
@@ -191,7 +191,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
191 struct device *dev = &gmac->pdev->dev; 191 struct device *dev = &gmac->pdev->dev;
192 192
193 gmac->phy_mode = of_get_phy_mode(dev->of_node); 193 gmac->phy_mode = of_get_phy_mode(dev->of_node);
194 if (gmac->phy_mode < 0) { 194 if ((int)gmac->phy_mode < 0) {
195 dev_err(dev, "missing phy mode property\n"); 195 dev_err(dev, "missing phy mode property\n");
196 return -EINVAL; 196 return -EINVAL;
197 } 197 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
index 9cda29e4b89d..306da8f6b7d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
@@ -339,7 +339,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
339 339
340 dwmac->dev = &pdev->dev; 340 dwmac->dev = &pdev->dev;
341 dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node); 341 dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node);
342 if (dwmac->phy_mode < 0) { 342 if ((int)dwmac->phy_mode < 0) {
343 dev_err(&pdev->dev, "missing phy-mode property\n"); 343 dev_err(&pdev->dev, "missing phy-mode property\n");
344 ret = -EINVAL; 344 ret = -EINVAL;
345 goto err_remove_config_dt; 345 goto err_remove_config_dt;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index d5173dd02a71..2b277b2c586b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -523,19 +523,18 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw,
523 struct stmmac_rss *cfg, u32 num_rxq) 523 struct stmmac_rss *cfg, u32 num_rxq)
524{ 524{
525 void __iomem *ioaddr = hw->pcsr; 525 void __iomem *ioaddr = hw->pcsr;
526 u32 *key = (u32 *)cfg->key;
527 int i, ret; 526 int i, ret;
528 u32 value; 527 u32 value;
529 528
530 value = readl(ioaddr + XGMAC_RSS_CTRL); 529 value = readl(ioaddr + XGMAC_RSS_CTRL);
531 if (!cfg->enable) { 530 if (!cfg || !cfg->enable) {
532 value &= ~XGMAC_RSSE; 531 value &= ~XGMAC_RSSE;
533 writel(value, ioaddr + XGMAC_RSS_CTRL); 532 writel(value, ioaddr + XGMAC_RSS_CTRL);
534 return 0; 533 return 0;
535 } 534 }
536 535
537 for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) { 536 for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) {
538 ret = dwxgmac2_rss_write_reg(ioaddr, true, i, *key++); 537 ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]);
539 if (ret) 538 if (ret)
540 return ret; 539 return ret;
541 } 540 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a6cb2aa60e64..d3232738fb25 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1557,13 +1557,15 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
1557 for (queue = 0; queue < rx_count; queue++) { 1557 for (queue = 0; queue < rx_count; queue++) {
1558 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; 1558 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1559 struct page_pool_params pp_params = { 0 }; 1559 struct page_pool_params pp_params = { 0 };
1560 unsigned int num_pages;
1560 1561
1561 rx_q->queue_index = queue; 1562 rx_q->queue_index = queue;
1562 rx_q->priv_data = priv; 1563 rx_q->priv_data = priv;
1563 1564
1564 pp_params.flags = PP_FLAG_DMA_MAP; 1565 pp_params.flags = PP_FLAG_DMA_MAP;
1565 pp_params.pool_size = DMA_RX_SIZE; 1566 pp_params.pool_size = DMA_RX_SIZE;
1566 pp_params.order = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE); 1567 num_pages = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE);
1568 pp_params.order = ilog2(num_pages);
1567 pp_params.nid = dev_to_node(priv->device); 1569 pp_params.nid = dev_to_node(priv->device);
1568 pp_params.dev = priv->device; 1570 pp_params.dev = priv->device;
1569 pp_params.dma_dir = DMA_FROM_DEVICE; 1571 pp_params.dma_dir = DMA_FROM_DEVICE;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index c56e89e1ae56..5f66f6161629 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -670,7 +670,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
670 unsigned int pkt_count; 670 unsigned int pkt_count;
671 int i, ret = 0; 671 int i, ret = 0;
672 672
673 if (!phydev || !phydev->pause) 673 if (!phydev || (!phydev->pause && !phydev->asym_pause))
674 return -EOPNOTSUPP; 674 return -EOPNOTSUPP;
675 675
676 tpriv = kzalloc(sizeof(*tpriv), GFP_KERNEL); 676 tpriv = kzalloc(sizeof(*tpriv), GFP_KERNEL);
@@ -1233,12 +1233,9 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
1233 return -EOPNOTSUPP; 1233 return -EOPNOTSUPP;
1234 if (!priv->dma_cap.l3l4fnum) 1234 if (!priv->dma_cap.l3l4fnum)
1235 return -EOPNOTSUPP; 1235 return -EOPNOTSUPP;
1236 if (priv->rss.enable) { 1236 if (priv->rss.enable)
1237 struct stmmac_rss rss = { .enable = false, }; 1237 stmmac_rss_configure(priv, priv->hw, NULL,
1238
1239 stmmac_rss_configure(priv, priv->hw, &rss,
1240 priv->plat->rx_queues_to_use); 1238 priv->plat->rx_queues_to_use);
1241 }
1242 1239
1243 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); 1240 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
1244 if (!dissector) { 1241 if (!dissector) {
@@ -1357,12 +1354,9 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
1357 return -EOPNOTSUPP; 1354 return -EOPNOTSUPP;
1358 if (!priv->dma_cap.l3l4fnum) 1355 if (!priv->dma_cap.l3l4fnum)
1359 return -EOPNOTSUPP; 1356 return -EOPNOTSUPP;
1360 if (priv->rss.enable) { 1357 if (priv->rss.enable)
1361 struct stmmac_rss rss = { .enable = false, }; 1358 stmmac_rss_configure(priv, priv->hw, NULL,
1362
1363 stmmac_rss_configure(priv, priv->hw, &rss,
1364 priv->plat->rx_queues_to_use); 1359 priv->plat->rx_queues_to_use);
1365 }
1366 1360
1367 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); 1361 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
1368 if (!dissector) { 1362 if (!dissector) {
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4fc627fb4d11..676006f32f91 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1762,7 +1762,7 @@ static int axienet_probe(struct platform_device *pdev)
1762 } 1762 }
1763 } else { 1763 } else {
1764 lp->phy_mode = of_get_phy_mode(pdev->dev.of_node); 1764 lp->phy_mode = of_get_phy_mode(pdev->dev.of_node);
1765 if (lp->phy_mode < 0) { 1765 if ((int)lp->phy_mode < 0) {
1766 ret = -EINVAL; 1766 ret = -EINVAL;
1767 goto free_netdev; 1767 goto free_netdev;
1768 } 1768 }
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 8f46aa1ddec0..cb7637364b40 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1235,6 +1235,7 @@ deliver:
1235 macsec_rxsa_put(rx_sa); 1235 macsec_rxsa_put(rx_sa);
1236 macsec_rxsc_put(rx_sc); 1236 macsec_rxsc_put(rx_sc);
1237 1237
1238 skb_orphan(skb);
1238 ret = gro_cells_receive(&macsec->gro_cells, skb); 1239 ret = gro_cells_receive(&macsec->gro_cells, skb);
1239 if (ret == NET_RX_SUCCESS) 1240 if (ret == NET_RX_SUCCESS)
1240 count_rx(dev, skb->len); 1241 count_rx(dev, skb->len);
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 03be30cde552..fe602648b99f 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -460,9 +460,9 @@ config RENESAS_PHY
460 Supports the Renesas PHYs uPD60620 and uPD60620A. 460 Supports the Renesas PHYs uPD60620 and uPD60620A.
461 461
462config ROCKCHIP_PHY 462config ROCKCHIP_PHY
463 tristate "Driver for Rockchip Ethernet PHYs" 463 tristate "Driver for Rockchip Ethernet PHYs"
464 ---help--- 464 ---help---
465 Currently supports the integrated Ethernet PHY. 465 Currently supports the integrated Ethernet PHY.
466 466
467config SMSC_PHY 467config SMSC_PHY
468 tristate "SMSC PHYs" 468 tristate "SMSC PHYs"
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 3c8186f269f9..2fea5541c35a 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -763,6 +763,8 @@ static int ksz9031_get_features(struct phy_device *phydev)
763 * Whenever the device's Asymmetric Pause capability is set to 1, 763 * Whenever the device's Asymmetric Pause capability is set to 1,
764 * link-up may fail after a link-up to link-down transition. 764 * link-up may fail after a link-up to link-down transition.
765 * 765 *
766 * The Errata Sheet is for ksz9031, but ksz9021 has the same issue
767 *
766 * Workaround: 768 * Workaround:
767 * Do not enable the Asymmetric Pause capability bit. 769 * Do not enable the Asymmetric Pause capability bit.
768 */ 770 */
@@ -1076,6 +1078,7 @@ static struct phy_driver ksphy_driver[] = {
1076 /* PHY_GBIT_FEATURES */ 1078 /* PHY_GBIT_FEATURES */
1077 .driver_data = &ksz9021_type, 1079 .driver_data = &ksz9021_type,
1078 .probe = kszphy_probe, 1080 .probe = kszphy_probe,
1081 .get_features = ksz9031_get_features,
1079 .config_init = ksz9021_config_init, 1082 .config_init = ksz9021_config_init,
1080 .ack_interrupt = kszphy_ack_interrupt, 1083 .ack_interrupt = kszphy_ack_interrupt,
1081 .config_intr = kszphy_config_intr, 1084 .config_intr = kszphy_config_intr,
diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c
index a221dd552c3c..a5bf0874c7d8 100644
--- a/drivers/net/phy/national.c
+++ b/drivers/net/phy/national.c
@@ -105,14 +105,17 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)
105 105
106static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable) 106static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
107{ 107{
108 u16 lb_dis = BIT(1);
109
108 if (disable) 110 if (disable)
109 ns_exp_write(phydev, 0x1c0, ns_exp_read(phydev, 0x1c0) | 1); 111 ns_exp_write(phydev, 0x1c0,
112 ns_exp_read(phydev, 0x1c0) | lb_dis);
110 else 113 else
111 ns_exp_write(phydev, 0x1c0, 114 ns_exp_write(phydev, 0x1c0,
112 ns_exp_read(phydev, 0x1c0) & 0xfffe); 115 ns_exp_read(phydev, 0x1c0) & ~lb_dis);
113 116
114 pr_debug("10BASE-T HDX loopback %s\n", 117 pr_debug("10BASE-T HDX loopback %s\n",
115 (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on"); 118 (ns_exp_read(phydev, 0x1c0) & lb_dis) ? "off" : "on");
116} 119}
117 120
118static int ns_config_init(struct phy_device *phydev) 121static int ns_config_init(struct phy_device *phydev)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a30e41a56085..9a1b006904a7 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1415,6 +1415,8 @@ static void __ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb)
1415 netif_wake_queue(ppp->dev); 1415 netif_wake_queue(ppp->dev);
1416 else 1416 else
1417 netif_stop_queue(ppp->dev); 1417 netif_stop_queue(ppp->dev);
1418 } else {
1419 kfree_skb(skb);
1418 } 1420 }
1419 ppp_xmit_unlock(ppp); 1421 ppp_xmit_unlock(ppp);
1420} 1422}
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index dd614c2cd994..3ae70c7e6860 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -1200,7 +1200,7 @@ err_kfree:
1200 kfree_skb(skb); 1200 kfree_skb(skb);
1201err: 1201err:
1202 rcu_read_lock(); 1202 rcu_read_lock();
1203 tap = rcu_dereference(q->tap); 1203 tap = rcu_dereference(q->tap);
1204 if (tap && tap->count_tx_dropped) 1204 if (tap && tap->count_tx_dropped)
1205 tap->count_tx_dropped(tap); 1205 tap->count_tx_dropped(tap);
1206 rcu_read_unlock(); 1206 rcu_read_unlock();
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 50c05d0f44cb..00cab3f43a4c 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -681,8 +681,12 @@ cdc_ncm_find_endpoints(struct usbnet *dev, struct usb_interface *intf)
681 u8 ep; 681 u8 ep;
682 682
683 for (ep = 0; ep < intf->cur_altsetting->desc.bNumEndpoints; ep++) { 683 for (ep = 0; ep < intf->cur_altsetting->desc.bNumEndpoints; ep++) {
684
685 e = intf->cur_altsetting->endpoint + ep; 684 e = intf->cur_altsetting->endpoint + ep;
685
686 /* ignore endpoints which cannot transfer data */
687 if (!usb_endpoint_maxp(&e->desc))
688 continue;
689
686 switch (e->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { 690 switch (e->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
687 case USB_ENDPOINT_XFER_INT: 691 case USB_ENDPOINT_XFER_INT:
688 if (usb_endpoint_dir_in(&e->desc)) { 692 if (usb_endpoint_dir_in(&e->desc)) {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 58952a79b05f..dde05e2fdc3e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -100,6 +100,11 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
100 int intr = 0; 100 int intr = 0;
101 101
102 e = alt->endpoint + ep; 102 e = alt->endpoint + ep;
103
104 /* ignore endpoints which cannot transfer data */
105 if (!usb_endpoint_maxp(&e->desc))
106 continue;
107
103 switch (e->desc.bmAttributes) { 108 switch (e->desc.bmAttributes) {
104 case USB_ENDPOINT_XFER_INT: 109 case USB_ENDPOINT_XFER_INT:
105 if (!usb_endpoint_dir_in(&e->desc)) 110 if (!usb_endpoint_dir_in(&e->desc))
@@ -339,6 +344,8 @@ void usbnet_update_max_qlen(struct usbnet *dev)
339{ 344{
340 enum usb_device_speed speed = dev->udev->speed; 345 enum usb_device_speed speed = dev->udev->speed;
341 346
347 if (!dev->rx_urb_size || !dev->hard_mtu)
348 goto insanity;
342 switch (speed) { 349 switch (speed) {
343 case USB_SPEED_HIGH: 350 case USB_SPEED_HIGH:
344 dev->rx_qlen = MAX_QUEUE_MEMORY / dev->rx_urb_size; 351 dev->rx_qlen = MAX_QUEUE_MEMORY / dev->rx_urb_size;
@@ -355,6 +362,7 @@ void usbnet_update_max_qlen(struct usbnet *dev)
355 dev->tx_qlen = 5 * MAX_QUEUE_MEMORY / dev->hard_mtu; 362 dev->tx_qlen = 5 * MAX_QUEUE_MEMORY / dev->hard_mtu;
356 break; 363 break;
357 default: 364 default:
365insanity:
358 dev->rx_qlen = dev->tx_qlen = 4; 366 dev->rx_qlen = dev->tx_qlen = 4;
359 } 367 }
360} 368}
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 6e84328bdd40..a4b38a980c3c 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1154,7 +1154,8 @@ static int vrf_fib_rule(const struct net_device *dev, __u8 family, bool add_it)
1154 struct sk_buff *skb; 1154 struct sk_buff *skb;
1155 int err; 1155 int err;
1156 1156
1157 if (family == AF_INET6 && !ipv6_mod_enabled()) 1157 if ((family == AF_INET6 || family == RTNL_FAMILY_IP6MR) &&
1158 !ipv6_mod_enabled())
1158 return 0; 1159 return 0;
1159 1160
1160 skb = nlmsg_new(vrf_fib_rule_nl_size(), GFP_KERNEL); 1161 skb = nlmsg_new(vrf_fib_rule_nl_size(), GFP_KERNEL);
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index d98d6ac90f3d..56616d988c96 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -34,7 +34,7 @@ config ATH_TRACEPOINTS
34 depends on ATH_DEBUG 34 depends on ATH_DEBUG
35 depends on EVENT_TRACING 35 depends on EVENT_TRACING
36 ---help--- 36 ---help---
37 This option enables tracepoints for atheros wireless drivers. 37 This option enables tracepoints for atheros wireless drivers.
38 Currently, ath9k makes use of this facility. 38 Currently, ath9k makes use of this facility.
39 39
40config ATH_REG_DYNAMIC_USER_REG_HINTS 40config ATH_REG_DYNAMIC_USER_REG_HINTS
diff --git a/drivers/net/wireless/ath/ar5523/Kconfig b/drivers/net/wireless/ath/ar5523/Kconfig
index 41d3c9a48b08..65b39c7d035d 100644
--- a/drivers/net/wireless/ath/ar5523/Kconfig
+++ b/drivers/net/wireless/ath/ar5523/Kconfig
@@ -5,5 +5,5 @@ config AR5523
5 select ATH_COMMON 5 select ATH_COMMON
6 select FW_LOADER 6 select FW_LOADER
7 ---help--- 7 ---help---
8 This module add support for AR5523 based USB dongles such as D-Link 8 This module add support for AR5523 based USB dongles such as D-Link
9 DWL-G132, Netgear WPN111 and many more. 9 DWL-G132, Netgear WPN111 and many more.
diff --git a/drivers/net/wireless/ath/ath6kl/Kconfig b/drivers/net/wireless/ath/ath6kl/Kconfig
index dcf8ca0dcc52..62c22fdcca38 100644
--- a/drivers/net/wireless/ath/ath6kl/Kconfig
+++ b/drivers/net/wireless/ath/ath6kl/Kconfig
@@ -2,7 +2,7 @@
2config ATH6KL 2config ATH6KL
3 tristate "Atheros mobile chipsets support" 3 tristate "Atheros mobile chipsets support"
4 depends on CFG80211 4 depends on CFG80211
5 ---help--- 5 ---help---
6 This module adds core support for wireless adapters based on 6 This module adds core support for wireless adapters based on
7 Atheros AR6003 and AR6004 chipsets. You still need separate 7 Atheros AR6003 and AR6004 chipsets. You still need separate
8 bus drivers for USB and SDIO to be able to use real devices. 8 bus drivers for USB and SDIO to be able to use real devices.
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig
index 2d1247f61297..c99f42284465 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -148,7 +148,7 @@ config ATH9K_CHANNEL_CONTEXT
148 depends on ATH9K 148 depends on ATH9K
149 default n 149 default n
150 ---help--- 150 ---help---
151 This option enables channel context support in ath9k, which is needed 151 This option enables channel context support in ath9k, which is needed
152 for multi-channel concurrency. Enable this if P2P PowerSave support 152 for multi-channel concurrency. Enable this if P2P PowerSave support
153 is required. 153 is required.
154 154
diff --git a/drivers/net/wireless/ath/carl9170/Kconfig b/drivers/net/wireless/ath/carl9170/Kconfig
index 757eb765e17c..b1bce7aad399 100644
--- a/drivers/net/wireless/ath/carl9170/Kconfig
+++ b/drivers/net/wireless/ath/carl9170/Kconfig
@@ -41,9 +41,9 @@ config CARL9170_WPC
41 default y 41 default y
42 42
43config CARL9170_HWRNG 43config CARL9170_HWRNG
44 bool "Random number generator" 44 bool "Random number generator"
45 depends on CARL9170 && (HW_RANDOM = y || HW_RANDOM = CARL9170) 45 depends on CARL9170 && (HW_RANDOM = y || HW_RANDOM = CARL9170)
46 default n 46 default n
47 help 47 help
48 Provides a hardware random number generator to the kernel. 48 Provides a hardware random number generator to the kernel.
49 49
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index cb13652491ad..598c1fba9dac 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -1012,11 +1012,11 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
1012 skb_orphan(skb); 1012 skb_orphan(skb);
1013 1013
1014 if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) { 1014 if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) {
1015 wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
1015 dev_kfree_skb(skb); 1016 dev_kfree_skb(skb);
1016 ndev->stats.rx_dropped++; 1017 ndev->stats.rx_dropped++;
1017 stats->rx_replay++; 1018 stats->rx_replay++;
1018 stats->rx_dropped++; 1019 stats->rx_dropped++;
1019 wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
1020 return; 1020 return;
1021 } 1021 }
1022 1022
diff --git a/drivers/net/wireless/atmel/Kconfig b/drivers/net/wireless/atmel/Kconfig
index 809bdf331848..4c0556b3a5ba 100644
--- a/drivers/net/wireless/atmel/Kconfig
+++ b/drivers/net/wireless/atmel/Kconfig
@@ -20,22 +20,22 @@ config ATMEL
20 select FW_LOADER 20 select FW_LOADER
21 select CRC32 21 select CRC32
22 ---help--- 22 ---help---
23 A driver 802.11b wireless cards based on the Atmel fast-vnet 23 A driver 802.11b wireless cards based on the Atmel fast-vnet
24 chips. This driver supports standard Linux wireless extensions. 24 chips. This driver supports standard Linux wireless extensions.
25 25
26 Many cards based on this chipset do not have flash memory 26 Many cards based on this chipset do not have flash memory
27 and need their firmware loaded at start-up. If yours is 27 and need their firmware loaded at start-up. If yours is
28 one of these, you will need to provide a firmware image 28 one of these, you will need to provide a firmware image
29 to be loaded into the card by the driver. The Atmel 29 to be loaded into the card by the driver. The Atmel
30 firmware package can be downloaded from 30 firmware package can be downloaded from
31 <http://www.thekelleys.org.uk/atmel> 31 <http://www.thekelleys.org.uk/atmel>
32 32
33config PCI_ATMEL 33config PCI_ATMEL
34 tristate "Atmel at76c506 PCI cards" 34 tristate "Atmel at76c506 PCI cards"
35 depends on ATMEL && PCI 35 depends on ATMEL && PCI
36 ---help--- 36 ---help---
37 Enable support for PCI and mini-PCI cards containing the 37 Enable support for PCI and mini-PCI cards containing the
38 Atmel at76c506 chip. 38 Atmel at76c506 chip.
39 39
40config PCMCIA_ATMEL 40config PCMCIA_ATMEL
41 tristate "Atmel at76c502/at76c504 PCMCIA cards" 41 tristate "Atmel at76c502/at76c504 PCMCIA cards"
@@ -48,11 +48,11 @@ config PCMCIA_ATMEL
48 Atmel at76c502 and at76c504 chips. 48 Atmel at76c502 and at76c504 chips.
49 49
50config AT76C50X_USB 50config AT76C50X_USB
51 tristate "Atmel at76c503/at76c505/at76c505a USB cards" 51 tristate "Atmel at76c503/at76c505/at76c505a USB cards"
52 depends on MAC80211 && USB 52 depends on MAC80211 && USB
53 select FW_LOADER 53 select FW_LOADER
54 ---help--- 54 ---help---
55 Enable support for USB Wireless devices using Atmel at76c503, 55 Enable support for USB Wireless devices using Atmel at76c503,
56 at76c505 or at76c505a chips. 56 at76c505 or at76c505a chips.
57 57
58endif # WLAN_VENDOR_ATMEL 58endif # WLAN_VENDOR_ATMEL
diff --git a/drivers/net/wireless/intel/ipw2x00/Kconfig b/drivers/net/wireless/intel/ipw2x00/Kconfig
index 5d2878a73732..ab17903ba9f8 100644
--- a/drivers/net/wireless/intel/ipw2x00/Kconfig
+++ b/drivers/net/wireless/intel/ipw2x00/Kconfig
@@ -13,37 +13,37 @@ config IPW2100
13 select LIB80211 13 select LIB80211
14 select LIBIPW 14 select LIBIPW
15 ---help--- 15 ---help---
16 A driver for the Intel PRO/Wireless 2100 Network 16 A driver for the Intel PRO/Wireless 2100 Network
17 Connection 802.11b wireless network adapter. 17 Connection 802.11b wireless network adapter.
18 18
19 See <file:Documentation/networking/device_drivers/intel/ipw2100.txt> 19 See <file:Documentation/networking/device_drivers/intel/ipw2100.txt>
20 for information on the capabilities currently enabled in this driver 20 for information on the capabilities currently enabled in this driver
21 and for tips for debugging issues and problems. 21 and for tips for debugging issues and problems.
22 22
23 In order to use this driver, you will need a firmware image for it. 23 In order to use this driver, you will need a firmware image for it.
24 You can obtain the firmware from 24 You can obtain the firmware from
25 <http://ipw2100.sf.net/>. Once you have the firmware image, you 25 <http://ipw2100.sf.net/>. Once you have the firmware image, you
26 will need to place it in /lib/firmware. 26 will need to place it in /lib/firmware.
27 27
28 You will also very likely need the Wireless Tools in order to 28 You will also very likely need the Wireless Tools in order to
29 configure your card: 29 configure your card:
30 30
31 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. 31 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
32
33 It is recommended that you compile this driver as a module (M)
34 rather than built-in (Y). This driver requires firmware at device
35 initialization time, and when built-in this typically happens
36 before the filesystem is accessible (hence firmware will be
37 unavailable and initialization will fail). If you do choose to build
38 this driver into your kernel image, you can avoid this problem by
39 including the firmware and a firmware loader in an initramfs.
32 40
33 It is recommended that you compile this driver as a module (M)
34 rather than built-in (Y). This driver requires firmware at device
35 initialization time, and when built-in this typically happens
36 before the filesystem is accessible (hence firmware will be
37 unavailable and initialization will fail). If you do choose to build
38 this driver into your kernel image, you can avoid this problem by
39 including the firmware and a firmware loader in an initramfs.
40
41config IPW2100_MONITOR 41config IPW2100_MONITOR
42 bool "Enable promiscuous mode" 42 bool "Enable promiscuous mode"
43 depends on IPW2100 43 depends on IPW2100
44 ---help--- 44 ---help---
45 Enables promiscuous/monitor mode support for the ipw2100 driver. 45 Enables promiscuous/monitor mode support for the ipw2100 driver.
46 With this feature compiled into the driver, you can switch to 46 With this feature compiled into the driver, you can switch to
47 promiscuous mode via the Wireless Tool's Monitor mode. While in this 47 promiscuous mode via the Wireless Tool's Monitor mode. While in this
48 mode, no packets can be sent. 48 mode, no packets can be sent.
49 49
@@ -51,17 +51,17 @@ config IPW2100_DEBUG
51 bool "Enable full debugging output in IPW2100 module." 51 bool "Enable full debugging output in IPW2100 module."
52 depends on IPW2100 52 depends on IPW2100
53 ---help--- 53 ---help---
54 This option will enable debug tracing output for the IPW2100. 54 This option will enable debug tracing output for the IPW2100.
55 55
56 This will result in the kernel module being ~60k larger. You can 56 This will result in the kernel module being ~60k larger. You can
57 control which debug output is sent to the kernel log by setting the 57 control which debug output is sent to the kernel log by setting the
58 value in 58 value in
59 59
60 /sys/bus/pci/drivers/ipw2100/debug_level 60 /sys/bus/pci/drivers/ipw2100/debug_level
61 61
62 This entry will only exist if this option is enabled. 62 This entry will only exist if this option is enabled.
63 63
64 If you are not trying to debug or develop the IPW2100 driver, you 64 If you are not trying to debug or develop the IPW2100 driver, you
65 most likely want to say N here. 65 most likely want to say N here.
66 66
67config IPW2200 67config IPW2200
@@ -75,37 +75,37 @@ config IPW2200
75 select LIB80211 75 select LIB80211
76 select LIBIPW 76 select LIBIPW
77 ---help--- 77 ---help---
78 A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network 78 A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network
79 Connection adapters. 79 Connection adapters.
80 80
81 See <file:Documentation/networking/device_drivers/intel/ipw2200.txt> 81 See <file:Documentation/networking/device_drivers/intel/ipw2200.txt>
82 for information on the capabilities currently enabled in this 82 for information on the capabilities currently enabled in this
83 driver and for tips for debugging issues and problems. 83 driver and for tips for debugging issues and problems.
84 84
85 In order to use this driver, you will need a firmware image for it. 85 In order to use this driver, you will need a firmware image for it.
86 You can obtain the firmware from 86 You can obtain the firmware from
87 <http://ipw2200.sf.net/>. See the above referenced README.ipw2200 87 <http://ipw2200.sf.net/>. See the above referenced README.ipw2200
88 for information on where to install the firmware images. 88 for information on where to install the firmware images.
89 89
90 You will also very likely need the Wireless Tools in order to 90 You will also very likely need the Wireless Tools in order to
91 configure your card: 91 configure your card:
92 92
93 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. 93 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
94 94
95 It is recommended that you compile this driver as a module (M) 95 It is recommended that you compile this driver as a module (M)
96 rather than built-in (Y). This driver requires firmware at device 96 rather than built-in (Y). This driver requires firmware at device
97 initialization time, and when built-in this typically happens 97 initialization time, and when built-in this typically happens
98 before the filesystem is accessible (hence firmware will be 98 before the filesystem is accessible (hence firmware will be
99 unavailable and initialization will fail). If you do choose to build 99 unavailable and initialization will fail). If you do choose to build
100 this driver into your kernel image, you can avoid this problem by 100 this driver into your kernel image, you can avoid this problem by
101 including the firmware and a firmware loader in an initramfs. 101 including the firmware and a firmware loader in an initramfs.
102 102
103config IPW2200_MONITOR 103config IPW2200_MONITOR
104 bool "Enable promiscuous mode" 104 bool "Enable promiscuous mode"
105 depends on IPW2200 105 depends on IPW2200
106 ---help--- 106 ---help---
107 Enables promiscuous/monitor mode support for the ipw2200 driver. 107 Enables promiscuous/monitor mode support for the ipw2200 driver.
108 With this feature compiled into the driver, you can switch to 108 With this feature compiled into the driver, you can switch to
109 promiscuous mode via the Wireless Tool's Monitor mode. While in this 109 promiscuous mode via the Wireless Tool's Monitor mode. While in this
110 mode, no packets can be sent. 110 mode, no packets can be sent.
111 111
@@ -118,28 +118,28 @@ config IPW2200_PROMISCUOUS
118 depends on IPW2200_MONITOR 118 depends on IPW2200_MONITOR
119 select IPW2200_RADIOTAP 119 select IPW2200_RADIOTAP
120 ---help--- 120 ---help---
121 Enables the creation of a second interface prefixed 'rtap'. 121 Enables the creation of a second interface prefixed 'rtap'.
122 This second interface will provide every received in radiotap 122 This second interface will provide every received in radiotap
123 format. 123 format.
124 124
125 This is useful for performing wireless network analysis while 125 This is useful for performing wireless network analysis while
126 maintaining an active association. 126 maintaining an active association.
127
128 Example usage:
127 129
128 Example usage: 130 % modprobe ipw2200 rtap_iface=1
131 % ifconfig rtap0 up
132 % tethereal -i rtap0
129 133
130 % modprobe ipw2200 rtap_iface=1 134 If you do not specify 'rtap_iface=1' as a module parameter then
131 % ifconfig rtap0 up 135 the rtap interface will not be created and you will need to turn
132 % tethereal -i rtap0 136 it on via sysfs:
133 137
134 If you do not specify 'rtap_iface=1' as a module parameter then 138 % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
135 the rtap interface will not be created and you will need to turn
136 it on via sysfs:
137
138 % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
139 139
140config IPW2200_QOS 140config IPW2200_QOS
141 bool "Enable QoS support" 141 bool "Enable QoS support"
142 depends on IPW2200 142 depends on IPW2200
143 143
144config IPW2200_DEBUG 144config IPW2200_DEBUG
145 bool "Enable full debugging output in IPW2200 module." 145 bool "Enable full debugging output in IPW2200 module."
diff --git a/drivers/net/wireless/intel/iwlegacy/Kconfig b/drivers/net/wireless/intel/iwlegacy/Kconfig
index e329fd7b09c0..100f55858b13 100644
--- a/drivers/net/wireless/intel/iwlegacy/Kconfig
+++ b/drivers/net/wireless/intel/iwlegacy/Kconfig
@@ -91,9 +91,9 @@ config IWLEGACY_DEBUG
91 any problems you may encounter. 91 any problems you may encounter.
92 92
93config IWLEGACY_DEBUGFS 93config IWLEGACY_DEBUGFS
94 bool "iwlegacy (iwl 3945/4965) debugfs support" 94 bool "iwlegacy (iwl 3945/4965) debugfs support"
95 depends on IWLEGACY && MAC80211_DEBUGFS 95 depends on IWLEGACY && MAC80211_DEBUGFS
96 ---help--- 96 ---help---
97 Enable creation of debugfs files for the iwlegacy drivers. This 97 Enable creation of debugfs files for the iwlegacy drivers. This
98 is a low-impact option that allows getting insight into the 98 is a low-impact option that allows getting insight into the
99 driver's state at runtime. 99 driver's state at runtime.
diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig
index 7dbc0d38bb3b..091d621ad25f 100644
--- a/drivers/net/wireless/intel/iwlwifi/Kconfig
+++ b/drivers/net/wireless/intel/iwlwifi/Kconfig
@@ -119,9 +119,9 @@ config IWLWIFI_DEBUG
119 any problems you may encounter. 119 any problems you may encounter.
120 120
121config IWLWIFI_DEBUGFS 121config IWLWIFI_DEBUGFS
122 bool "iwlwifi debugfs support" 122 bool "iwlwifi debugfs support"
123 depends on MAC80211_DEBUGFS 123 depends on MAC80211_DEBUGFS
124 ---help--- 124 ---help---
125 Enable creation of debugfs files for the iwlwifi drivers. This 125 Enable creation of debugfs files for the iwlwifi drivers. This
126 is a low-impact option that allows getting insight into the 126 is a low-impact option that allows getting insight into the
127 driver's state at runtime. 127 driver's state at runtime.
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 014eca6596e2..32a5e4e5461f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -889,11 +889,13 @@ static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm)
889 * firmware versions. Unfortunately, we don't have a TLV API 889 * firmware versions. Unfortunately, we don't have a TLV API
890 * flag to rely on, so rely on the major version which is in 890 * flag to rely on, so rely on the major version which is in
891 * the first byte of ucode_ver. This was implemented 891 * the first byte of ucode_ver. This was implemented
892 * initially on version 38 and then backported to 36, 29 and 892 * initially on version 38 and then backported to29 and 17.
893 * 17. 893 * The intention was to have it in 36 as well, but not all
894 * 8000 family got this feature enabled. The 8000 family is
895 * the only one using version 36, so skip this version
896 * entirely.
894 */ 897 */
895 return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || 898 return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 ||
896 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 36 ||
897 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || 899 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 ||
898 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; 900 IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17;
899} 901}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 32a708301cfc..f0c539b37ea7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -555,16 +555,19 @@ static int compare_temps(const void *a, const void *b)
555 return ((s16)le16_to_cpu(*(__le16 *)a) - 555 return ((s16)le16_to_cpu(*(__le16 *)a) -
556 (s16)le16_to_cpu(*(__le16 *)b)); 556 (s16)le16_to_cpu(*(__le16 *)b));
557} 557}
558#endif
558 559
559int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm) 560int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
560{ 561{
561 struct temp_report_ths_cmd cmd = {0}; 562 struct temp_report_ths_cmd cmd = {0};
562 int ret, i, j, idx = 0; 563 int ret;
564#ifdef CONFIG_THERMAL
565 int i, j, idx = 0;
563 566
564 lockdep_assert_held(&mvm->mutex); 567 lockdep_assert_held(&mvm->mutex);
565 568
566 if (!mvm->tz_device.tzone) 569 if (!mvm->tz_device.tzone)
567 return -EINVAL; 570 goto send;
568 571
569 /* The driver holds array of temperature trips that are unsorted 572 /* The driver holds array of temperature trips that are unsorted
570 * and uncompressed, the FW should get it compressed and sorted 573 * and uncompressed, the FW should get it compressed and sorted
@@ -597,6 +600,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
597 } 600 }
598 601
599send: 602send:
603#endif
600 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP, 604 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP,
601 TEMP_REPORTING_THRESHOLDS_CMD), 605 TEMP_REPORTING_THRESHOLDS_CMD),
602 0, sizeof(cmd), &cmd); 606 0, sizeof(cmd), &cmd);
@@ -607,6 +611,7 @@ send:
607 return ret; 611 return ret;
608} 612}
609 613
614#ifdef CONFIG_THERMAL
610static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, 615static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
611 int *temperature) 616 int *temperature)
612{ 617{
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 275d5eaed3b7..842cd81704db 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -333,7 +333,6 @@ static int mt7615_driver_own(struct mt7615_dev *dev)
333 333
334static int mt7615_load_patch(struct mt7615_dev *dev) 334static int mt7615_load_patch(struct mt7615_dev *dev)
335{ 335{
336 const char *firmware = MT7615_ROM_PATCH;
337 const struct mt7615_patch_hdr *hdr; 336 const struct mt7615_patch_hdr *hdr;
338 const struct firmware *fw = NULL; 337 const struct firmware *fw = NULL;
339 int len, ret, sem; 338 int len, ret, sem;
@@ -349,7 +348,7 @@ static int mt7615_load_patch(struct mt7615_dev *dev)
349 return -EAGAIN; 348 return -EAGAIN;
350 } 349 }
351 350
352 ret = request_firmware(&fw, firmware, dev->mt76.dev); 351 ret = request_firmware(&fw, MT7615_ROM_PATCH, dev->mt76.dev);
353 if (ret) 352 if (ret)
354 goto out; 353 goto out;
355 354
@@ -447,13 +446,11 @@ mt7615_mcu_send_ram_firmware(struct mt7615_dev *dev,
447 446
448static int mt7615_load_ram(struct mt7615_dev *dev) 447static int mt7615_load_ram(struct mt7615_dev *dev)
449{ 448{
450 const struct firmware *fw;
451 const struct mt7615_fw_trailer *hdr; 449 const struct mt7615_fw_trailer *hdr;
452 const char *n9_firmware = MT7615_FIRMWARE_N9; 450 const struct firmware *fw;
453 const char *cr4_firmware = MT7615_FIRMWARE_CR4;
454 int ret; 451 int ret;
455 452
456 ret = request_firmware(&fw, n9_firmware, dev->mt76.dev); 453 ret = request_firmware(&fw, MT7615_FIRMWARE_N9, dev->mt76.dev);
457 if (ret) 454 if (ret)
458 return ret; 455 return ret;
459 456
@@ -482,7 +479,7 @@ static int mt7615_load_ram(struct mt7615_dev *dev)
482 479
483 release_firmware(fw); 480 release_firmware(fw);
484 481
485 ret = request_firmware(&fw, cr4_firmware, dev->mt76.dev); 482 ret = request_firmware(&fw, MT7615_FIRMWARE_CR4, dev->mt76.dev);
486 if (ret) 483 if (ret)
487 return ret; 484 return ret;
488 485
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index cef3fd43cb00..7963e302d705 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -26,9 +26,9 @@
26#define MT7615_RX_RING_SIZE 1024 26#define MT7615_RX_RING_SIZE 1024
27#define MT7615_RX_MCU_RING_SIZE 512 27#define MT7615_RX_MCU_RING_SIZE 512
28 28
29#define MT7615_FIRMWARE_CR4 "mt7615_cr4.bin" 29#define MT7615_FIRMWARE_CR4 "mediatek/mt7615_cr4.bin"
30#define MT7615_FIRMWARE_N9 "mt7615_n9.bin" 30#define MT7615_FIRMWARE_N9 "mediatek/mt7615_n9.bin"
31#define MT7615_ROM_PATCH "mt7615_rom_patch.bin" 31#define MT7615_ROM_PATCH "mediatek/mt7615_rom_patch.bin"
32 32
33#define MT7615_EEPROM_SIZE 1024 33#define MT7615_EEPROM_SIZE 1024
34#define MT7615_TOKEN_SIZE 4096 34#define MT7615_TOKEN_SIZE 4096
diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
index 858f8aa3e616..f8a9244ce012 100644
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -98,17 +98,17 @@ config RT2800PCI_RT53XX
98 bool "rt2800pci - Include support for rt53xx devices (EXPERIMENTAL)" 98 bool "rt2800pci - Include support for rt53xx devices (EXPERIMENTAL)"
99 default y 99 default y
100 ---help--- 100 ---help---
101 This adds support for rt53xx wireless chipset family to the 101 This adds support for rt53xx wireless chipset family to the
102 rt2800pci driver. 102 rt2800pci driver.
103 Supported chips: RT5390 103 Supported chips: RT5390
104 104
105config RT2800PCI_RT3290 105config RT2800PCI_RT3290
106 bool "rt2800pci - Include support for rt3290 devices (EXPERIMENTAL)" 106 bool "rt2800pci - Include support for rt3290 devices (EXPERIMENTAL)"
107 default y 107 default y
108 ---help--- 108 ---help---
109 This adds support for rt3290 wireless chipset family to the 109 This adds support for rt3290 wireless chipset family to the
110 rt2800pci driver. 110 rt2800pci driver.
111 Supported chips: RT3290 111 Supported chips: RT3290
112endif 112endif
113 113
114config RT2500USB 114config RT2500USB
@@ -176,16 +176,16 @@ config RT2800USB_RT3573
176config RT2800USB_RT53XX 176config RT2800USB_RT53XX
177 bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)" 177 bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)"
178 ---help--- 178 ---help---
179 This adds support for rt53xx wireless chipset family to the 179 This adds support for rt53xx wireless chipset family to the
180 rt2800usb driver. 180 rt2800usb driver.
181 Supported chips: RT5370 181 Supported chips: RT5370
182 182
183config RT2800USB_RT55XX 183config RT2800USB_RT55XX
184 bool "rt2800usb - Include support for rt55xx devices (EXPERIMENTAL)" 184 bool "rt2800usb - Include support for rt55xx devices (EXPERIMENTAL)"
185 ---help--- 185 ---help---
186 This adds support for rt55xx wireless chipset family to the 186 This adds support for rt55xx wireless chipset family to the
187 rt2800usb driver. 187 rt2800usb driver.
188 Supported chips: RT5572 188 Supported chips: RT5572
189 189
190config RT2800USB_UNKNOWN 190config RT2800USB_UNKNOWN
191 bool "rt2800usb - Include support for unknown (USB) devices" 191 bool "rt2800usb - Include support for unknown (USB) devices"
diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index fc14b37d927d..b61b073031e5 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -707,9 +707,6 @@ int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw)
707 rtwdev->h2c.last_box_num = 0; 707 rtwdev->h2c.last_box_num = 0;
708 rtwdev->h2c.seq = 0; 708 rtwdev->h2c.seq = 0;
709 709
710 rtw_fw_send_general_info(rtwdev);
711 rtw_fw_send_phydm_info(rtwdev);
712
713 rtw_flag_set(rtwdev, RTW_FLAG_FW_RUNNING); 710 rtw_flag_set(rtwdev, RTW_FLAG_FW_RUNNING);
714 711
715 return 0; 712 return 0;
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index fc8f6213fc8f..6dd457741b15 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -704,6 +704,10 @@ static int rtw_power_on(struct rtw_dev *rtwdev)
704 goto err_off; 704 goto err_off;
705 } 705 }
706 706
707 /* send H2C after HCI has started */
708 rtw_fw_send_general_info(rtwdev);
709 rtw_fw_send_phydm_info(rtwdev);
710
707 wifi_only = !rtwdev->efuse.btcoex; 711 wifi_only = !rtwdev->efuse.btcoex;
708 rtw_coex_power_on_setting(rtwdev); 712 rtw_coex_power_on_setting(rtwdev);
709 rtw_coex_init_hw_config(rtwdev, wifi_only); 713 rtw_coex_init_hw_config(rtwdev, wifi_only);
diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 3fdb52a5789a..d90928be663b 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -90,16 +90,13 @@ static inline void *rtw_pci_get_tx_desc(struct rtw_pci_tx_ring *tx_ring, u8 idx)
90 return tx_ring->r.head + offset; 90 return tx_ring->r.head + offset;
91} 91}
92 92
93static void rtw_pci_free_tx_ring(struct rtw_dev *rtwdev, 93static void rtw_pci_free_tx_ring_skbs(struct rtw_dev *rtwdev,
94 struct rtw_pci_tx_ring *tx_ring) 94 struct rtw_pci_tx_ring *tx_ring)
95{ 95{
96 struct pci_dev *pdev = to_pci_dev(rtwdev->dev); 96 struct pci_dev *pdev = to_pci_dev(rtwdev->dev);
97 struct rtw_pci_tx_data *tx_data; 97 struct rtw_pci_tx_data *tx_data;
98 struct sk_buff *skb, *tmp; 98 struct sk_buff *skb, *tmp;
99 dma_addr_t dma; 99 dma_addr_t dma;
100 u8 *head = tx_ring->r.head;
101 u32 len = tx_ring->r.len;
102 int ring_sz = len * tx_ring->r.desc_size;
103 100
104 /* free every skb remained in tx list */ 101 /* free every skb remained in tx list */
105 skb_queue_walk_safe(&tx_ring->queue, skb, tmp) { 102 skb_queue_walk_safe(&tx_ring->queue, skb, tmp) {
@@ -110,21 +107,30 @@ static void rtw_pci_free_tx_ring(struct rtw_dev *rtwdev,
110 pci_unmap_single(pdev, dma, skb->len, PCI_DMA_TODEVICE); 107 pci_unmap_single(pdev, dma, skb->len, PCI_DMA_TODEVICE);
111 dev_kfree_skb_any(skb); 108 dev_kfree_skb_any(skb);
112 } 109 }
110}
111
112static void rtw_pci_free_tx_ring(struct rtw_dev *rtwdev,
113 struct rtw_pci_tx_ring *tx_ring)
114{
115 struct pci_dev *pdev = to_pci_dev(rtwdev->dev);
116 u8 *head = tx_ring->r.head;
117 u32 len = tx_ring->r.len;
118 int ring_sz = len * tx_ring->r.desc_size;
119
120 rtw_pci_free_tx_ring_skbs(rtwdev, tx_ring);
113 121
114 /* free the ring itself */ 122 /* free the ring itself */
115 pci_free_consistent(pdev, ring_sz, head, tx_ring->r.dma); 123 pci_free_consistent(pdev, ring_sz, head, tx_ring->r.dma);
116 tx_ring->r.head = NULL; 124 tx_ring->r.head = NULL;
117} 125}
118 126
119static void rtw_pci_free_rx_ring(struct rtw_dev *rtwdev, 127static void rtw_pci_free_rx_ring_skbs(struct rtw_dev *rtwdev,
120 struct rtw_pci_rx_ring *rx_ring) 128 struct rtw_pci_rx_ring *rx_ring)
121{ 129{
122 struct pci_dev *pdev = to_pci_dev(rtwdev->dev); 130 struct pci_dev *pdev = to_pci_dev(rtwdev->dev);
123 struct sk_buff *skb; 131 struct sk_buff *skb;
124 dma_addr_t dma;
125 u8 *head = rx_ring->r.head;
126 int buf_sz = RTK_PCI_RX_BUF_SIZE; 132 int buf_sz = RTK_PCI_RX_BUF_SIZE;
127 int ring_sz = rx_ring->r.desc_size * rx_ring->r.len; 133 dma_addr_t dma;
128 int i; 134 int i;
129 135
130 for (i = 0; i < rx_ring->r.len; i++) { 136 for (i = 0; i < rx_ring->r.len; i++) {
@@ -137,6 +143,16 @@ static void rtw_pci_free_rx_ring(struct rtw_dev *rtwdev,
137 dev_kfree_skb(skb); 143 dev_kfree_skb(skb);
138 rx_ring->buf[i] = NULL; 144 rx_ring->buf[i] = NULL;
139 } 145 }
146}
147
148static void rtw_pci_free_rx_ring(struct rtw_dev *rtwdev,
149 struct rtw_pci_rx_ring *rx_ring)
150{
151 struct pci_dev *pdev = to_pci_dev(rtwdev->dev);
152 u8 *head = rx_ring->r.head;
153 int ring_sz = rx_ring->r.desc_size * rx_ring->r.len;
154
155 rtw_pci_free_rx_ring_skbs(rtwdev, rx_ring);
140 156
141 pci_free_consistent(pdev, ring_sz, head, rx_ring->r.dma); 157 pci_free_consistent(pdev, ring_sz, head, rx_ring->r.dma);
142} 158}
@@ -484,6 +500,17 @@ static void rtw_pci_dma_reset(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci)
484 rtwpci->rx_tag = 0; 500 rtwpci->rx_tag = 0;
485} 501}
486 502
503static void rtw_pci_dma_release(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci)
504{
505 struct rtw_pci_tx_ring *tx_ring;
506 u8 queue;
507
508 for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++) {
509 tx_ring = &rtwpci->tx_rings[queue];
510 rtw_pci_free_tx_ring_skbs(rtwdev, tx_ring);
511 }
512}
513
487static int rtw_pci_start(struct rtw_dev *rtwdev) 514static int rtw_pci_start(struct rtw_dev *rtwdev)
488{ 515{
489 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 516 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
@@ -505,6 +532,7 @@ static void rtw_pci_stop(struct rtw_dev *rtwdev)
505 532
506 spin_lock_irqsave(&rtwpci->irq_lock, flags); 533 spin_lock_irqsave(&rtwpci->irq_lock, flags);
507 rtw_pci_disable_interrupt(rtwdev, rtwpci); 534 rtw_pci_disable_interrupt(rtwdev, rtwpci);
535 rtw_pci_dma_release(rtwdev, rtwpci);
508 spin_unlock_irqrestore(&rtwpci->irq_lock, flags); 536 spin_unlock_irqrestore(&rtwpci->irq_lock, flags);
509} 537}
510 538
diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index 4e44ea8c652d..7b5c2fe5bd4d 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1633,7 +1633,7 @@ static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req,
1633 */ 1633 */
1634 if (rr->length < struct_size(regs, regs, count)) { 1634 if (rr->length < struct_size(regs, regs, count)) {
1635 dev_dbg_f(zd_usb_dev(usb), 1635 dev_dbg_f(zd_usb_dev(usb),
1636 "error: actual length %d less than expected %ld\n", 1636 "error: actual length %d less than expected %zu\n",
1637 rr->length, struct_size(regs, regs, count)); 1637 rr->length, struct_size(regs, regs, count));
1638 return false; 1638 return false;
1639 } 1639 }
diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 7eda62a9e0df..9642971e89ce 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -661,7 +661,7 @@ static int st95hf_error_handling(struct st95hf_context *stcontext,
661 result = -ETIMEDOUT; 661 result = -ETIMEDOUT;
662 else 662 else
663 result = -EIO; 663 result = -EIO;
664 return result; 664 return result;
665 } 665 }
666 666
667 /* Check for CRC err only if CRC is present in the tag response */ 667 /* Check for CRC err only if CRC is present in the tag response */
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 000b95787df1..bd6129db6417 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -362,7 +362,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev,
362 int ret; 362 int ret;
363 363
364 iface = of_get_phy_mode(np); 364 iface = of_get_phy_mode(np);
365 if (iface < 0) 365 if ((int)iface < 0)
366 return NULL; 366 return NULL;
367 if (of_phy_is_fixed_link(np)) { 367 if (of_phy_is_fixed_link(np)) {
368 ret = of_phy_register_fixed_link(np); 368 ret = of_phy_register_fixed_link(np);
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 9c18476d8d10..67d0199840fd 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -155,7 +155,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
155 err = -EINVAL; 155 err = -EINVAL;
156 break; 156 break;
157 } else if (cmd == PTP_EXTTS_REQUEST) { 157 } else if (cmd == PTP_EXTTS_REQUEST) {
158 req.extts.flags &= ~PTP_EXTTS_VALID_FLAGS; 158 req.extts.flags &= PTP_EXTTS_V1_VALID_FLAGS;
159 req.extts.rsv[0] = 0; 159 req.extts.rsv[0] = 0;
160 req.extts.rsv[1] = 0; 160 req.extts.rsv[1] = 0;
161 } 161 }
@@ -184,7 +184,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
184 err = -EINVAL; 184 err = -EINVAL;
185 break; 185 break;
186 } else if (cmd == PTP_PEROUT_REQUEST) { 186 } else if (cmd == PTP_PEROUT_REQUEST) {
187 req.perout.flags &= ~PTP_PEROUT_VALID_FLAGS; 187 req.perout.flags &= PTP_PEROUT_V1_VALID_FLAGS;
188 req.perout.rsv[0] = 0; 188 req.perout.rsv[0] = 0;
189 req.perout.rsv[1] = 0; 189 req.perout.rsv[1] = 0;
190 req.perout.rsv[2] = 0; 190 req.perout.rsv[2] = 0;
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index a487b681b516..138c50d5a353 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -282,7 +282,6 @@ enum {
282 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940, 282 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
283 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941, 283 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
284 MLX5_CMD_OP_QUERY_MODIFY_HEADER_CONTEXT = 0x942, 284 MLX5_CMD_OP_QUERY_MODIFY_HEADER_CONTEXT = 0x942,
285 MLX5_CMD_OP_SYNC_STEERING = 0xb00,
286 MLX5_CMD_OP_FPGA_CREATE_QP = 0x960, 285 MLX5_CMD_OP_FPGA_CREATE_QP = 0x960,
287 MLX5_CMD_OP_FPGA_MODIFY_QP = 0x961, 286 MLX5_CMD_OP_FPGA_MODIFY_QP = 0x961,
288 MLX5_CMD_OP_FPGA_QUERY_QP = 0x962, 287 MLX5_CMD_OP_FPGA_QUERY_QP = 0x962,
@@ -296,6 +295,7 @@ enum {
296 MLX5_CMD_OP_DESTROY_UCTX = 0xa06, 295 MLX5_CMD_OP_DESTROY_UCTX = 0xa06,
297 MLX5_CMD_OP_CREATE_UMEM = 0xa08, 296 MLX5_CMD_OP_CREATE_UMEM = 0xa08,
298 MLX5_CMD_OP_DESTROY_UMEM = 0xa0a, 297 MLX5_CMD_OP_DESTROY_UMEM = 0xa0a,
298 MLX5_CMD_OP_SYNC_STEERING = 0xb00,
299 MLX5_CMD_OP_MAX 299 MLX5_CMD_OP_MAX
300}; 300};
301 301
@@ -487,7 +487,7 @@ union mlx5_ifc_gre_key_bits {
487 487
488struct mlx5_ifc_fte_match_set_misc_bits { 488struct mlx5_ifc_fte_match_set_misc_bits {
489 u8 gre_c_present[0x1]; 489 u8 gre_c_present[0x1];
490 u8 reserved_auto1[0x1]; 490 u8 reserved_at_1[0x1];
491 u8 gre_k_present[0x1]; 491 u8 gre_k_present[0x1];
492 u8 gre_s_present[0x1]; 492 u8 gre_s_present[0x1];
493 u8 source_vhca_port[0x4]; 493 u8 source_vhca_port[0x4];
@@ -5054,50 +5054,50 @@ struct mlx5_ifc_query_hca_cap_in_bits {
5054 5054
5055struct mlx5_ifc_other_hca_cap_bits { 5055struct mlx5_ifc_other_hca_cap_bits {
5056 u8 roce[0x1]; 5056 u8 roce[0x1];
5057 u8 reserved_0[0x27f]; 5057 u8 reserved_at_1[0x27f];
5058}; 5058};
5059 5059
5060struct mlx5_ifc_query_other_hca_cap_out_bits { 5060struct mlx5_ifc_query_other_hca_cap_out_bits {
5061 u8 status[0x8]; 5061 u8 status[0x8];
5062 u8 reserved_0[0x18]; 5062 u8 reserved_at_8[0x18];
5063 5063
5064 u8 syndrome[0x20]; 5064 u8 syndrome[0x20];
5065 5065
5066 u8 reserved_1[0x40]; 5066 u8 reserved_at_40[0x40];
5067 5067
5068 struct mlx5_ifc_other_hca_cap_bits other_capability; 5068 struct mlx5_ifc_other_hca_cap_bits other_capability;
5069}; 5069};
5070 5070
5071struct mlx5_ifc_query_other_hca_cap_in_bits { 5071struct mlx5_ifc_query_other_hca_cap_in_bits {
5072 u8 opcode[0x10]; 5072 u8 opcode[0x10];
5073 u8 reserved_0[0x10]; 5073 u8 reserved_at_10[0x10];
5074 5074
5075 u8 reserved_1[0x10]; 5075 u8 reserved_at_20[0x10];
5076 u8 op_mod[0x10]; 5076 u8 op_mod[0x10];
5077 5077
5078 u8 reserved_2[0x10]; 5078 u8 reserved_at_40[0x10];
5079 u8 function_id[0x10]; 5079 u8 function_id[0x10];
5080 5080
5081 u8 reserved_3[0x20]; 5081 u8 reserved_at_60[0x20];
5082}; 5082};
5083 5083
5084struct mlx5_ifc_modify_other_hca_cap_out_bits { 5084struct mlx5_ifc_modify_other_hca_cap_out_bits {
5085 u8 status[0x8]; 5085 u8 status[0x8];
5086 u8 reserved_0[0x18]; 5086 u8 reserved_at_8[0x18];
5087 5087
5088 u8 syndrome[0x20]; 5088 u8 syndrome[0x20];
5089 5089
5090 u8 reserved_1[0x40]; 5090 u8 reserved_at_40[0x40];
5091}; 5091};
5092 5092
5093struct mlx5_ifc_modify_other_hca_cap_in_bits { 5093struct mlx5_ifc_modify_other_hca_cap_in_bits {
5094 u8 opcode[0x10]; 5094 u8 opcode[0x10];
5095 u8 reserved_0[0x10]; 5095 u8 reserved_at_10[0x10];
5096 5096
5097 u8 reserved_1[0x10]; 5097 u8 reserved_at_20[0x10];
5098 u8 op_mod[0x10]; 5098 u8 op_mod[0x10];
5099 5099
5100 u8 reserved_2[0x10]; 5100 u8 reserved_at_40[0x10];
5101 u8 function_id[0x10]; 5101 u8 function_id[0x10];
5102 u8 field_select[0x20]; 5102 u8 field_select[0x20];
5103 5103
diff --git a/include/linux/platform_data/eth-netx.h b/include/linux/platform_data/eth-netx.h
deleted file mode 100644
index a3a6322668d8..000000000000
--- a/include/linux/platform_data/eth-netx.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
4 */
5
6#ifndef __ETH_NETX_H
7#define __ETH_NETX_H
8
9struct netxeth_platform_data {
10 unsigned int xcno; /* number of xmac/xpec engine this eth uses */
11};
12
13#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 907209c0794e..e7d3b1a513ef 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4144,8 +4144,17 @@ static inline void *skb_ext_find(const struct sk_buff *skb, enum skb_ext_id id)
4144 4144
4145 return NULL; 4145 return NULL;
4146} 4146}
4147
4148static inline void skb_ext_reset(struct sk_buff *skb)
4149{
4150 if (unlikely(skb->active_extensions)) {
4151 __skb_ext_put(skb->extensions);
4152 skb->active_extensions = 0;
4153 }
4154}
4147#else 4155#else
4148static inline void skb_ext_put(struct sk_buff *skb) {} 4156static inline void skb_ext_put(struct sk_buff *skb) {}
4157static inline void skb_ext_reset(struct sk_buff *skb) {}
4149static inline void skb_ext_del(struct sk_buff *skb, int unused) {} 4158static inline void skb_ext_del(struct sk_buff *skb, int unused) {}
4150static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} 4159static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {}
4151static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} 4160static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index aef38c140014..dfd919b3119e 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -71,6 +71,7 @@ struct inet_timewait_sock {
71 tw_pad : 2, /* 2 bits hole */ 71 tw_pad : 2, /* 2 bits hole */
72 tw_tos : 8; 72 tw_tos : 8;
73 u32 tw_txhash; 73 u32 tw_txhash;
74 u32 tw_priority;
74 struct timer_list tw_timer; 75 struct timer_list tw_timer;
75 struct inet_bind_bucket *tw_tb; 76 struct inet_bind_bucket *tw_tb;
76}; 77};
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8dfc65639aa4..009605c56f20 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -981,7 +981,7 @@ int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
981 * upper-layer output functions 981 * upper-layer output functions
982 */ 982 */
983int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, 983int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
984 __u32 mark, struct ipv6_txoptions *opt, int tclass); 984 __u32 mark, struct ipv6_txoptions *opt, int tclass, u32 priority);
985 985
986int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 986int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
987 987
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 2655e03dbe1b..001d294edf57 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -889,6 +889,8 @@ enum nft_chain_flags {
889 NFT_CHAIN_HW_OFFLOAD = 0x2, 889 NFT_CHAIN_HW_OFFLOAD = 0x2,
890}; 890};
891 891
892#define NFT_CHAIN_POLICY_UNSET U8_MAX
893
892/** 894/**
893 * struct nft_chain - nf_tables chain 895 * struct nft_chain - nf_tables chain
894 * 896 *
@@ -1181,6 +1183,10 @@ struct nft_flowtable *nft_flowtable_lookup(const struct nft_table *table,
1181 const struct nlattr *nla, 1183 const struct nlattr *nla,
1182 u8 genmask); 1184 u8 genmask);
1183 1185
1186void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx,
1187 struct nft_flowtable *flowtable,
1188 enum nft_trans_phase phase);
1189
1184void nft_register_flowtable_type(struct nf_flowtable_type *type); 1190void nft_register_flowtable_type(struct nf_flowtable_type *type);
1185void nft_unregister_flowtable_type(struct nf_flowtable_type *type); 1191void nft_unregister_flowtable_type(struct nf_flowtable_type *type);
1186 1192
diff --git a/include/net/route.h b/include/net/route.h
index dfce19c9fa96..6c516840380d 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -53,10 +53,11 @@ struct rtable {
53 unsigned int rt_flags; 53 unsigned int rt_flags;
54 __u16 rt_type; 54 __u16 rt_type;
55 __u8 rt_is_input; 55 __u8 rt_is_input;
56 u8 rt_gw_family; 56 __u8 rt_uses_gateway;
57 57
58 int rt_iif; 58 int rt_iif;
59 59
60 u8 rt_gw_family;
60 /* Info on neighbour */ 61 /* Info on neighbour */
61 union { 62 union {
62 __be32 rt_gw4; 63 __be32 rt_gw4;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 43f5b7ed02bd..637548d54b3e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -494,6 +494,11 @@ static inline struct Qdisc *qdisc_root(const struct Qdisc *qdisc)
494 return q; 494 return q;
495} 495}
496 496
497static inline struct Qdisc *qdisc_root_bh(const struct Qdisc *qdisc)
498{
499 return rcu_dereference_bh(qdisc->dev_queue->qdisc);
500}
501
497static inline struct Qdisc *qdisc_root_sleeping(const struct Qdisc *qdisc) 502static inline struct Qdisc *qdisc_root_sleeping(const struct Qdisc *qdisc)
498{ 503{
499 return qdisc->dev_queue->qdisc_sleeping; 504 return qdisc->dev_queue->qdisc_sleeping;
diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h
index 63ae4a39e58b..c02dec97e1ce 100644
--- a/include/uapi/linux/btf.h
+++ b/include/uapi/linux/btf.h
@@ -22,9 +22,9 @@ struct btf_header {
22}; 22};
23 23
24/* Max # of type identifier */ 24/* Max # of type identifier */
25#define BTF_MAX_TYPE 0x0000ffff 25#define BTF_MAX_TYPE 0x000fffff
26/* Max offset into the string section */ 26/* Max offset into the string section */
27#define BTF_MAX_NAME_OFFSET 0x0000ffff 27#define BTF_MAX_NAME_OFFSET 0x00ffffff
28/* Max # of struct/union/enum members or func args */ 28/* Max # of struct/union/enum members or func args */
29#define BTF_MAX_VLEN 0xffff 29#define BTF_MAX_VLEN 0xffff
30 30
diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h
index 3b86c14ea49d..8076c940ffeb 100644
--- a/include/uapi/linux/netfilter_bridge/ebtables.h
+++ b/include/uapi/linux/netfilter_bridge/ebtables.h
@@ -123,7 +123,7 @@ struct ebt_entry_match {
123 union { 123 union {
124 struct { 124 struct {
125 char name[EBT_EXTENSION_MAXNAMELEN]; 125 char name[EBT_EXTENSION_MAXNAMELEN];
126 uint8_t revision; 126 __u8 revision;
127 }; 127 };
128 struct xt_match *match; 128 struct xt_match *match;
129 } u; 129 } u;
@@ -136,7 +136,7 @@ struct ebt_entry_watcher {
136 union { 136 union {
137 struct { 137 struct {
138 char name[EBT_EXTENSION_MAXNAMELEN]; 138 char name[EBT_EXTENSION_MAXNAMELEN];
139 uint8_t revision; 139 __u8 revision;
140 }; 140 };
141 struct xt_target *watcher; 141 struct xt_target *watcher;
142 } u; 142 } u;
@@ -149,7 +149,7 @@ struct ebt_entry_target {
149 union { 149 union {
150 struct { 150 struct {
151 char name[EBT_EXTENSION_MAXNAMELEN]; 151 char name[EBT_EXTENSION_MAXNAMELEN];
152 uint8_t revision; 152 __u8 revision;
153 }; 153 };
154 struct xt_target *target; 154 struct xt_target *target;
155 } u; 155 } u;
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index f16301015949..59e89a1bc3bb 100644
--- a/include/uapi/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
@@ -31,15 +31,37 @@
31#define PTP_ENABLE_FEATURE (1<<0) 31#define PTP_ENABLE_FEATURE (1<<0)
32#define PTP_RISING_EDGE (1<<1) 32#define PTP_RISING_EDGE (1<<1)
33#define PTP_FALLING_EDGE (1<<2) 33#define PTP_FALLING_EDGE (1<<2)
34
35/*
36 * flag fields valid for the new PTP_EXTTS_REQUEST2 ioctl.
37 */
34#define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | \ 38#define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | \
35 PTP_RISING_EDGE | \ 39 PTP_RISING_EDGE | \
36 PTP_FALLING_EDGE) 40 PTP_FALLING_EDGE)
37 41
38/* 42/*
43 * flag fields valid for the original PTP_EXTTS_REQUEST ioctl.
44 * DO NOT ADD NEW FLAGS HERE.
45 */
46#define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | \
47 PTP_RISING_EDGE | \
48 PTP_FALLING_EDGE)
49
50/*
39 * Bits of the ptp_perout_request.flags field: 51 * Bits of the ptp_perout_request.flags field:
40 */ 52 */
41#define PTP_PEROUT_ONE_SHOT (1<<0) 53#define PTP_PEROUT_ONE_SHOT (1<<0)
54
55/*
56 * flag fields valid for the new PTP_PEROUT_REQUEST2 ioctl.
57 */
42#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT) 58#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT)
59
60/*
61 * No flags are valid for the original PTP_PEROUT_REQUEST ioctl
62 */
63#define PTP_PEROUT_V1_VALID_FLAGS (0)
64
43/* 65/*
44 * struct ptp_clock_time - represents a time value 66 * struct ptp_clock_time - represents a time value
45 * 67 *
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index adb3adcebe3c..29c7c06c6bd6 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -2332,7 +2332,7 @@ static int btf_enum_check_kflag_member(struct btf_verifier_env *env,
2332 if (BITS_PER_BYTE_MASKED(struct_bits_off)) { 2332 if (BITS_PER_BYTE_MASKED(struct_bits_off)) {
2333 btf_verifier_log_member(env, struct_type, member, 2333 btf_verifier_log_member(env, struct_type, member,
2334 "Member is not byte aligned"); 2334 "Member is not byte aligned");
2335 return -EINVAL; 2335 return -EINVAL;
2336 } 2336 }
2337 2337
2338 nr_bits = int_bitsize; 2338 nr_bits = int_bitsize;
@@ -2377,9 +2377,8 @@ static s32 btf_enum_check_meta(struct btf_verifier_env *env,
2377 return -EINVAL; 2377 return -EINVAL;
2378 } 2378 }
2379 2379
2380 if (t->size != sizeof(int)) { 2380 if (t->size > 8 || !is_power_of_2(t->size)) {
2381 btf_verifier_log_type(env, t, "Expected size:%zu", 2381 btf_verifier_log_type(env, t, "Unexpected size");
2382 sizeof(int));
2383 return -EINVAL; 2382 return -EINVAL;
2384 } 2383 }
2385 2384
diff --git a/kernel/bpf/xskmap.c b/kernel/bpf/xskmap.c
index 942c662e2eed..82a1ffe15dfa 100644
--- a/kernel/bpf/xskmap.c
+++ b/kernel/bpf/xskmap.c
@@ -37,7 +37,7 @@ static struct xsk_map_node *xsk_map_node_alloc(struct xsk_map *map,
37 37
38 node = kzalloc(sizeof(*node), GFP_ATOMIC | __GFP_NOWARN); 38 node = kzalloc(sizeof(*node), GFP_ATOMIC | __GFP_NOWARN);
39 if (!node) 39 if (!node)
40 return NULL; 40 return ERR_PTR(-ENOMEM);
41 41
42 err = xsk_map_inc(map); 42 err = xsk_map_inc(map);
43 if (err) { 43 if (err) {
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 492a8bfaae98..44bd08f2443b 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -505,14 +505,17 @@ static const struct bpf_func_proto bpf_perf_event_output_proto = {
505 .arg5_type = ARG_CONST_SIZE_OR_ZERO, 505 .arg5_type = ARG_CONST_SIZE_OR_ZERO,
506}; 506};
507 507
508static DEFINE_PER_CPU(struct pt_regs, bpf_pt_regs); 508static DEFINE_PER_CPU(int, bpf_event_output_nest_level);
509static DEFINE_PER_CPU(struct perf_sample_data, bpf_misc_sd); 509struct bpf_nested_pt_regs {
510 struct pt_regs regs[3];
511};
512static DEFINE_PER_CPU(struct bpf_nested_pt_regs, bpf_pt_regs);
513static DEFINE_PER_CPU(struct bpf_trace_sample_data, bpf_misc_sds);
510 514
511u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, 515u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
512 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy) 516 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy)
513{ 517{
514 struct perf_sample_data *sd = this_cpu_ptr(&bpf_misc_sd); 518 int nest_level = this_cpu_inc_return(bpf_event_output_nest_level);
515 struct pt_regs *regs = this_cpu_ptr(&bpf_pt_regs);
516 struct perf_raw_frag frag = { 519 struct perf_raw_frag frag = {
517 .copy = ctx_copy, 520 .copy = ctx_copy,
518 .size = ctx_size, 521 .size = ctx_size,
@@ -527,12 +530,25 @@ u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
527 .data = meta, 530 .data = meta,
528 }, 531 },
529 }; 532 };
533 struct perf_sample_data *sd;
534 struct pt_regs *regs;
535 u64 ret;
536
537 if (WARN_ON_ONCE(nest_level > ARRAY_SIZE(bpf_misc_sds.sds))) {
538 ret = -EBUSY;
539 goto out;
540 }
541 sd = this_cpu_ptr(&bpf_misc_sds.sds[nest_level - 1]);
542 regs = this_cpu_ptr(&bpf_pt_regs.regs[nest_level - 1]);
530 543
531 perf_fetch_caller_regs(regs); 544 perf_fetch_caller_regs(regs);
532 perf_sample_data_init(sd, 0, 0); 545 perf_sample_data_init(sd, 0, 0);
533 sd->raw = &raw; 546 sd->raw = &raw;
534 547
535 return __bpf_perf_event_output(regs, map, flags, sd); 548 ret = __bpf_perf_event_output(regs, map, flags, sd);
549out:
550 this_cpu_dec(bpf_event_output_nest_level);
551 return ret;
536} 552}
537 553
538BPF_CALL_0(bpf_get_current_task) 554BPF_CALL_0(bpf_get_current_task)
diff --git a/lib/Kconfig b/lib/Kconfig
index 4e6b1c3e4c98..183f92a297ca 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -555,11 +555,10 @@ config SIGNATURE
555 Implementation is done using GnuPG MPI library 555 Implementation is done using GnuPG MPI library
556 556
557config DIMLIB 557config DIMLIB
558 bool "DIM library" 558 bool
559 default y
560 help 559 help
561 Dynamic Interrupt Moderation library. 560 Dynamic Interrupt Moderation library.
562 Implements an algorithm for dynamically change CQ modertion values 561 Implements an algorithm for dynamically changing CQ moderation values
563 according to run time performance. 562 according to run time performance.
564 563
565# 564#
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 4072e9d394d6..b41375d4d295 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1023,6 +1023,11 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
1023 */ 1023 */
1024 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) 1024 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
1025 goto out; 1025 goto out;
1026
1027 rc = -EPERM;
1028 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
1029 goto out;
1030
1026 rc = -ENOMEM; 1031 rc = -ENOMEM;
1027 sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern); 1032 sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern);
1028 if (!sk) 1033 if (!sk)
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index ca5207767dc2..bb222b882b67 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -855,6 +855,8 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
855 break; 855 break;
856 856
857 case SOCK_RAW: 857 case SOCK_RAW:
858 if (!capable(CAP_NET_RAW))
859 return -EPERM;
858 break; 860 break;
859 default: 861 default:
860 return -ESOCKTNOSUPPORT; 862 return -ESOCKTNOSUPPORT;
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index a3d188dfbe75..d5028af750d5 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -12,11 +12,11 @@ config BATMAN_ADV
12 depends on NET 12 depends on NET
13 select LIBCRC32C 13 select LIBCRC32C
14 help 14 help
15 B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is 15 B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
16 a routing protocol for multi-hop ad-hoc mesh networks. The 16 a routing protocol for multi-hop ad-hoc mesh networks. The
17 networks may be wired or wireless. See 17 networks may be wired or wireless. See
18 https://www.open-mesh.org/ for more information and user space 18 https://www.open-mesh.org/ for more information and user space
19 tools. 19 tools.
20 20
21config BATMAN_ADV_BATMAN_V 21config BATMAN_ADV_BATMAN_V
22 bool "B.A.T.M.A.N. V protocol" 22 bool "B.A.T.M.A.N. V protocol"
diff --git a/net/core/dev.c b/net/core/dev.c
index 71b18e80389f..bf3ed413abaf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5666,7 +5666,7 @@ EXPORT_SYMBOL(gro_find_complete_by_type);
5666static void napi_skb_free_stolen_head(struct sk_buff *skb) 5666static void napi_skb_free_stolen_head(struct sk_buff *skb)
5667{ 5667{
5668 skb_dst_drop(skb); 5668 skb_dst_drop(skb);
5669 secpath_reset(skb); 5669 skb_ext_put(skb);
5670 kmem_cache_free(skbuff_head_cache, skb); 5670 kmem_cache_free(skbuff_head_cache, skb);
5671} 5671}
5672 5672
@@ -5733,7 +5733,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
5733 skb->encapsulation = 0; 5733 skb->encapsulation = 0;
5734 skb_shinfo(skb)->gso_type = 0; 5734 skb_shinfo(skb)->gso_type = 0;
5735 skb->truesize = SKB_TRUESIZE(skb_end_offset(skb)); 5735 skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
5736 secpath_reset(skb); 5736 skb_ext_reset(skb);
5737 5737
5738 napi->skb = skb; 5738 napi->skb = skb;
5739} 5739}
diff --git a/net/core/dst.c b/net/core/dst.c
index 1325316d9eab..193af526e908 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -172,7 +172,7 @@ void dst_release(struct dst_entry *dst)
172 int newrefcnt; 172 int newrefcnt;
173 173
174 newrefcnt = atomic_dec_return(&dst->__refcnt); 174 newrefcnt = atomic_dec_return(&dst->__refcnt);
175 if (unlikely(newrefcnt < 0)) 175 if (WARN_ONCE(newrefcnt < 0, "dst_release underflow"))
176 net_warn_ratelimited("%s: dst:%p refcnt:%d\n", 176 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
177 __func__, dst, newrefcnt); 177 __func__, dst, newrefcnt);
178 if (!newrefcnt) 178 if (!newrefcnt)
@@ -187,7 +187,7 @@ void dst_release_immediate(struct dst_entry *dst)
187 int newrefcnt; 187 int newrefcnt;
188 188
189 newrefcnt = atomic_dec_return(&dst->__refcnt); 189 newrefcnt = atomic_dec_return(&dst->__refcnt);
190 if (unlikely(newrefcnt < 0)) 190 if (WARN_ONCE(newrefcnt < 0, "dst_release_immediate underflow"))
191 net_warn_ratelimited("%s: dst:%p refcnt:%d\n", 191 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
192 __func__, dst, newrefcnt); 192 __func__, dst, newrefcnt);
193 if (!newrefcnt) 193 if (!newrefcnt)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f12e8a050edb..01d65206f4fb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5119,7 +5119,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
5119 skb->skb_iif = 0; 5119 skb->skb_iif = 0;
5120 skb->ignore_df = 0; 5120 skb->ignore_df = 0;
5121 skb_dst_drop(skb); 5121 skb_dst_drop(skb);
5122 secpath_reset(skb); 5122 skb_ext_reset(skb);
5123 nf_reset(skb); 5123 nf_reset(skb);
5124 nf_reset_trace(skb); 5124 nf_reset_trace(skb);
5125 5125
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 1b7381ff787b..25aab672fc99 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -230,7 +230,8 @@ static int dccp_v6_send_response(const struct sock *sk, struct request_sock *req
230 opt = ireq->ipv6_opt; 230 opt = ireq->ipv6_opt;
231 if (!opt) 231 if (!opt)
232 opt = rcu_dereference(np->opt); 232 opt = rcu_dereference(np->opt);
233 err = ip6_xmit(sk, skb, &fl6, sk->sk_mark, opt, np->tclass); 233 err = ip6_xmit(sk, skb, &fl6, sk->sk_mark, opt, np->tclass,
234 sk->sk_priority);
234 rcu_read_unlock(); 235 rcu_read_unlock();
235 err = net_xmit_eval(err); 236 err = net_xmit_eval(err);
236 } 237 }
@@ -284,7 +285,7 @@ static void dccp_v6_ctl_send_reset(const struct sock *sk, struct sk_buff *rxskb)
284 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL); 285 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL);
285 if (!IS_ERR(dst)) { 286 if (!IS_ERR(dst)) {
286 skb_dst_set(skb, dst); 287 skb_dst_set(skb, dst);
287 ip6_xmit(ctl_sk, skb, &fl6, 0, NULL, 0); 288 ip6_xmit(ctl_sk, skb, &fl6, 0, NULL, 0, 0);
288 DCCP_INC_STATS(DCCP_MIB_OUTSEGS); 289 DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
289 DCCP_INC_STATS(DCCP_MIB_OUTRSTS); 290 DCCP_INC_STATS(DCCP_MIB_OUTRSTS);
290 return; 291 return;
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index badc5cfe4dc6..d93d4531aa9b 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -1008,6 +1008,9 @@ static int ieee802154_create(struct net *net, struct socket *sock,
1008 1008
1009 switch (sock->type) { 1009 switch (sock->type) {
1010 case SOCK_RAW: 1010 case SOCK_RAW:
1011 rc = -EPERM;
1012 if (!capable(CAP_NET_RAW))
1013 goto out;
1011 proto = &ieee802154_raw_prot; 1014 proto = &ieee802154_raw_prot;
1012 ops = &ieee802154_raw_ops; 1015 ops = &ieee802154_raw_ops;
1013 break; 1016 break;
diff --git a/net/ife/Kconfig b/net/ife/Kconfig
index 6cd1f6d18f30..bcf650564db4 100644
--- a/net/ife/Kconfig
+++ b/net/ife/Kconfig
@@ -5,7 +5,7 @@
5 5
6menuconfig NET_IFE 6menuconfig NET_IFE
7 depends on NET 7 depends on NET
8 tristate "Inter-FE based on IETF ForCES InterFE LFB" 8 tristate "Inter-FE based on IETF ForCES InterFE LFB"
9 default n 9 default n
10 help 10 help
11 Say Y here to add support of IFE encapsulation protocol 11 Say Y here to add support of IFE encapsulation protocol
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 974de4d20f25..03381f3e12ba 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -492,8 +492,8 @@ config TCP_CONG_WESTWOOD
492 wired networks and throughput over wireless links. 492 wired networks and throughput over wireless links.
493 493
494config TCP_CONG_HTCP 494config TCP_CONG_HTCP
495 tristate "H-TCP" 495 tristate "H-TCP"
496 default m 496 default m
497 ---help--- 497 ---help---
498 H-TCP is a send-side only modifications of the TCP Reno 498 H-TCP is a send-side only modifications of the TCP Reno
499 protocol stack that optimizes the performance of TCP 499 protocol stack that optimizes the performance of TCP
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index f5c163d4771b..a9183543ca30 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -560,7 +560,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk,
560 rt = ip_route_output_flow(net, fl4, sk); 560 rt = ip_route_output_flow(net, fl4, sk);
561 if (IS_ERR(rt)) 561 if (IS_ERR(rt))
562 goto no_route; 562 goto no_route;
563 if (opt && opt->opt.is_strictroute && rt->rt_gw_family) 563 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
564 goto route_err; 564 goto route_err;
565 rcu_read_unlock(); 565 rcu_read_unlock();
566 return &rt->dst; 566 return &rt->dst;
@@ -598,7 +598,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
598 rt = ip_route_output_flow(net, fl4, sk); 598 rt = ip_route_output_flow(net, fl4, sk);
599 if (IS_ERR(rt)) 599 if (IS_ERR(rt))
600 goto no_route; 600 goto no_route;
601 if (opt && opt->opt.is_strictroute && rt->rt_gw_family) 601 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
602 goto route_err; 602 goto route_err;
603 return &rt->dst; 603 return &rt->dst;
604 604
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 06f6f280b9ff..00ec819f949b 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -123,7 +123,7 @@ int ip_forward(struct sk_buff *skb)
123 123
124 rt = skb_rtable(skb); 124 rt = skb_rtable(skb);
125 125
126 if (opt->is_strictroute && rt->rt_gw_family) 126 if (opt->is_strictroute && rt->rt_uses_gateway)
127 goto sr_failed; 127 goto sr_failed;
128 128
129 IPCB(skb)->flags |= IPSKB_FORWARDED; 129 IPCB(skb)->flags |= IPSKB_FORWARDED;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 5eb73775c3f7..28fca408812c 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -499,7 +499,7 @@ int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
499 skb_dst_set_noref(skb, &rt->dst); 499 skb_dst_set_noref(skb, &rt->dst);
500 500
501packet_routed: 501packet_routed:
502 if (inet_opt && inet_opt->opt.is_strictroute && rt->rt_gw_family) 502 if (inet_opt && inet_opt->opt.is_strictroute && rt->rt_uses_gateway)
503 goto no_route; 503 goto no_route;
504 504
505 /* OK, we know where to send it, allocate and build IP header. */ 505 /* OK, we know where to send it, allocate and build IP header. */
@@ -1694,7 +1694,6 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
1694 1694
1695 inet_sk(sk)->tos = arg->tos; 1695 inet_sk(sk)->tos = arg->tos;
1696 1696
1697 sk->sk_priority = skb->priority;
1698 sk->sk_protocol = ip_hdr(skb)->protocol; 1697 sk->sk_protocol = ip_hdr(skb)->protocol;
1699 sk->sk_bound_dev_if = arg->bound_dev_if; 1698 sk->sk_bound_dev_if = arg->bound_dev_if;
1700 sk->sk_sndbuf = sysctl_wmem_default; 1699 sk->sk_sndbuf = sysctl_wmem_default;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index b6a6f18c3dd1..7dcce724c78b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -635,6 +635,7 @@ static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnh
635 635
636 if (fnhe->fnhe_gw) { 636 if (fnhe->fnhe_gw) {
637 rt->rt_flags |= RTCF_REDIRECTED; 637 rt->rt_flags |= RTCF_REDIRECTED;
638 rt->rt_uses_gateway = 1;
638 rt->rt_gw_family = AF_INET; 639 rt->rt_gw_family = AF_INET;
639 rt->rt_gw4 = fnhe->fnhe_gw; 640 rt->rt_gw4 = fnhe->fnhe_gw;
640 } 641 }
@@ -1313,7 +1314,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
1313 mtu = READ_ONCE(dst->dev->mtu); 1314 mtu = READ_ONCE(dst->dev->mtu);
1314 1315
1315 if (unlikely(ip_mtu_locked(dst))) { 1316 if (unlikely(ip_mtu_locked(dst))) {
1316 if (rt->rt_gw_family && mtu > 576) 1317 if (rt->rt_uses_gateway && mtu > 576)
1317 mtu = 576; 1318 mtu = 576;
1318 } 1319 }
1319 1320
@@ -1569,6 +1570,7 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
1569 struct fib_nh_common *nhc = FIB_RES_NHC(*res); 1570 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
1570 1571
1571 if (nhc->nhc_gw_family && nhc->nhc_scope == RT_SCOPE_LINK) { 1572 if (nhc->nhc_gw_family && nhc->nhc_scope == RT_SCOPE_LINK) {
1573 rt->rt_uses_gateway = 1;
1572 rt->rt_gw_family = nhc->nhc_gw_family; 1574 rt->rt_gw_family = nhc->nhc_gw_family;
1573 /* only INET and INET6 are supported */ 1575 /* only INET and INET6 are supported */
1574 if (likely(nhc->nhc_gw_family == AF_INET)) 1576 if (likely(nhc->nhc_gw_family == AF_INET))
@@ -1634,6 +1636,7 @@ struct rtable *rt_dst_alloc(struct net_device *dev,
1634 rt->rt_iif = 0; 1636 rt->rt_iif = 0;
1635 rt->rt_pmtu = 0; 1637 rt->rt_pmtu = 0;
1636 rt->rt_mtu_locked = 0; 1638 rt->rt_mtu_locked = 0;
1639 rt->rt_uses_gateway = 0;
1637 rt->rt_gw_family = 0; 1640 rt->rt_gw_family = 0;
1638 rt->rt_gw4 = 0; 1641 rt->rt_gw4 = 0;
1639 INIT_LIST_HEAD(&rt->rt_uncached); 1642 INIT_LIST_HEAD(&rt->rt_uncached);
@@ -2694,6 +2697,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
2694 rt->rt_genid = rt_genid_ipv4(net); 2697 rt->rt_genid = rt_genid_ipv4(net);
2695 rt->rt_flags = ort->rt_flags; 2698 rt->rt_flags = ort->rt_flags;
2696 rt->rt_type = ort->rt_type; 2699 rt->rt_type = ort->rt_type;
2700 rt->rt_uses_gateway = ort->rt_uses_gateway;
2697 rt->rt_gw_family = ort->rt_gw_family; 2701 rt->rt_gw_family = ort->rt_gw_family;
2698 if (rt->rt_gw_family == AF_INET) 2702 if (rt->rt_gw_family == AF_INET)
2699 rt->rt_gw4 = ort->rt_gw4; 2703 rt->rt_gw4 = ort->rt_gw4;
@@ -2778,21 +2782,23 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
2778 if (nla_put_in_addr(skb, RTA_PREFSRC, fl4->saddr)) 2782 if (nla_put_in_addr(skb, RTA_PREFSRC, fl4->saddr))
2779 goto nla_put_failure; 2783 goto nla_put_failure;
2780 } 2784 }
2781 if (rt->rt_gw_family == AF_INET && 2785 if (rt->rt_uses_gateway) {
2782 nla_put_in_addr(skb, RTA_GATEWAY, rt->rt_gw4)) { 2786 if (rt->rt_gw_family == AF_INET &&
2783 goto nla_put_failure; 2787 nla_put_in_addr(skb, RTA_GATEWAY, rt->rt_gw4)) {
2784 } else if (rt->rt_gw_family == AF_INET6) {
2785 int alen = sizeof(struct in6_addr);
2786 struct nlattr *nla;
2787 struct rtvia *via;
2788
2789 nla = nla_reserve(skb, RTA_VIA, alen + 2);
2790 if (!nla)
2791 goto nla_put_failure; 2788 goto nla_put_failure;
2792 2789 } else if (rt->rt_gw_family == AF_INET6) {
2793 via = nla_data(nla); 2790 int alen = sizeof(struct in6_addr);
2794 via->rtvia_family = AF_INET6; 2791 struct nlattr *nla;
2795 memcpy(via->rtvia_addr, &rt->rt_gw6, alen); 2792 struct rtvia *via;
2793
2794 nla = nla_reserve(skb, RTA_VIA, alen + 2);
2795 if (!nla)
2796 goto nla_put_failure;
2797
2798 via = nla_data(nla);
2799 via->rtvia_family = AF_INET6;
2800 memcpy(via->rtvia_addr, &rt->rt_gw6, alen);
2801 }
2796 } 2802 }
2797 2803
2798 expires = rt->dst.expires; 2804 expires = rt->dst.expires;
diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
index 95b59540eee1..32772d6ded4e 100644
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -388,7 +388,7 @@ static u32 bbr_bdp(struct sock *sk, u32 bw, int gain)
388 * which allows 2 outstanding 2-packet sequences, to try to keep pipe 388 * which allows 2 outstanding 2-packet sequences, to try to keep pipe
389 * full even with ACK-every-other-packet delayed ACKs. 389 * full even with ACK-every-other-packet delayed ACKs.
390 */ 390 */
391static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd, int gain) 391static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd)
392{ 392{
393 struct bbr *bbr = inet_csk_ca(sk); 393 struct bbr *bbr = inet_csk_ca(sk);
394 394
@@ -399,7 +399,7 @@ static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd, int gain)
399 cwnd = (cwnd + 1) & ~1U; 399 cwnd = (cwnd + 1) & ~1U;
400 400
401 /* Ensure gain cycling gets inflight above BDP even for small BDPs. */ 401 /* Ensure gain cycling gets inflight above BDP even for small BDPs. */
402 if (bbr->mode == BBR_PROBE_BW && gain > BBR_UNIT) 402 if (bbr->mode == BBR_PROBE_BW && bbr->cycle_idx == 0)
403 cwnd += 2; 403 cwnd += 2;
404 404
405 return cwnd; 405 return cwnd;
@@ -411,7 +411,7 @@ static u32 bbr_inflight(struct sock *sk, u32 bw, int gain)
411 u32 inflight; 411 u32 inflight;
412 412
413 inflight = bbr_bdp(sk, bw, gain); 413 inflight = bbr_bdp(sk, bw, gain);
414 inflight = bbr_quantization_budget(sk, inflight, gain); 414 inflight = bbr_quantization_budget(sk, inflight);
415 415
416 return inflight; 416 return inflight;
417} 417}
@@ -531,7 +531,7 @@ static void bbr_set_cwnd(struct sock *sk, const struct rate_sample *rs,
531 * due to aggregation (of data and/or ACKs) visible in the ACK stream. 531 * due to aggregation (of data and/or ACKs) visible in the ACK stream.
532 */ 532 */
533 target_cwnd += bbr_ack_aggregation_cwnd(sk); 533 target_cwnd += bbr_ack_aggregation_cwnd(sk);
534 target_cwnd = bbr_quantization_budget(sk, target_cwnd, gain); 534 target_cwnd = bbr_quantization_budget(sk, target_cwnd);
535 535
536 /* If we're below target cwnd, slow start cwnd toward target cwnd. */ 536 /* If we're below target cwnd, slow start cwnd toward target cwnd. */
537 if (bbr_full_bw_reached(sk)) /* only cut cwnd if we filled the pipe */ 537 if (bbr_full_bw_reached(sk)) /* only cut cwnd if we filled the pipe */
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fd394ad179a0..2ee45e3755e9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -771,6 +771,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
771 if (sk) { 771 if (sk) {
772 ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ? 772 ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
773 inet_twsk(sk)->tw_mark : sk->sk_mark; 773 inet_twsk(sk)->tw_mark : sk->sk_mark;
774 ctl_sk->sk_priority = (sk->sk_state == TCP_TIME_WAIT) ?
775 inet_twsk(sk)->tw_priority : sk->sk_priority;
774 transmit_time = tcp_transmit_time(sk); 776 transmit_time = tcp_transmit_time(sk);
775 } 777 }
776 ip_send_unicast_reply(ctl_sk, 778 ip_send_unicast_reply(ctl_sk,
@@ -866,6 +868,8 @@ static void tcp_v4_send_ack(const struct sock *sk,
866 ctl_sk = this_cpu_read(*net->ipv4.tcp_sk); 868 ctl_sk = this_cpu_read(*net->ipv4.tcp_sk);
867 ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ? 869 ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
868 inet_twsk(sk)->tw_mark : sk->sk_mark; 870 inet_twsk(sk)->tw_mark : sk->sk_mark;
871 ctl_sk->sk_priority = (sk->sk_state == TCP_TIME_WAIT) ?
872 inet_twsk(sk)->tw_priority : sk->sk_priority;
869 transmit_time = tcp_transmit_time(sk); 873 transmit_time = tcp_transmit_time(sk);
870 ip_send_unicast_reply(ctl_sk, 874 ip_send_unicast_reply(ctl_sk,
871 skb, &TCP_SKB_CB(skb)->header.h4.opt, 875 skb, &TCP_SKB_CB(skb)->header.h4.opt,
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 8bcaf2586b68..bb140a5db8c0 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -266,6 +266,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
266 266
267 tw->tw_transparent = inet->transparent; 267 tw->tw_transparent = inet->transparent;
268 tw->tw_mark = sk->sk_mark; 268 tw->tw_mark = sk->sk_mark;
269 tw->tw_priority = sk->sk_priority;
269 tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale; 270 tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale;
270 tcptw->tw_rcv_nxt = tp->rcv_nxt; 271 tcptw->tw_rcv_nxt = tp->rcv_nxt;
271 tcptw->tw_snd_nxt = tp->snd_nxt; 272 tcptw->tw_snd_nxt = tp->snd_nxt;
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index dbd9d2d0ee63..40de2d2364a1 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -210,7 +210,7 @@ static int tcp_write_timeout(struct sock *sk)
210 struct inet_connection_sock *icsk = inet_csk(sk); 210 struct inet_connection_sock *icsk = inet_csk(sk);
211 struct tcp_sock *tp = tcp_sk(sk); 211 struct tcp_sock *tp = tcp_sk(sk);
212 struct net *net = sock_net(sk); 212 struct net *net = sock_net(sk);
213 bool expired, do_reset; 213 bool expired = false, do_reset;
214 int retry_until; 214 int retry_until;
215 215
216 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 216 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
@@ -242,9 +242,10 @@ static int tcp_write_timeout(struct sock *sk)
242 if (tcp_out_of_resources(sk, do_reset)) 242 if (tcp_out_of_resources(sk, do_reset))
243 return 1; 243 return 1;
244 } 244 }
245 }
246 if (!expired)
245 expired = retransmits_timed_out(sk, retry_until, 247 expired = retransmits_timed_out(sk, retry_until,
246 icsk->icsk_user_timeout); 248 icsk->icsk_user_timeout);
247 }
248 tcp_fastopen_active_detect_blackhole(sk, expired); 249 tcp_fastopen_active_detect_blackhole(sk, expired);
249 250
250 if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG)) 251 if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG))
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index cdef8f9a3b01..35b84b52b702 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -85,6 +85,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
85 xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST | 85 xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST |
86 RTCF_LOCAL); 86 RTCF_LOCAL);
87 xdst->u.rt.rt_type = rt->rt_type; 87 xdst->u.rt.rt_type = rt->rt_type;
88 xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway;
88 xdst->u.rt.rt_gw_family = rt->rt_gw_family; 89 xdst->u.rt.rt_gw_family = rt->rt_gw_family;
89 if (rt->rt_gw_family == AF_INET) 90 if (rt->rt_gw_family == AF_INET)
90 xdst->u.rt.rt_gw4 = rt->rt_gw4; 91 xdst->u.rt.rt_gw4 = rt->rt_gw4;
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index d22b6c140f23..f9e8fe3ff0c5 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -287,7 +287,8 @@ static bool fib6_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg
287 return false; 287 return false;
288 288
289suppress_route: 289suppress_route:
290 ip6_rt_put(rt); 290 if (!(arg->flags & FIB_LOOKUP_NOREF))
291 ip6_rt_put(rt);
291 return true; 292 return true;
292} 293}
293 294
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 4da24aa6c696..0a0945a5b30d 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -133,7 +133,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused
133 fl6.daddr = sk->sk_v6_daddr; 133 fl6.daddr = sk->sk_v6_daddr;
134 134
135 res = ip6_xmit(sk, skb, &fl6, sk->sk_mark, rcu_dereference(np->opt), 135 res = ip6_xmit(sk, skb, &fl6, sk->sk_mark, rcu_dereference(np->opt),
136 np->tclass); 136 np->tclass, sk->sk_priority);
137 rcu_read_unlock(); 137 rcu_read_unlock();
138 return res; 138 return res;
139} 139}
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 87f47bc55c5e..6e2af411cd9c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -318,7 +318,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
318 if (rt->dst.error == -EAGAIN) { 318 if (rt->dst.error == -EAGAIN) {
319 ip6_rt_put_flags(rt, flags); 319 ip6_rt_put_flags(rt, flags);
320 rt = net->ipv6.ip6_null_entry; 320 rt = net->ipv6.ip6_null_entry;
321 if (!(flags | RT6_LOOKUP_F_DST_NOREF)) 321 if (!(flags & RT6_LOOKUP_F_DST_NOREF))
322 dst_hold(&rt->dst); 322 dst_hold(&rt->dst);
323 } 323 }
324 324
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 89a4c7c2e25d..edadee4a7e76 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -193,7 +193,7 @@ bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np)
193 * which are using proper atomic operations or spinlocks. 193 * which are using proper atomic operations or spinlocks.
194 */ 194 */
195int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, 195int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
196 __u32 mark, struct ipv6_txoptions *opt, int tclass) 196 __u32 mark, struct ipv6_txoptions *opt, int tclass, u32 priority)
197{ 197{
198 struct net *net = sock_net(sk); 198 struct net *net = sock_net(sk);
199 const struct ipv6_pinfo *np = inet6_sk(sk); 199 const struct ipv6_pinfo *np = inet6_sk(sk);
@@ -258,7 +258,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
258 hdr->daddr = *first_hop; 258 hdr->daddr = *first_hop;
259 259
260 skb->protocol = htons(ETH_P_IPV6); 260 skb->protocol = htons(ETH_P_IPV6);
261 skb->priority = sk->sk_priority; 261 skb->priority = priority;
262 skb->mark = mark; 262 skb->mark = mark;
263 263
264 mtu = dst_mtu(dst); 264 mtu = dst_mtu(dst);
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index 6120a7800975..69443e9a3aa5 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -170,13 +170,13 @@ config IP6_NF_MATCH_RT
170 To compile it as a module, choose M here. If unsure, say N. 170 To compile it as a module, choose M here. If unsure, say N.
171 171
172config IP6_NF_MATCH_SRH 172config IP6_NF_MATCH_SRH
173 tristate '"srh" Segment Routing header match support' 173 tristate '"srh" Segment Routing header match support'
174 depends on NETFILTER_ADVANCED 174 depends on NETFILTER_ADVANCED
175 help 175 help
176 srh matching allows you to match packets based on the segment 176 srh matching allows you to match packets based on the segment
177 routing header of the packet. 177 routing header of the packet.
178 178
179 To compile it as a module, choose M here. If unsure, say N. 179 To compile it as a module, choose M here. If unsure, say N.
180 180
181# The targets 181# The targets
182config IP6_NF_TARGET_HL 182config IP6_NF_TARGET_HL
@@ -249,10 +249,10 @@ config IP6_NF_SECURITY
249 depends on SECURITY 249 depends on SECURITY
250 depends on NETFILTER_ADVANCED 250 depends on NETFILTER_ADVANCED
251 help 251 help
252 This option adds a `security' table to iptables, for use 252 This option adds a `security' table to iptables, for use
253 with Mandatory Access Control (MAC) policy. 253 with Mandatory Access Control (MAC) policy.
254 254
255 If unsure, say N. 255 If unsure, say N.
256 256
257config IP6_NF_NAT 257config IP6_NF_NAT
258 tristate "ip6tables NAT support" 258 tristate "ip6tables NAT support"
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 87f44d3250ee..e3d9f4559c99 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -512,7 +512,8 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
512 opt = ireq->ipv6_opt; 512 opt = ireq->ipv6_opt;
513 if (!opt) 513 if (!opt)
514 opt = rcu_dereference(np->opt); 514 opt = rcu_dereference(np->opt);
515 err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt, np->tclass); 515 err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt, np->tclass,
516 sk->sk_priority);
516 rcu_read_unlock(); 517 rcu_read_unlock();
517 err = net_xmit_eval(err); 518 err = net_xmit_eval(err);
518 } 519 }
@@ -803,7 +804,7 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
803static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 seq, 804static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 seq,
804 u32 ack, u32 win, u32 tsval, u32 tsecr, 805 u32 ack, u32 win, u32 tsval, u32 tsecr,
805 int oif, struct tcp_md5sig_key *key, int rst, 806 int oif, struct tcp_md5sig_key *key, int rst,
806 u8 tclass, __be32 label) 807 u8 tclass, __be32 label, u32 priority)
807{ 808{
808 const struct tcphdr *th = tcp_hdr(skb); 809 const struct tcphdr *th = tcp_hdr(skb);
809 struct tcphdr *t1; 810 struct tcphdr *t1;
@@ -907,7 +908,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
907 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL); 908 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL);
908 if (!IS_ERR(dst)) { 909 if (!IS_ERR(dst)) {
909 skb_dst_set(buff, dst); 910 skb_dst_set(buff, dst);
910 ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, tclass); 911 ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, tclass,
912 priority);
911 TCP_INC_STATS(net, TCP_MIB_OUTSEGS); 913 TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
912 if (rst) 914 if (rst)
913 TCP_INC_STATS(net, TCP_MIB_OUTRSTS); 915 TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
@@ -930,6 +932,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
930 struct sock *sk1 = NULL; 932 struct sock *sk1 = NULL;
931#endif 933#endif
932 __be32 label = 0; 934 __be32 label = 0;
935 u32 priority = 0;
933 struct net *net; 936 struct net *net;
934 int oif = 0; 937 int oif = 0;
935 938
@@ -990,16 +993,19 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
990 trace_tcp_send_reset(sk, skb); 993 trace_tcp_send_reset(sk, skb);
991 if (np->repflow) 994 if (np->repflow)
992 label = ip6_flowlabel(ipv6h); 995 label = ip6_flowlabel(ipv6h);
996 priority = sk->sk_priority;
993 } 997 }
994 if (sk->sk_state == TCP_TIME_WAIT) 998 if (sk->sk_state == TCP_TIME_WAIT) {
995 label = cpu_to_be32(inet_twsk(sk)->tw_flowlabel); 999 label = cpu_to_be32(inet_twsk(sk)->tw_flowlabel);
1000 priority = inet_twsk(sk)->tw_priority;
1001 }
996 } else { 1002 } else {
997 if (net->ipv6.sysctl.flowlabel_reflect & FLOWLABEL_REFLECT_TCP_RESET) 1003 if (net->ipv6.sysctl.flowlabel_reflect & FLOWLABEL_REFLECT_TCP_RESET)
998 label = ip6_flowlabel(ipv6h); 1004 label = ip6_flowlabel(ipv6h);
999 } 1005 }
1000 1006
1001 tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 1007 tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0,
1002 label); 1008 label, priority);
1003 1009
1004#ifdef CONFIG_TCP_MD5SIG 1010#ifdef CONFIG_TCP_MD5SIG
1005out: 1011out:
@@ -1010,10 +1016,10 @@ out:
1010static void tcp_v6_send_ack(const struct sock *sk, struct sk_buff *skb, u32 seq, 1016static void tcp_v6_send_ack(const struct sock *sk, struct sk_buff *skb, u32 seq,
1011 u32 ack, u32 win, u32 tsval, u32 tsecr, int oif, 1017 u32 ack, u32 win, u32 tsval, u32 tsecr, int oif,
1012 struct tcp_md5sig_key *key, u8 tclass, 1018 struct tcp_md5sig_key *key, u8 tclass,
1013 __be32 label) 1019 __be32 label, u32 priority)
1014{ 1020{
1015 tcp_v6_send_response(sk, skb, seq, ack, win, tsval, tsecr, oif, key, 0, 1021 tcp_v6_send_response(sk, skb, seq, ack, win, tsval, tsecr, oif, key, 0,
1016 tclass, label); 1022 tclass, label, priority);
1017} 1023}
1018 1024
1019static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) 1025static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb)
@@ -1025,7 +1031,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb)
1025 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, 1031 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
1026 tcp_time_stamp_raw() + tcptw->tw_ts_offset, 1032 tcp_time_stamp_raw() + tcptw->tw_ts_offset,
1027 tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), 1033 tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw),
1028 tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel)); 1034 tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel), tw->tw_priority);
1029 1035
1030 inet_twsk_put(tw); 1036 inet_twsk_put(tw);
1031} 1037}
@@ -1048,7 +1054,7 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
1048 tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, 1054 tcp_time_stamp_raw() + tcp_rsk(req)->ts_off,
1049 req->ts_recent, sk->sk_bound_dev_if, 1055 req->ts_recent, sk->sk_bound_dev_if,
1050 tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->saddr), 1056 tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->saddr),
1051 0, 0); 1057 0, 0, sk->sk_priority);
1052} 1058}
1053 1059
1054 1060
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 8f12f5c6ab87..ea9e73428ed9 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -378,8 +378,12 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb)
378{ 378{
379 struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp); 379 struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);
380 struct bpf_prog *prog = psock->bpf_prog; 380 struct bpf_prog *prog = psock->bpf_prog;
381 int res;
381 382
382 return BPF_PROG_RUN(prog, skb); 383 preempt_disable();
384 res = BPF_PROG_RUN(prog, skb);
385 preempt_enable();
386 return res;
383} 387}
384 388
385static int kcm_read_sock_done(struct strparser *strp, int err) 389static int kcm_read_sock_done(struct strparser *strp, int err)
diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
index 0b3f0673e1a2..ad3fd7f1da75 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -264,9 +264,7 @@ enum {
264 ncsi_dev_state_config_ev, 264 ncsi_dev_state_config_ev,
265 ncsi_dev_state_config_sma, 265 ncsi_dev_state_config_sma,
266 ncsi_dev_state_config_ebf, 266 ncsi_dev_state_config_ebf,
267#if IS_ENABLED(CONFIG_IPV6) 267 ncsi_dev_state_config_dgmf,
268 ncsi_dev_state_config_egmf,
269#endif
270 ncsi_dev_state_config_ecnt, 268 ncsi_dev_state_config_ecnt,
271 ncsi_dev_state_config_ec, 269 ncsi_dev_state_config_ec,
272 ncsi_dev_state_config_ae, 270 ncsi_dev_state_config_ae,
@@ -295,9 +293,6 @@ struct ncsi_dev_priv {
295#define NCSI_DEV_RESET 8 /* Reset state of NC */ 293#define NCSI_DEV_RESET 8 /* Reset state of NC */
296 unsigned int gma_flag; /* OEM GMA flag */ 294 unsigned int gma_flag; /* OEM GMA flag */
297 spinlock_t lock; /* Protect the NCSI device */ 295 spinlock_t lock; /* Protect the NCSI device */
298#if IS_ENABLED(CONFIG_IPV6)
299 unsigned int inet6_addr_num; /* Number of IPv6 addresses */
300#endif
301 unsigned int package_probe_id;/* Current ID during probe */ 296 unsigned int package_probe_id;/* Current ID during probe */
302 unsigned int package_num; /* Number of packages */ 297 unsigned int package_num; /* Number of packages */
303 struct list_head packages; /* List of packages */ 298 struct list_head packages; /* List of packages */
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 755aab66dcab..70fe02697544 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -14,7 +14,6 @@
14#include <net/sock.h> 14#include <net/sock.h>
15#include <net/addrconf.h> 15#include <net/addrconf.h>
16#include <net/ipv6.h> 16#include <net/ipv6.h>
17#include <net/if_inet6.h>
18#include <net/genetlink.h> 17#include <net/genetlink.h>
19 18
20#include "internal.h" 19#include "internal.h"
@@ -978,9 +977,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
978 case ncsi_dev_state_config_ev: 977 case ncsi_dev_state_config_ev:
979 case ncsi_dev_state_config_sma: 978 case ncsi_dev_state_config_sma:
980 case ncsi_dev_state_config_ebf: 979 case ncsi_dev_state_config_ebf:
981#if IS_ENABLED(CONFIG_IPV6) 980 case ncsi_dev_state_config_dgmf:
982 case ncsi_dev_state_config_egmf:
983#endif
984 case ncsi_dev_state_config_ecnt: 981 case ncsi_dev_state_config_ecnt:
985 case ncsi_dev_state_config_ec: 982 case ncsi_dev_state_config_ec:
986 case ncsi_dev_state_config_ae: 983 case ncsi_dev_state_config_ae:
@@ -1033,23 +1030,23 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
1033 } else if (nd->state == ncsi_dev_state_config_ebf) { 1030 } else if (nd->state == ncsi_dev_state_config_ebf) {
1034 nca.type = NCSI_PKT_CMD_EBF; 1031 nca.type = NCSI_PKT_CMD_EBF;
1035 nca.dwords[0] = nc->caps[NCSI_CAP_BC].cap; 1032 nca.dwords[0] = nc->caps[NCSI_CAP_BC].cap;
1036 if (ncsi_channel_is_tx(ndp, nc)) 1033 /* if multicast global filtering is supported then
1034 * disable it so that all multicast packet will be
1035 * forwarded to management controller
1036 */
1037 if (nc->caps[NCSI_CAP_GENERIC].cap &
1038 NCSI_CAP_GENERIC_MC)
1039 nd->state = ncsi_dev_state_config_dgmf;
1040 else if (ncsi_channel_is_tx(ndp, nc))
1037 nd->state = ncsi_dev_state_config_ecnt; 1041 nd->state = ncsi_dev_state_config_ecnt;
1038 else 1042 else
1039 nd->state = ncsi_dev_state_config_ec; 1043 nd->state = ncsi_dev_state_config_ec;
1040#if IS_ENABLED(CONFIG_IPV6) 1044 } else if (nd->state == ncsi_dev_state_config_dgmf) {
1041 if (ndp->inet6_addr_num > 0 && 1045 nca.type = NCSI_PKT_CMD_DGMF;
1042 (nc->caps[NCSI_CAP_GENERIC].cap &
1043 NCSI_CAP_GENERIC_MC))
1044 nd->state = ncsi_dev_state_config_egmf;
1045 } else if (nd->state == ncsi_dev_state_config_egmf) {
1046 nca.type = NCSI_PKT_CMD_EGMF;
1047 nca.dwords[0] = nc->caps[NCSI_CAP_MC].cap;
1048 if (ncsi_channel_is_tx(ndp, nc)) 1046 if (ncsi_channel_is_tx(ndp, nc))
1049 nd->state = ncsi_dev_state_config_ecnt; 1047 nd->state = ncsi_dev_state_config_ecnt;
1050 else 1048 else
1051 nd->state = ncsi_dev_state_config_ec; 1049 nd->state = ncsi_dev_state_config_ec;
1052#endif /* CONFIG_IPV6 */
1053 } else if (nd->state == ncsi_dev_state_config_ecnt) { 1050 } else if (nd->state == ncsi_dev_state_config_ecnt) {
1054 if (np->preferred_channel && 1051 if (np->preferred_channel &&
1055 nc != np->preferred_channel) 1052 nc != np->preferred_channel)
@@ -1483,70 +1480,6 @@ out:
1483 return -ENODEV; 1480 return -ENODEV;
1484} 1481}
1485 1482
1486#if IS_ENABLED(CONFIG_IPV6)
1487static int ncsi_inet6addr_event(struct notifier_block *this,
1488 unsigned long event, void *data)
1489{
1490 struct inet6_ifaddr *ifa = data;
1491 struct net_device *dev = ifa->idev->dev;
1492 struct ncsi_dev *nd = ncsi_find_dev(dev);
1493 struct ncsi_dev_priv *ndp = nd ? TO_NCSI_DEV_PRIV(nd) : NULL;
1494 struct ncsi_package *np;
1495 struct ncsi_channel *nc;
1496 struct ncsi_cmd_arg nca;
1497 bool action;
1498 int ret;
1499
1500 if (!ndp || (ipv6_addr_type(&ifa->addr) &
1501 (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK)))
1502 return NOTIFY_OK;
1503
1504 switch (event) {
1505 case NETDEV_UP:
1506 action = (++ndp->inet6_addr_num) == 1;
1507 nca.type = NCSI_PKT_CMD_EGMF;
1508 break;
1509 case NETDEV_DOWN:
1510 action = (--ndp->inet6_addr_num == 0);
1511 nca.type = NCSI_PKT_CMD_DGMF;
1512 break;
1513 default:
1514 return NOTIFY_OK;
1515 }
1516
1517 /* We might not have active channel or packages. The IPv6
1518 * required multicast will be enabled when active channel
1519 * or packages are chosen.
1520 */
1521 np = ndp->active_package;
1522 nc = ndp->active_channel;
1523 if (!action || !np || !nc)
1524 return NOTIFY_OK;
1525
1526 /* We needn't enable or disable it if the function isn't supported */
1527 if (!(nc->caps[NCSI_CAP_GENERIC].cap & NCSI_CAP_GENERIC_MC))
1528 return NOTIFY_OK;
1529
1530 nca.ndp = ndp;
1531 nca.req_flags = 0;
1532 nca.package = np->id;
1533 nca.channel = nc->id;
1534 nca.dwords[0] = nc->caps[NCSI_CAP_MC].cap;
1535 ret = ncsi_xmit_cmd(&nca);
1536 if (ret) {
1537 netdev_warn(dev, "Fail to %s global multicast filter (%d)\n",
1538 (event == NETDEV_UP) ? "enable" : "disable", ret);
1539 return NOTIFY_DONE;
1540 }
1541
1542 return NOTIFY_OK;
1543}
1544
1545static struct notifier_block ncsi_inet6addr_notifier = {
1546 .notifier_call = ncsi_inet6addr_event,
1547};
1548#endif /* CONFIG_IPV6 */
1549
1550static int ncsi_kick_channels(struct ncsi_dev_priv *ndp) 1483static int ncsi_kick_channels(struct ncsi_dev_priv *ndp)
1551{ 1484{
1552 struct ncsi_dev *nd = &ndp->ndev; 1485 struct ncsi_dev *nd = &ndp->ndev;
@@ -1725,11 +1658,6 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
1725 } 1658 }
1726 1659
1727 spin_lock_irqsave(&ncsi_dev_lock, flags); 1660 spin_lock_irqsave(&ncsi_dev_lock, flags);
1728#if IS_ENABLED(CONFIG_IPV6)
1729 ndp->inet6_addr_num = 0;
1730 if (list_empty(&ncsi_dev_list))
1731 register_inet6addr_notifier(&ncsi_inet6addr_notifier);
1732#endif
1733 list_add_tail_rcu(&ndp->node, &ncsi_dev_list); 1661 list_add_tail_rcu(&ndp->node, &ncsi_dev_list);
1734 spin_unlock_irqrestore(&ncsi_dev_lock, flags); 1662 spin_unlock_irqrestore(&ncsi_dev_lock, flags);
1735 1663
@@ -1896,10 +1824,6 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
1896 1824
1897 spin_lock_irqsave(&ncsi_dev_lock, flags); 1825 spin_lock_irqsave(&ncsi_dev_lock, flags);
1898 list_del_rcu(&ndp->node); 1826 list_del_rcu(&ndp->node);
1899#if IS_ENABLED(CONFIG_IPV6)
1900 if (list_empty(&ncsi_dev_list))
1901 unregister_inet6addr_notifier(&ncsi_inet6addr_notifier);
1902#endif
1903 spin_unlock_irqrestore(&ncsi_dev_lock, flags); 1827 spin_unlock_irqrestore(&ncsi_dev_lock, flags);
1904 1828
1905 ncsi_unregister_netlink(nd->dev); 1829 ncsi_unregister_netlink(nd->dev);
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 34ec7afec116..91efae88e8c2 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -697,7 +697,7 @@ config NF_FLOW_TABLE_INET
697 tristate "Netfilter flow table mixed IPv4/IPv6 module" 697 tristate "Netfilter flow table mixed IPv4/IPv6 module"
698 depends on NF_FLOW_TABLE 698 depends on NF_FLOW_TABLE
699 help 699 help
700 This option adds the flow table mixed IPv4/IPv6 support. 700 This option adds the flow table mixed IPv4/IPv6 support.
701 701
702 To compile it as a module, choose M here. 702 To compile it as a module, choose M here.
703 703
diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig
index f6f1a0d5c47d..5b672e05d758 100644
--- a/net/netfilter/ipvs/Kconfig
+++ b/net/netfilter/ipvs/Kconfig
@@ -135,7 +135,7 @@ config IP_VS_WRR
135 module, choose M here. If unsure, say N. 135 module, choose M here. If unsure, say N.
136 136
137config IP_VS_LC 137config IP_VS_LC
138 tristate "least-connection scheduling" 138 tristate "least-connection scheduling"
139 ---help--- 139 ---help---
140 The least-connection scheduling algorithm directs network 140 The least-connection scheduling algorithm directs network
141 connections to the server with the least number of active 141 connections to the server with the least number of active
@@ -145,7 +145,7 @@ config IP_VS_LC
145 module, choose M here. If unsure, say N. 145 module, choose M here. If unsure, say N.
146 146
147config IP_VS_WLC 147config IP_VS_WLC
148 tristate "weighted least-connection scheduling" 148 tristate "weighted least-connection scheduling"
149 ---help--- 149 ---help---
150 The weighted least-connection scheduling algorithm directs network 150 The weighted least-connection scheduling algorithm directs network
151 connections to the server with the least active connections 151 connections to the server with the least active connections
@@ -333,7 +333,7 @@ config IP_VS_NFCT
333 333
334config IP_VS_PE_SIP 334config IP_VS_PE_SIP
335 tristate "SIP persistence engine" 335 tristate "SIP persistence engine"
336 depends on IP_VS_PROTO_UDP 336 depends on IP_VS_PROTO_UDP
337 depends on NF_CONNTRACK_SIP 337 depends on NF_CONNTRACK_SIP
338 ---help--- 338 ---help---
339 Allow persistence based on the SIP Call-ID 339 Allow persistence based on the SIP Call-ID
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index e4a68dc42694..d481f9baca2f 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1715,7 +1715,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
1715 goto err2; 1715 goto err2;
1716 } 1716 }
1717 1717
1718 nft_trans_chain_policy(trans) = -1; 1718 nft_trans_chain_policy(trans) = NFT_CHAIN_POLICY_UNSET;
1719 if (nft_is_base_chain(chain)) 1719 if (nft_is_base_chain(chain))
1720 nft_trans_chain_policy(trans) = policy; 1720 nft_trans_chain_policy(trans) = policy;
1721 1721
@@ -3562,8 +3562,11 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
3562 NFT_SET_OBJECT)) 3562 NFT_SET_OBJECT))
3563 return -EINVAL; 3563 return -EINVAL;
3564 /* Only one of these operations is supported */ 3564 /* Only one of these operations is supported */
3565 if ((flags & (NFT_SET_MAP | NFT_SET_EVAL | NFT_SET_OBJECT)) == 3565 if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) ==
3566 (NFT_SET_MAP | NFT_SET_EVAL | NFT_SET_OBJECT)) 3566 (NFT_SET_MAP | NFT_SET_OBJECT))
3567 return -EOPNOTSUPP;
3568 if ((flags & (NFT_SET_EVAL | NFT_SET_OBJECT)) ==
3569 (NFT_SET_EVAL | NFT_SET_OBJECT))
3567 return -EOPNOTSUPP; 3570 return -EOPNOTSUPP;
3568 } 3571 }
3569 3572
@@ -5595,6 +5598,22 @@ struct nft_flowtable *nft_flowtable_lookup(const struct nft_table *table,
5595} 5598}
5596EXPORT_SYMBOL_GPL(nft_flowtable_lookup); 5599EXPORT_SYMBOL_GPL(nft_flowtable_lookup);
5597 5600
5601void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx,
5602 struct nft_flowtable *flowtable,
5603 enum nft_trans_phase phase)
5604{
5605 switch (phase) {
5606 case NFT_TRANS_PREPARE:
5607 case NFT_TRANS_ABORT:
5608 case NFT_TRANS_RELEASE:
5609 flowtable->use--;
5610 /* fall through */
5611 default:
5612 return;
5613 }
5614}
5615EXPORT_SYMBOL_GPL(nf_tables_deactivate_flowtable);
5616
5598static struct nft_flowtable * 5617static struct nft_flowtable *
5599nft_flowtable_lookup_byhandle(const struct nft_table *table, 5618nft_flowtable_lookup_byhandle(const struct nft_table *table,
5600 const struct nlattr *nla, u8 genmask) 5619 const struct nlattr *nla, u8 genmask)
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index 21bb772cb4b7..e546f759b7a7 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -313,7 +313,7 @@ static int nft_flow_offload_chain(struct nft_chain *chain,
313 policy = ppolicy ? *ppolicy : basechain->policy; 313 policy = ppolicy ? *ppolicy : basechain->policy;
314 314
315 /* Only default policy to accept is supported for now. */ 315 /* Only default policy to accept is supported for now. */
316 if (cmd == FLOW_BLOCK_BIND && policy != -1 && policy != NF_ACCEPT) 316 if (cmd == FLOW_BLOCK_BIND && policy == NF_DROP)
317 return -EOPNOTSUPP; 317 return -EOPNOTSUPP;
318 318
319 if (dev->netdev_ops->ndo_setup_tc) 319 if (dev->netdev_ops->ndo_setup_tc)
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index 22cf236eb5d5..f29bbc74c4bf 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -177,6 +177,23 @@ static int nft_flow_offload_init(const struct nft_ctx *ctx,
177 return nf_ct_netns_get(ctx->net, ctx->family); 177 return nf_ct_netns_get(ctx->net, ctx->family);
178} 178}
179 179
180static void nft_flow_offload_deactivate(const struct nft_ctx *ctx,
181 const struct nft_expr *expr,
182 enum nft_trans_phase phase)
183{
184 struct nft_flow_offload *priv = nft_expr_priv(expr);
185
186 nf_tables_deactivate_flowtable(ctx, priv->flowtable, phase);
187}
188
189static void nft_flow_offload_activate(const struct nft_ctx *ctx,
190 const struct nft_expr *expr)
191{
192 struct nft_flow_offload *priv = nft_expr_priv(expr);
193
194 priv->flowtable->use++;
195}
196
180static void nft_flow_offload_destroy(const struct nft_ctx *ctx, 197static void nft_flow_offload_destroy(const struct nft_ctx *ctx,
181 const struct nft_expr *expr) 198 const struct nft_expr *expr)
182{ 199{
@@ -205,6 +222,8 @@ static const struct nft_expr_ops nft_flow_offload_ops = {
205 .size = NFT_EXPR_SIZE(sizeof(struct nft_flow_offload)), 222 .size = NFT_EXPR_SIZE(sizeof(struct nft_flow_offload)),
206 .eval = nft_flow_offload_eval, 223 .eval = nft_flow_offload_eval,
207 .init = nft_flow_offload_init, 224 .init = nft_flow_offload_init,
225 .activate = nft_flow_offload_activate,
226 .deactivate = nft_flow_offload_deactivate,
208 .destroy = nft_flow_offload_destroy, 227 .destroy = nft_flow_offload_destroy,
209 .validate = nft_flow_offload_validate, 228 .validate = nft_flow_offload_validate,
210 .dump = nft_flow_offload_dump, 229 .dump = nft_flow_offload_dump,
diff --git a/net/netfilter/nft_lookup.c b/net/netfilter/nft_lookup.c
index c0560bf3c31b..660bad688e2b 100644
--- a/net/netfilter/nft_lookup.c
+++ b/net/netfilter/nft_lookup.c
@@ -73,9 +73,6 @@ static int nft_lookup_init(const struct nft_ctx *ctx,
73 if (IS_ERR(set)) 73 if (IS_ERR(set))
74 return PTR_ERR(set); 74 return PTR_ERR(set);
75 75
76 if (set->flags & NFT_SET_EVAL)
77 return -EOPNOTSUPP;
78
79 priv->sreg = nft_parse_register(tb[NFTA_LOOKUP_SREG]); 76 priv->sreg = nft_parse_register(tb[NFTA_LOOKUP_SREG]);
80 err = nft_validate_register_load(priv->sreg, set->klen); 77 err = nft_validate_register_load(priv->sreg, set->klen);
81 if (err < 0) 78 if (err < 0)
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 9b8742947aff..8dfea26536c9 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -1004,10 +1004,13 @@ static int llcp_sock_create(struct net *net, struct socket *sock,
1004 sock->type != SOCK_RAW) 1004 sock->type != SOCK_RAW)
1005 return -ESOCKTNOSUPPORT; 1005 return -ESOCKTNOSUPPORT;
1006 1006
1007 if (sock->type == SOCK_RAW) 1007 if (sock->type == SOCK_RAW) {
1008 if (!capable(CAP_NET_RAW))
1009 return -EPERM;
1008 sock->ops = &llcp_rawsock_ops; 1010 sock->ops = &llcp_rawsock_ops;
1009 else 1011 } else {
1010 sock->ops = &llcp_sock_ops; 1012 sock->ops = &llcp_sock_ops;
1013 }
1011 1014
1012 sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern); 1015 sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern);
1013 if (sk == NULL) 1016 if (sk == NULL)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index dde9d762edee..f30e406fbec5 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -2294,7 +2294,7 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
2294 [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) }, 2294 [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
2295 [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 }, 2295 [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
2296 [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 }, 2296 [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
2297 [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 }, 2297 [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_UNSPEC },
2298 [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED }, 2298 [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
2299 [OVS_VPORT_ATTR_IFINDEX] = { .type = NLA_U32 }, 2299 [OVS_VPORT_ATTR_IFINDEX] = { .type = NLA_U32 },
2300 [OVS_VPORT_ATTR_NETNSID] = { .type = NLA_S32 }, 2300 [OVS_VPORT_ATTR_NETNSID] = { .type = NLA_S32 },
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 6c8b0f6d28f9..88f98f27ad88 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -150,6 +150,7 @@ static void __qrtr_node_release(struct kref *kref)
150 list_del(&node->item); 150 list_del(&node->item);
151 mutex_unlock(&qrtr_node_lock); 151 mutex_unlock(&qrtr_node_lock);
152 152
153 cancel_work_sync(&node->work);
153 skb_queue_purge(&node->rx_queue); 154 skb_queue_purge(&node->rx_queue);
154 kfree(node); 155 kfree(node);
155} 156}
diff --git a/net/rds/Kconfig b/net/rds/Kconfig
index 38ea7f0f2699..c64e154bc18f 100644
--- a/net/rds/Kconfig
+++ b/net/rds/Kconfig
@@ -23,6 +23,6 @@ config RDS_TCP
23 This transport does not support RDMA operations. 23 This transport does not support RDMA operations.
24 24
25config RDS_DEBUG 25config RDS_DEBUG
26 bool "RDS debugging messages" 26 bool "RDS debugging messages"
27 depends on RDS 27 depends on RDS
28 default n 28 default n
diff --git a/net/rds/bind.c b/net/rds/bind.c
index 20c156a73e73..5b5fb4ca8d3e 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
244 */ 244 */
245 if (rs->rs_transport) { 245 if (rs->rs_transport) {
246 trans = rs->rs_transport; 246 trans = rs->rs_transport;
247 if (trans->laddr_check(sock_net(sock->sk), 247 if (!trans->laddr_check ||
248 trans->laddr_check(sock_net(sock->sk),
248 binding_addr, scope_id) != 0) { 249 binding_addr, scope_id) != 0) {
249 ret = -ENOPROTOOPT; 250 ret = -ENOPROTOOPT;
250 goto out; 251 goto out;
@@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
263 264
264 sock_set_flag(sk, SOCK_RCU_FREE); 265 sock_set_flag(sk, SOCK_RCU_FREE);
265 ret = rds_add_bound(rs, binding_addr, &port, scope_id); 266 ret = rds_add_bound(rs, binding_addr, &port, scope_id);
267 if (ret)
268 rs->rs_transport = NULL;
266 269
267out: 270out:
268 release_sock(sk); 271 release_sock(sk);
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index b3faafeafab9..2985509147a2 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -324,7 +324,7 @@ config NET_SCH_CAKE
324 tristate "Common Applications Kept Enhanced (CAKE)" 324 tristate "Common Applications Kept Enhanced (CAKE)"
325 help 325 help
326 Say Y here if you want to use the Common Applications Kept Enhanced 326 Say Y here if you want to use the Common Applications Kept Enhanced
327 (CAKE) queue management algorithm. 327 (CAKE) queue management algorithm.
328 328
329 To compile this driver as a module, choose M here: the module 329 To compile this driver as a module, choose M here: the module
330 will be called sch_cake. 330 will be called sch_cake.
@@ -730,8 +730,8 @@ config NET_CLS_ACT
730 730
731config NET_ACT_POLICE 731config NET_ACT_POLICE
732 tristate "Traffic Policing" 732 tristate "Traffic Policing"
733 depends on NET_CLS_ACT 733 depends on NET_CLS_ACT
734 ---help--- 734 ---help---
735 Say Y here if you want to do traffic policing, i.e. strict 735 Say Y here if you want to do traffic policing, i.e. strict
736 bandwidth limiting. This action replaces the existing policing 736 bandwidth limiting. This action replaces the existing policing
737 module. 737 module.
@@ -740,9 +740,9 @@ config NET_ACT_POLICE
740 module will be called act_police. 740 module will be called act_police.
741 741
742config NET_ACT_GACT 742config NET_ACT_GACT
743 tristate "Generic actions" 743 tristate "Generic actions"
744 depends on NET_CLS_ACT 744 depends on NET_CLS_ACT
745 ---help--- 745 ---help---
746 Say Y here to take generic actions such as dropping and 746 Say Y here to take generic actions such as dropping and
747 accepting packets. 747 accepting packets.
748 748
@@ -750,15 +750,15 @@ config NET_ACT_GACT
750 module will be called act_gact. 750 module will be called act_gact.
751 751
752config GACT_PROB 752config GACT_PROB
753 bool "Probability support" 753 bool "Probability support"
754 depends on NET_ACT_GACT 754 depends on NET_ACT_GACT
755 ---help--- 755 ---help---
756 Say Y here to use the generic action randomly or deterministically. 756 Say Y here to use the generic action randomly or deterministically.
757 757
758config NET_ACT_MIRRED 758config NET_ACT_MIRRED
759 tristate "Redirecting and Mirroring" 759 tristate "Redirecting and Mirroring"
760 depends on NET_CLS_ACT 760 depends on NET_CLS_ACT
761 ---help--- 761 ---help---
762 Say Y here to allow packets to be mirrored or redirected to 762 Say Y here to allow packets to be mirrored or redirected to
763 other devices. 763 other devices.
764 764
@@ -766,10 +766,10 @@ config NET_ACT_MIRRED
766 module will be called act_mirred. 766 module will be called act_mirred.
767 767
768config NET_ACT_SAMPLE 768config NET_ACT_SAMPLE
769 tristate "Traffic Sampling" 769 tristate "Traffic Sampling"
770 depends on NET_CLS_ACT 770 depends on NET_CLS_ACT
771 select PSAMPLE 771 select PSAMPLE
772 ---help--- 772 ---help---
773 Say Y here to allow packet sampling tc action. The packet sample 773 Say Y here to allow packet sampling tc action. The packet sample
774 action consists of statistically choosing packets and sampling 774 action consists of statistically choosing packets and sampling
775 them using the psample module. 775 them using the psample module.
@@ -778,9 +778,9 @@ config NET_ACT_SAMPLE
778 module will be called act_sample. 778 module will be called act_sample.
779 779
780config NET_ACT_IPT 780config NET_ACT_IPT
781 tristate "IPtables targets" 781 tristate "IPtables targets"
782 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES 782 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES
783 ---help--- 783 ---help---
784 Say Y here to be able to invoke iptables targets after successful 784 Say Y here to be able to invoke iptables targets after successful
785 classification. 785 classification.
786 786
@@ -788,9 +788,9 @@ config NET_ACT_IPT
788 module will be called act_ipt. 788 module will be called act_ipt.
789 789
790config NET_ACT_NAT 790config NET_ACT_NAT
791 tristate "Stateless NAT" 791 tristate "Stateless NAT"
792 depends on NET_CLS_ACT 792 depends on NET_CLS_ACT
793 ---help--- 793 ---help---
794 Say Y here to do stateless NAT on IPv4 packets. You should use 794 Say Y here to do stateless NAT on IPv4 packets. You should use
795 netfilter for NAT unless you know what you are doing. 795 netfilter for NAT unless you know what you are doing.
796 796
@@ -798,18 +798,18 @@ config NET_ACT_NAT
798 module will be called act_nat. 798 module will be called act_nat.
799 799
800config NET_ACT_PEDIT 800config NET_ACT_PEDIT
801 tristate "Packet Editing" 801 tristate "Packet Editing"
802 depends on NET_CLS_ACT 802 depends on NET_CLS_ACT
803 ---help--- 803 ---help---
804 Say Y here if you want to mangle the content of packets. 804 Say Y here if you want to mangle the content of packets.
805 805
806 To compile this code as a module, choose M here: the 806 To compile this code as a module, choose M here: the
807 module will be called act_pedit. 807 module will be called act_pedit.
808 808
809config NET_ACT_SIMP 809config NET_ACT_SIMP
810 tristate "Simple Example (Debug)" 810 tristate "Simple Example (Debug)"
811 depends on NET_CLS_ACT 811 depends on NET_CLS_ACT
812 ---help--- 812 ---help---
813 Say Y here to add a simple action for demonstration purposes. 813 Say Y here to add a simple action for demonstration purposes.
814 It is meant as an example and for debugging purposes. It will 814 It is meant as an example and for debugging purposes. It will
815 print a configured policy string followed by the packet count 815 print a configured policy string followed by the packet count
@@ -821,9 +821,9 @@ config NET_ACT_SIMP
821 module will be called act_simple. 821 module will be called act_simple.
822 822
823config NET_ACT_SKBEDIT 823config NET_ACT_SKBEDIT
824 tristate "SKB Editing" 824 tristate "SKB Editing"
825 depends on NET_CLS_ACT 825 depends on NET_CLS_ACT
826 ---help--- 826 ---help---
827 Say Y here to change skb priority or queue_mapping settings. 827 Say Y here to change skb priority or queue_mapping settings.
828 828
829 If unsure, say N. 829 If unsure, say N.
@@ -832,10 +832,10 @@ config NET_ACT_SKBEDIT
832 module will be called act_skbedit. 832 module will be called act_skbedit.
833 833
834config NET_ACT_CSUM 834config NET_ACT_CSUM
835 tristate "Checksum Updating" 835 tristate "Checksum Updating"
836 depends on NET_CLS_ACT && INET 836 depends on NET_CLS_ACT && INET
837 select LIBCRC32C 837 select LIBCRC32C
838 ---help--- 838 ---help---
839 Say Y here to update some common checksum after some direct 839 Say Y here to update some common checksum after some direct
840 packet alterations. 840 packet alterations.
841 841
@@ -854,9 +854,9 @@ config NET_ACT_MPLS
854 module will be called act_mpls. 854 module will be called act_mpls.
855 855
856config NET_ACT_VLAN 856config NET_ACT_VLAN
857 tristate "Vlan manipulation" 857 tristate "Vlan manipulation"
858 depends on NET_CLS_ACT 858 depends on NET_CLS_ACT
859 ---help--- 859 ---help---
860 Say Y here to push or pop vlan headers. 860 Say Y here to push or pop vlan headers.
861 861
862 If unsure, say N. 862 If unsure, say N.
@@ -865,9 +865,9 @@ config NET_ACT_VLAN
865 module will be called act_vlan. 865 module will be called act_vlan.
866 866
867config NET_ACT_BPF 867config NET_ACT_BPF
868 tristate "BPF based action" 868 tristate "BPF based action"
869 depends on NET_CLS_ACT 869 depends on NET_CLS_ACT
870 ---help--- 870 ---help---
871 Say Y here to execute BPF code on packets. The BPF code will decide 871 Say Y here to execute BPF code on packets. The BPF code will decide
872 if the packet should be dropped or not. 872 if the packet should be dropped or not.
873 873
@@ -877,10 +877,10 @@ config NET_ACT_BPF
877 module will be called act_bpf. 877 module will be called act_bpf.
878 878
879config NET_ACT_CONNMARK 879config NET_ACT_CONNMARK
880 tristate "Netfilter Connection Mark Retriever" 880 tristate "Netfilter Connection Mark Retriever"
881 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES 881 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES
882 depends on NF_CONNTRACK && NF_CONNTRACK_MARK 882 depends on NF_CONNTRACK && NF_CONNTRACK_MARK
883 ---help--- 883 ---help---
884 Say Y here to allow retrieving of conn mark 884 Say Y here to allow retrieving of conn mark
885 885
886 If unsure, say N. 886 If unsure, say N.
@@ -889,10 +889,10 @@ config NET_ACT_CONNMARK
889 module will be called act_connmark. 889 module will be called act_connmark.
890 890
891config NET_ACT_CTINFO 891config NET_ACT_CTINFO
892 tristate "Netfilter Connection Mark Actions" 892 tristate "Netfilter Connection Mark Actions"
893 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES 893 depends on NET_CLS_ACT && NETFILTER && IP_NF_IPTABLES
894 depends on NF_CONNTRACK && NF_CONNTRACK_MARK 894 depends on NF_CONNTRACK && NF_CONNTRACK_MARK
895 help 895 help
896 Say Y here to allow transfer of a connmark stored information. 896 Say Y here to allow transfer of a connmark stored information.
897 Current actions transfer connmark stored DSCP into 897 Current actions transfer connmark stored DSCP into
898 ipv4/v6 diffserv and/or to transfer connmark to packet 898 ipv4/v6 diffserv and/or to transfer connmark to packet
@@ -906,21 +906,21 @@ config NET_ACT_CTINFO
906 module will be called act_ctinfo. 906 module will be called act_ctinfo.
907 907
908config NET_ACT_SKBMOD 908config NET_ACT_SKBMOD
909 tristate "skb data modification action" 909 tristate "skb data modification action"
910 depends on NET_CLS_ACT 910 depends on NET_CLS_ACT
911 ---help--- 911 ---help---
912 Say Y here to allow modification of skb data 912 Say Y here to allow modification of skb data
913 913
914 If unsure, say N. 914 If unsure, say N.
915 915
916 To compile this code as a module, choose M here: the 916 To compile this code as a module, choose M here: the
917 module will be called act_skbmod. 917 module will be called act_skbmod.
918 918
919config NET_ACT_IFE 919config NET_ACT_IFE
920 tristate "Inter-FE action based on IETF ForCES InterFE LFB" 920 tristate "Inter-FE action based on IETF ForCES InterFE LFB"
921 depends on NET_CLS_ACT 921 depends on NET_CLS_ACT
922 select NET_IFE 922 select NET_IFE
923 ---help--- 923 ---help---
924 Say Y here to allow for sourcing and terminating metadata 924 Say Y here to allow for sourcing and terminating metadata
925 For details refer to netdev01 paper: 925 For details refer to netdev01 paper:
926 "Distributing Linux Traffic Control Classifier-Action Subsystem" 926 "Distributing Linux Traffic Control Classifier-Action Subsystem"
@@ -930,9 +930,9 @@ config NET_ACT_IFE
930 module will be called act_ife. 930 module will be called act_ife.
931 931
932config NET_ACT_TUNNEL_KEY 932config NET_ACT_TUNNEL_KEY
933 tristate "IP tunnel metadata manipulation" 933 tristate "IP tunnel metadata manipulation"
934 depends on NET_CLS_ACT 934 depends on NET_CLS_ACT
935 ---help--- 935 ---help---
936 Say Y here to set/release ip tunnel metadata. 936 Say Y here to set/release ip tunnel metadata.
937 937
938 If unsure, say N. 938 If unsure, say N.
@@ -941,9 +941,9 @@ config NET_ACT_TUNNEL_KEY
941 module will be called act_tunnel_key. 941 module will be called act_tunnel_key.
942 942
943config NET_ACT_CT 943config NET_ACT_CT
944 tristate "connection tracking tc action" 944 tristate "connection tracking tc action"
945 depends on NET_CLS_ACT && NF_CONNTRACK && NF_NAT 945 depends on NET_CLS_ACT && NF_CONNTRACK && NF_NAT
946 help 946 help
947 Say Y here to allow sending the packets to conntrack module. 947 Say Y here to allow sending the packets to conntrack module.
948 948
949 If unsure, say N. 949 If unsure, say N.
@@ -952,21 +952,20 @@ config NET_ACT_CT
952 module will be called act_ct. 952 module will be called act_ct.
953 953
954config NET_IFE_SKBMARK 954config NET_IFE_SKBMARK
955 tristate "Support to encoding decoding skb mark on IFE action" 955 tristate "Support to encoding decoding skb mark on IFE action"
956 depends on NET_ACT_IFE 956 depends on NET_ACT_IFE
957 957
958config NET_IFE_SKBPRIO 958config NET_IFE_SKBPRIO
959 tristate "Support to encoding decoding skb prio on IFE action" 959 tristate "Support to encoding decoding skb prio on IFE action"
960 depends on NET_ACT_IFE 960 depends on NET_ACT_IFE
961 961
962config NET_IFE_SKBTCINDEX 962config NET_IFE_SKBTCINDEX
963 tristate "Support to encoding decoding skb tcindex on IFE action" 963 tristate "Support to encoding decoding skb tcindex on IFE action"
964 depends on NET_ACT_IFE 964 depends on NET_ACT_IFE
965 965
966config NET_TC_SKB_EXT 966config NET_TC_SKB_EXT
967 bool "TC recirculation support" 967 bool "TC recirculation support"
968 depends on NET_CLS_ACT 968 depends on NET_CLS_ACT
969 default y if NET_CLS_ACT
970 select SKB_EXTENSIONS 969 select SKB_EXTENSIONS
971 970
972 help 971 help
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 339712296164..2558f00f6b3e 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -831,6 +831,15 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb)
831 return c; 831 return c;
832} 832}
833 833
834static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = {
835 [TCA_ACT_KIND] = { .type = NLA_NUL_STRING,
836 .len = IFNAMSIZ - 1 },
837 [TCA_ACT_INDEX] = { .type = NLA_U32 },
838 [TCA_ACT_COOKIE] = { .type = NLA_BINARY,
839 .len = TC_COOKIE_MAX_SIZE },
840 [TCA_ACT_OPTIONS] = { .type = NLA_NESTED },
841};
842
834struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, 843struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
835 struct nlattr *nla, struct nlattr *est, 844 struct nlattr *nla, struct nlattr *est,
836 char *name, int ovr, int bind, 845 char *name, int ovr, int bind,
@@ -846,8 +855,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
846 int err; 855 int err;
847 856
848 if (name == NULL) { 857 if (name == NULL) {
849 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, 858 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla,
850 extack); 859 tcf_action_policy, extack);
851 if (err < 0) 860 if (err < 0)
852 goto err_out; 861 goto err_out;
853 err = -EINVAL; 862 err = -EINVAL;
@@ -856,18 +865,9 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
856 NL_SET_ERR_MSG(extack, "TC action kind must be specified"); 865 NL_SET_ERR_MSG(extack, "TC action kind must be specified");
857 goto err_out; 866 goto err_out;
858 } 867 }
859 if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) { 868 nla_strlcpy(act_name, kind, IFNAMSIZ);
860 NL_SET_ERR_MSG(extack, "TC action name too long");
861 goto err_out;
862 }
863 if (tb[TCA_ACT_COOKIE]) {
864 int cklen = nla_len(tb[TCA_ACT_COOKIE]);
865
866 if (cklen > TC_COOKIE_MAX_SIZE) {
867 NL_SET_ERR_MSG(extack, "TC cookie size above the maximum");
868 goto err_out;
869 }
870 869
870 if (tb[TCA_ACT_COOKIE]) {
871 cookie = nla_memdup_cookie(tb); 871 cookie = nla_memdup_cookie(tb);
872 if (!cookie) { 872 if (!cookie) {
873 NL_SET_ERR_MSG(extack, "No memory to generate TC cookie"); 873 NL_SET_ERR_MSG(extack, "No memory to generate TC cookie");
@@ -1098,7 +1098,8 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla,
1098 int index; 1098 int index;
1099 int err; 1099 int err;
1100 1100
1101 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); 1101 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla,
1102 tcf_action_policy, extack);
1102 if (err < 0) 1103 if (err < 0)
1103 goto err_out; 1104 goto err_out;
1104 1105
@@ -1152,7 +1153,8 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
1152 1153
1153 b = skb_tail_pointer(skb); 1154 b = skb_tail_pointer(skb);
1154 1155
1155 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); 1156 err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla,
1157 tcf_action_policy, extack);
1156 if (err < 0) 1158 if (err < 0)
1157 goto err_out; 1159 goto err_out;
1158 1160
@@ -1440,7 +1442,7 @@ static struct nlattr *find_dump_kind(struct nlattr **nla)
1440 1442
1441 if (tb[1] == NULL) 1443 if (tb[1] == NULL)
1442 return NULL; 1444 return NULL;
1443 if (nla_parse_nested_deprecated(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0) 1445 if (nla_parse_nested_deprecated(tb2, TCA_ACT_MAX, tb[1], tcf_action_policy, NULL) < 0)
1444 return NULL; 1446 return NULL;
1445 kind = tb2[TCA_ACT_KIND]; 1447 kind = tb2[TCA_ACT_KIND];
1446 1448
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 692c4c9040fd..514456a0b9a8 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -146,6 +146,7 @@ static bool tcf_sample_dev_ok_push(struct net_device *dev)
146 case ARPHRD_TUNNEL6: 146 case ARPHRD_TUNNEL6:
147 case ARPHRD_SIT: 147 case ARPHRD_SIT:
148 case ARPHRD_IPGRE: 148 case ARPHRD_IPGRE:
149 case ARPHRD_IP6GRE:
149 case ARPHRD_VOID: 150 case ARPHRD_VOID:
150 case ARPHRD_NONE: 151 case ARPHRD_NONE:
151 return false; 152 return false;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 32577c248968..64584a1df425 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -2894,8 +2894,10 @@ out:
2894void tcf_exts_destroy(struct tcf_exts *exts) 2894void tcf_exts_destroy(struct tcf_exts *exts)
2895{ 2895{
2896#ifdef CONFIG_NET_CLS_ACT 2896#ifdef CONFIG_NET_CLS_ACT
2897 tcf_action_destroy(exts->actions, TCA_ACT_UNBIND); 2897 if (exts->actions) {
2898 kfree(exts->actions); 2898 tcf_action_destroy(exts->actions, TCA_ACT_UNBIND);
2899 kfree(exts->actions);
2900 }
2899 exts->nr_actions = 0; 2901 exts->nr_actions = 0;
2900#endif 2902#endif
2901} 2903}
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 1047825d9f48..81d58b280612 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1390,7 +1390,8 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)
1390} 1390}
1391 1391
1392const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { 1392const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = {
1393 [TCA_KIND] = { .type = NLA_STRING }, 1393 [TCA_KIND] = { .type = NLA_NUL_STRING,
1394 .len = IFNAMSIZ - 1 },
1394 [TCA_RATE] = { .type = NLA_BINARY, 1395 [TCA_RATE] = { .type = NLA_BINARY,
1395 .len = sizeof(struct tc_estimator) }, 1396 .len = sizeof(struct tc_estimator) },
1396 [TCA_STAB] = { .type = NLA_NESTED }, 1397 [TCA_STAB] = { .type = NLA_NESTED },
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index 93b58fde99b7..1bef152c5721 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -392,7 +392,6 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt,
392{ 392{
393 struct cbs_sched_data *q = qdisc_priv(sch); 393 struct cbs_sched_data *q = qdisc_priv(sch);
394 struct net_device *dev = qdisc_dev(sch); 394 struct net_device *dev = qdisc_dev(sch);
395 int err;
396 395
397 if (!opt) { 396 if (!opt) {
398 NL_SET_ERR_MSG(extack, "Missing CBS qdisc options which are mandatory"); 397 NL_SET_ERR_MSG(extack, "Missing CBS qdisc options which are mandatory");
@@ -404,6 +403,10 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt,
404 if (!q->qdisc) 403 if (!q->qdisc)
405 return -ENOMEM; 404 return -ENOMEM;
406 405
406 spin_lock(&cbs_list_lock);
407 list_add(&q->cbs_list, &cbs_list);
408 spin_unlock(&cbs_list_lock);
409
407 qdisc_hash_add(q->qdisc, false); 410 qdisc_hash_add(q->qdisc, false);
408 411
409 q->queue = sch->dev_queue - netdev_get_tx_queue(dev, 0); 412 q->queue = sch->dev_queue - netdev_get_tx_queue(dev, 0);
@@ -413,17 +416,7 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt,
413 416
414 qdisc_watchdog_init(&q->watchdog, sch); 417 qdisc_watchdog_init(&q->watchdog, sch);
415 418
416 err = cbs_change(sch, opt, extack); 419 return cbs_change(sch, opt, extack);
417 if (err)
418 return err;
419
420 if (!q->offload) {
421 spin_lock(&cbs_list_lock);
422 list_add(&q->cbs_list, &cbs_list);
423 spin_unlock(&cbs_list_lock);
424 }
425
426 return 0;
427} 420}
428 421
429static void cbs_destroy(struct Qdisc *sch) 422static void cbs_destroy(struct Qdisc *sch)
@@ -431,15 +424,18 @@ static void cbs_destroy(struct Qdisc *sch)
431 struct cbs_sched_data *q = qdisc_priv(sch); 424 struct cbs_sched_data *q = qdisc_priv(sch);
432 struct net_device *dev = qdisc_dev(sch); 425 struct net_device *dev = qdisc_dev(sch);
433 426
434 spin_lock(&cbs_list_lock); 427 /* Nothing to do if we couldn't create the underlying qdisc */
435 list_del(&q->cbs_list); 428 if (!q->qdisc)
436 spin_unlock(&cbs_list_lock); 429 return;
437 430
438 qdisc_watchdog_cancel(&q->watchdog); 431 qdisc_watchdog_cancel(&q->watchdog);
439 cbs_disable_offload(dev, q); 432 cbs_disable_offload(dev, q);
440 433
441 if (q->qdisc) 434 spin_lock(&cbs_list_lock);
442 qdisc_put(q->qdisc); 435 list_del(&q->cbs_list);
436 spin_unlock(&cbs_list_lock);
437
438 qdisc_put(q->qdisc);
443} 439}
444 440
445static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb) 441static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 7bcf20ef9145..8184c87da8be 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1302,6 +1302,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1302 struct htb_class *cl = (struct htb_class *)*arg, *parent; 1302 struct htb_class *cl = (struct htb_class *)*arg, *parent;
1303 struct nlattr *opt = tca[TCA_OPTIONS]; 1303 struct nlattr *opt = tca[TCA_OPTIONS];
1304 struct nlattr *tb[TCA_HTB_MAX + 1]; 1304 struct nlattr *tb[TCA_HTB_MAX + 1];
1305 struct Qdisc *parent_qdisc = NULL;
1305 struct tc_htb_opt *hopt; 1306 struct tc_htb_opt *hopt;
1306 u64 rate64, ceil64; 1307 u64 rate64, ceil64;
1307 int warn = 0; 1308 int warn = 0;
@@ -1401,7 +1402,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1401 if (parent && !parent->level) { 1402 if (parent && !parent->level) {
1402 /* turn parent into inner node */ 1403 /* turn parent into inner node */
1403 qdisc_purge_queue(parent->leaf.q); 1404 qdisc_purge_queue(parent->leaf.q);
1404 qdisc_put(parent->leaf.q); 1405 parent_qdisc = parent->leaf.q;
1405 if (parent->prio_activity) 1406 if (parent->prio_activity)
1406 htb_deactivate(q, parent); 1407 htb_deactivate(q, parent);
1407 1408
@@ -1480,6 +1481,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1480 cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); 1481 cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer);
1481 1482
1482 sch_tree_unlock(sch); 1483 sch_tree_unlock(sch);
1484 qdisc_put(parent_qdisc);
1483 1485
1484 if (warn) 1486 if (warn)
1485 pr_warn("HTB: quantum of class %X is %s. Consider r2q change.\n", 1487 pr_warn("HTB: quantum of class %X is %s. Consider r2q change.\n",
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index e1087746f6a2..b2b7fdb06fc6 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -174,7 +174,8 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
174{ 174{
175 struct multiq_sched_data *q = qdisc_priv(sch); 175 struct multiq_sched_data *q = qdisc_priv(sch);
176 struct tc_multiq_qopt *qopt; 176 struct tc_multiq_qopt *qopt;
177 int i; 177 struct Qdisc **removed;
178 int i, n_removed = 0;
178 179
179 if (!netif_is_multiqueue(qdisc_dev(sch))) 180 if (!netif_is_multiqueue(qdisc_dev(sch)))
180 return -EOPNOTSUPP; 181 return -EOPNOTSUPP;
@@ -185,6 +186,11 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
185 186
186 qopt->bands = qdisc_dev(sch)->real_num_tx_queues; 187 qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
187 188
189 removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands),
190 GFP_KERNEL);
191 if (!removed)
192 return -ENOMEM;
193
188 sch_tree_lock(sch); 194 sch_tree_lock(sch);
189 q->bands = qopt->bands; 195 q->bands = qopt->bands;
190 for (i = q->bands; i < q->max_bands; i++) { 196 for (i = q->bands; i < q->max_bands; i++) {
@@ -192,13 +198,17 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
192 struct Qdisc *child = q->queues[i]; 198 struct Qdisc *child = q->queues[i];
193 199
194 q->queues[i] = &noop_qdisc; 200 q->queues[i] = &noop_qdisc;
195 qdisc_tree_flush_backlog(child); 201 qdisc_purge_queue(child);
196 qdisc_put(child); 202 removed[n_removed++] = child;
197 } 203 }
198 } 204 }
199 205
200 sch_tree_unlock(sch); 206 sch_tree_unlock(sch);
201 207
208 for (i = 0; i < n_removed; i++)
209 qdisc_put(removed[i]);
210 kfree(removed);
211
202 for (i = 0; i < q->bands; i++) { 212 for (i = 0; i < q->bands; i++) {
203 if (q->queues[i] == &noop_qdisc) { 213 if (q->queues[i] == &noop_qdisc) {
204 struct Qdisc *child, *old; 214 struct Qdisc *child, *old;
@@ -213,11 +223,10 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
213 if (child != &noop_qdisc) 223 if (child != &noop_qdisc)
214 qdisc_hash_add(child, true); 224 qdisc_hash_add(child, true);
215 225
216 if (old != &noop_qdisc) { 226 if (old != &noop_qdisc)
217 qdisc_tree_flush_backlog(old); 227 qdisc_purge_queue(old);
218 qdisc_put(old);
219 }
220 sch_tree_unlock(sch); 228 sch_tree_unlock(sch);
229 qdisc_put(old);
221 } 230 }
222 } 231 }
223 } 232 }
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index b17f2ed970e2..0e44039e729c 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -476,7 +476,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
476 * skb will be queued. 476 * skb will be queued.
477 */ 477 */
478 if (count > 1 && (skb2 = skb_clone(skb, GFP_ATOMIC)) != NULL) { 478 if (count > 1 && (skb2 = skb_clone(skb, GFP_ATOMIC)) != NULL) {
479 struct Qdisc *rootq = qdisc_root(sch); 479 struct Qdisc *rootq = qdisc_root_bh(sch);
480 u32 dupsave = q->duplicate; /* prevent duplicating a dup... */ 480 u32 dupsave = q->duplicate; /* prevent duplicating a dup... */
481 481
482 q->duplicate = 0; 482 q->duplicate = 0;
@@ -777,7 +777,7 @@ static int get_dist_table(struct Qdisc *sch, struct disttable **tbl,
777 struct disttable *d; 777 struct disttable *d;
778 int i; 778 int i;
779 779
780 if (n > NETEM_DIST_MAX) 780 if (!n || n > NETEM_DIST_MAX)
781 return -EINVAL; 781 return -EINVAL;
782 782
783 d = kvmalloc(sizeof(struct disttable) + n * sizeof(s16), GFP_KERNEL); 783 d = kvmalloc(sizeof(struct disttable) + n * sizeof(s16), GFP_KERNEL);
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 1dff8506a715..d448fe3068e5 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -488,7 +488,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
488 struct netlink_ext_ack *extack) 488 struct netlink_ext_ack *extack)
489{ 489{
490 struct sfb_sched_data *q = qdisc_priv(sch); 490 struct sfb_sched_data *q = qdisc_priv(sch);
491 struct Qdisc *child; 491 struct Qdisc *child, *old;
492 struct nlattr *tb[TCA_SFB_MAX + 1]; 492 struct nlattr *tb[TCA_SFB_MAX + 1];
493 const struct tc_sfb_qopt *ctl = &sfb_default_ops; 493 const struct tc_sfb_qopt *ctl = &sfb_default_ops;
494 u32 limit; 494 u32 limit;
@@ -518,8 +518,8 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
518 qdisc_hash_add(child, true); 518 qdisc_hash_add(child, true);
519 sch_tree_lock(sch); 519 sch_tree_lock(sch);
520 520
521 qdisc_tree_flush_backlog(q->qdisc); 521 qdisc_purge_queue(q->qdisc);
522 qdisc_put(q->qdisc); 522 old = q->qdisc;
523 q->qdisc = child; 523 q->qdisc = child;
524 524
525 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval); 525 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval);
@@ -542,6 +542,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
542 sfb_init_perturbation(1, q); 542 sfb_init_perturbation(1, q);
543 543
544 sch_tree_unlock(sch); 544 sch_tree_unlock(sch);
545 qdisc_put(old);
545 546
546 return 0; 547 return 0;
547} 548}
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index e5f2fc726a98..dd860fea0148 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -215,7 +215,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
215 215
216 rcu_read_lock(); 216 rcu_read_lock();
217 res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt), 217 res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt),
218 tclass); 218 tclass, sk->sk_priority);
219 rcu_read_unlock(); 219 rcu_read_unlock();
220 return res; 220 return res;
221} 221}
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index bba3104f128f..16d5f353163a 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -376,8 +376,6 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
376 return -EINVAL; 376 return -EINVAL;
377 } 377 }
378 378
379 headroom = ALIGN(headroom, 64);
380
381 size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM; 379 size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;
382 if (size_chk < 0) 380 if (size_chk < 0)
383 return -EINVAL; 381 return -EINVAL;
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index 715967762312..ede55fec3618 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -48,6 +48,8 @@ struct btf_dump_type_aux_state {
48 __u8 fwd_emitted: 1; 48 __u8 fwd_emitted: 1;
49 /* whether unique non-duplicate name was already assigned */ 49 /* whether unique non-duplicate name was already assigned */
50 __u8 name_resolved: 1; 50 __u8 name_resolved: 1;
51 /* whether type is referenced from any other type */
52 __u8 referenced: 1;
51}; 53};
52 54
53struct btf_dump { 55struct btf_dump {
@@ -173,6 +175,7 @@ void btf_dump__free(struct btf_dump *d)
173 free(d); 175 free(d);
174} 176}
175 177
178static int btf_dump_mark_referenced(struct btf_dump *d);
176static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr); 179static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr);
177static void btf_dump_emit_type(struct btf_dump *d, __u32 id, __u32 cont_id); 180static void btf_dump_emit_type(struct btf_dump *d, __u32 id, __u32 cont_id);
178 181
@@ -213,6 +216,11 @@ int btf_dump__dump_type(struct btf_dump *d, __u32 id)
213 /* VOID is special */ 216 /* VOID is special */
214 d->type_states[0].order_state = ORDERED; 217 d->type_states[0].order_state = ORDERED;
215 d->type_states[0].emit_state = EMITTED; 218 d->type_states[0].emit_state = EMITTED;
219
220 /* eagerly determine referenced types for anon enums */
221 err = btf_dump_mark_referenced(d);
222 if (err)
223 return err;
216 } 224 }
217 225
218 d->emit_queue_cnt = 0; 226 d->emit_queue_cnt = 0;
@@ -226,6 +234,79 @@ int btf_dump__dump_type(struct btf_dump *d, __u32 id)
226 return 0; 234 return 0;
227} 235}
228 236
237/*
238 * Mark all types that are referenced from any other type. This is used to
239 * determine top-level anonymous enums that need to be emitted as an
240 * independent type declarations.
241 * Anonymous enums come in two flavors: either embedded in a struct's field
242 * definition, in which case they have to be declared inline as part of field
243 * type declaration; or as a top-level anonymous enum, typically used for
244 * declaring global constants. It's impossible to distinguish between two
245 * without knowning whether given enum type was referenced from other type:
246 * top-level anonymous enum won't be referenced by anything, while embedded
247 * one will.
248 */
249static int btf_dump_mark_referenced(struct btf_dump *d)
250{
251 int i, j, n = btf__get_nr_types(d->btf);
252 const struct btf_type *t;
253 __u16 vlen;
254
255 for (i = 1; i <= n; i++) {
256 t = btf__type_by_id(d->btf, i);
257 vlen = btf_vlen(t);
258
259 switch (btf_kind(t)) {
260 case BTF_KIND_INT:
261 case BTF_KIND_ENUM:
262 case BTF_KIND_FWD:
263 break;
264
265 case BTF_KIND_VOLATILE:
266 case BTF_KIND_CONST:
267 case BTF_KIND_RESTRICT:
268 case BTF_KIND_PTR:
269 case BTF_KIND_TYPEDEF:
270 case BTF_KIND_FUNC:
271 case BTF_KIND_VAR:
272 d->type_states[t->type].referenced = 1;
273 break;
274
275 case BTF_KIND_ARRAY: {
276 const struct btf_array *a = btf_array(t);
277
278 d->type_states[a->index_type].referenced = 1;
279 d->type_states[a->type].referenced = 1;
280 break;
281 }
282 case BTF_KIND_STRUCT:
283 case BTF_KIND_UNION: {
284 const struct btf_member *m = btf_members(t);
285
286 for (j = 0; j < vlen; j++, m++)
287 d->type_states[m->type].referenced = 1;
288 break;
289 }
290 case BTF_KIND_FUNC_PROTO: {
291 const struct btf_param *p = btf_params(t);
292
293 for (j = 0; j < vlen; j++, p++)
294 d->type_states[p->type].referenced = 1;
295 break;
296 }
297 case BTF_KIND_DATASEC: {
298 const struct btf_var_secinfo *v = btf_var_secinfos(t);
299
300 for (j = 0; j < vlen; j++, v++)
301 d->type_states[v->type].referenced = 1;
302 break;
303 }
304 default:
305 return -EINVAL;
306 }
307 }
308 return 0;
309}
229static int btf_dump_add_emit_queue_id(struct btf_dump *d, __u32 id) 310static int btf_dump_add_emit_queue_id(struct btf_dump *d, __u32 id)
230{ 311{
231 __u32 *new_queue; 312 __u32 *new_queue;
@@ -395,7 +476,12 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr)
395 } 476 }
396 case BTF_KIND_ENUM: 477 case BTF_KIND_ENUM:
397 case BTF_KIND_FWD: 478 case BTF_KIND_FWD:
398 if (t->name_off != 0) { 479 /*
480 * non-anonymous or non-referenced enums are top-level
481 * declarations and should be emitted. Same logic can be
482 * applied to FWDs, it won't hurt anyways.
483 */
484 if (t->name_off != 0 || !tstate->referenced) {
399 err = btf_dump_add_emit_queue_id(d, id); 485 err = btf_dump_add_emit_queue_id(d, id);
400 if (err) 486 if (err)
401 return err; 487 return err;
@@ -536,11 +622,6 @@ static void btf_dump_emit_type(struct btf_dump *d, __u32 id, __u32 cont_id)
536 t = btf__type_by_id(d->btf, id); 622 t = btf__type_by_id(d->btf, id);
537 kind = btf_kind(t); 623 kind = btf_kind(t);
538 624
539 if (top_level_def && t->name_off == 0) {
540 pr_warning("unexpected nameless definition, id:[%u]\n", id);
541 return;
542 }
543
544 if (tstate->emit_state == EMITTING) { 625 if (tstate->emit_state == EMITTING) {
545 if (tstate->fwd_emitted) 626 if (tstate->fwd_emitted)
546 return; 627 return;
@@ -1167,6 +1248,7 @@ static void btf_dump_emit_type_chain(struct btf_dump *d,
1167 return; 1248 return;
1168 } 1249 }
1169 1250
1251 next_id = decls->ids[decls->cnt - 1];
1170 next_t = btf__type_by_id(d->btf, next_id); 1252 next_t = btf__type_by_id(d->btf, next_id);
1171 multidim = btf_is_array(next_t); 1253 multidim = btf_is_array(next_t);
1172 /* we need space if we have named non-pointer */ 1254 /* we need space if we have named non-pointer */
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 842c4fd55859..24fa313524fb 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -65,7 +65,6 @@ struct xsk_socket {
65 int xsks_map_fd; 65 int xsks_map_fd;
66 __u32 queue_id; 66 __u32 queue_id;
67 char ifname[IFNAMSIZ]; 67 char ifname[IFNAMSIZ];
68 bool zc;
69}; 68};
70 69
71struct xsk_nl_info { 70struct xsk_nl_info {
@@ -491,7 +490,6 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
491 void *rx_map = NULL, *tx_map = NULL; 490 void *rx_map = NULL, *tx_map = NULL;
492 struct sockaddr_xdp sxdp = {}; 491 struct sockaddr_xdp sxdp = {};
493 struct xdp_mmap_offsets off; 492 struct xdp_mmap_offsets off;
494 struct xdp_options opts;
495 struct xsk_socket *xsk; 493 struct xsk_socket *xsk;
496 socklen_t optlen; 494 socklen_t optlen;
497 int err; 495 int err;
@@ -611,15 +609,6 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
611 609
612 xsk->prog_fd = -1; 610 xsk->prog_fd = -1;
613 611
614 optlen = sizeof(opts);
615 err = getsockopt(xsk->fd, SOL_XDP, XDP_OPTIONS, &opts, &optlen);
616 if (err) {
617 err = -errno;
618 goto out_mmap_tx;
619 }
620
621 xsk->zc = opts.flags & XDP_OPTIONS_ZEROCOPY;
622
623 if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) { 612 if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) {
624 err = xsk_setup_xdp_prog(xsk); 613 err = xsk_setup_xdp_prog(xsk);
625 if (err) 614 if (err)
diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
index fdc0b3614a9e..a82da555b1b0 100644
--- a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
+++ b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
@@ -203,14 +203,24 @@ static int start_server(void)
203 return fd; 203 return fd;
204} 204}
205 205
206static pthread_mutex_t server_started_mtx = PTHREAD_MUTEX_INITIALIZER;
207static pthread_cond_t server_started = PTHREAD_COND_INITIALIZER;
208
206static void *server_thread(void *arg) 209static void *server_thread(void *arg)
207{ 210{
208 struct sockaddr_storage addr; 211 struct sockaddr_storage addr;
209 socklen_t len = sizeof(addr); 212 socklen_t len = sizeof(addr);
210 int fd = *(int *)arg; 213 int fd = *(int *)arg;
211 int client_fd; 214 int client_fd;
215 int err;
216
217 err = listen(fd, 1);
218
219 pthread_mutex_lock(&server_started_mtx);
220 pthread_cond_signal(&server_started);
221 pthread_mutex_unlock(&server_started_mtx);
212 222
213 if (CHECK_FAIL(listen(fd, 1)) < 0) { 223 if (CHECK_FAIL(err < 0)) {
214 perror("Failed to listed on socket"); 224 perror("Failed to listed on socket");
215 return NULL; 225 return NULL;
216 } 226 }
@@ -248,7 +258,14 @@ void test_tcp_rtt(void)
248 if (CHECK_FAIL(server_fd < 0)) 258 if (CHECK_FAIL(server_fd < 0))
249 goto close_cgroup_fd; 259 goto close_cgroup_fd;
250 260
251 pthread_create(&tid, NULL, server_thread, (void *)&server_fd); 261 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
262 (void *)&server_fd)))
263 goto close_cgroup_fd;
264
265 pthread_mutex_lock(&server_started_mtx);
266 pthread_cond_wait(&server_started, &server_started_mtx);
267 pthread_mutex_unlock(&server_started_mtx);
268
252 CHECK_FAIL(run_test(cgroup_fd, server_fd)); 269 CHECK_FAIL(run_test(cgroup_fd, server_fd));
253 close(server_fd); 270 close(server_fd);
254close_cgroup_fd: 271close_cgroup_fd:
diff --git a/tools/testing/selftests/bpf/progs/strobemeta.h b/tools/testing/selftests/bpf/progs/strobemeta.h
index 8a399bdfd920..067eb625d01c 100644
--- a/tools/testing/selftests/bpf/progs/strobemeta.h
+++ b/tools/testing/selftests/bpf/progs/strobemeta.h
@@ -413,7 +413,10 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg,
413#else 413#else
414#pragma unroll 414#pragma unroll
415#endif 415#endif
416 for (int i = 0; i < STROBE_MAX_MAP_ENTRIES && i < map.cnt; ++i) { 416 for (int i = 0; i < STROBE_MAX_MAP_ENTRIES; ++i) {
417 if (i >= map.cnt)
418 break;
419
417 descr->key_lens[i] = 0; 420 descr->key_lens[i] = 0;
418 len = bpf_probe_read_str(payload, STROBE_MAX_STR_LEN, 421 len = bpf_probe_read_str(payload, STROBE_MAX_STR_LEN,
419 map.entries[i].key); 422 map.entries[i].key);
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
index 4f8ec1f10a80..a320e3844b17 100644
--- a/tools/testing/selftests/bpf/test_sysctl.c
+++ b/tools/testing/selftests/bpf/test_sysctl.c
@@ -1385,7 +1385,6 @@ static int fixup_sysctl_value(const char *buf, size_t buf_len,
1385 uint8_t raw[sizeof(uint64_t)]; 1385 uint8_t raw[sizeof(uint64_t)];
1386 uint64_t num; 1386 uint64_t num;
1387 } value = {}; 1387 } value = {};
1388 uint8_t c, i;
1389 1388
1390 if (buf_len > sizeof(value)) { 1389 if (buf_len > sizeof(value)) {
1391 log_err("Value is too big (%zd) to use in fixup", buf_len); 1390 log_err("Value is too big (%zd) to use in fixup", buf_len);
diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
index 5dcdfa20fc6c..126caf28b529 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh
@@ -224,13 +224,6 @@ ingress_vlan_filter_test()
224 local vid=10 224 local vid=10
225 225
226 bridge vlan add vid $vid dev $swp2 master 226 bridge vlan add vid $vid dev $swp2 master
227 # During initialization the firmware enables all the VLAN filters and
228 # the driver does not turn them off since the traffic will be discarded
229 # by the STP filter whose default is DISCARD state. Add the VID on the
230 # ingress bridge port and then remove it to make sure it is not member
231 # in the VLAN.
232 bridge vlan add vid $vid dev $swp1 master
233 bridge vlan del vid $vid dev $swp1 master
234 227
235 RET=0 228 RET=0
236 229
diff --git a/tools/testing/selftests/net/fib_nexthop_multiprefix.sh b/tools/testing/selftests/net/fib_nexthop_multiprefix.sh
index e6828732843e..9dc35a16e415 100755
--- a/tools/testing/selftests/net/fib_nexthop_multiprefix.sh
+++ b/tools/testing/selftests/net/fib_nexthop_multiprefix.sh
@@ -15,6 +15,8 @@
15PAUSE_ON_FAIL=no 15PAUSE_ON_FAIL=no
16VERBOSE=0 16VERBOSE=0
17 17
18which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
19
18################################################################################ 20################################################################################
19# helpers 21# helpers
20 22
@@ -200,7 +202,7 @@ validate_v6_exception()
200 local rc 202 local rc
201 203
202 if [ ${ping_sz} != "0" ]; then 204 if [ ${ping_sz} != "0" ]; then
203 run_cmd ip netns exec h0 ping6 -s ${ping_sz} -c5 -w5 ${dst} 205 run_cmd ip netns exec h0 ${ping6} -s ${ping_sz} -c5 -w5 ${dst}
204 fi 206 fi
205 207
206 if [ "$VERBOSE" = "1" ]; then 208 if [ "$VERBOSE" = "1" ]; then
@@ -243,7 +245,7 @@ do
243 run_cmd taskset -c ${c} ip netns exec h0 ping -c1 -w1 172.16.10${i}.1 245 run_cmd taskset -c ${c} ip netns exec h0 ping -c1 -w1 172.16.10${i}.1
244 [ $? -ne 0 ] && printf "\nERROR: ping to h${i} failed\n" && ret=1 246 [ $? -ne 0 ] && printf "\nERROR: ping to h${i} failed\n" && ret=1
245 247
246 run_cmd taskset -c ${c} ip netns exec h0 ping6 -c1 -w1 2001:db8:10${i}::1 248 run_cmd taskset -c ${c} ip netns exec h0 ${ping6} -c1 -w1 2001:db8:10${i}::1
247 [ $? -ne 0 ] && printf "\nERROR: ping6 to h${i} failed\n" && ret=1 249 [ $? -ne 0 ] && printf "\nERROR: ping6 to h${i} failed\n" && ret=1
248 250
249 [ $ret -ne 0 ] && break 251 [ $ret -ne 0 ] && break
diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
index f9ebeac1e6f2..796670ebc65b 100755
--- a/tools/testing/selftests/net/fib_nexthops.sh
+++ b/tools/testing/selftests/net/fib_nexthops.sh
@@ -940,6 +940,20 @@ basic()
940 run_cmd "$IP nexthop add id 104 group 1 dev veth1" 940 run_cmd "$IP nexthop add id 104 group 1 dev veth1"
941 log_test $? 2 "Nexthop group and device" 941 log_test $? 2 "Nexthop group and device"
942 942
943 # Tests to ensure that flushing works as expected.
944 run_cmd "$IP nexthop add id 105 blackhole proto 99"
945 run_cmd "$IP nexthop add id 106 blackhole proto 100"
946 run_cmd "$IP nexthop add id 107 blackhole proto 99"
947 run_cmd "$IP nexthop flush proto 99"
948 check_nexthop "id 105" ""
949 check_nexthop "id 106" "id 106 blackhole proto 100"
950 check_nexthop "id 107" ""
951 run_cmd "$IP nexthop flush proto 100"
952 check_nexthop "id 106" ""
953
954 run_cmd "$IP nexthop flush proto 100"
955 log_test $? 0 "Test proto flush"
956
943 run_cmd "$IP nexthop add id 104 group 1 blackhole" 957 run_cmd "$IP nexthop add id 104 group 1 blackhole"
944 log_test $? 2 "Nexthop group and blackhole" 958 log_test $? 2 "Nexthop group and blackhole"
945 959
diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
index 4465fc2dae14..c4ba0ff4a53f 100755
--- a/tools/testing/selftests/net/fib_tests.sh
+++ b/tools/testing/selftests/net/fib_tests.sh
@@ -9,7 +9,7 @@ ret=0
9ksft_skip=4 9ksft_skip=4
10 10
11# all tests in this script. Can be overridden with -t option 11# all tests in this script. Can be overridden with -t option
12TESTS="unregister down carrier nexthop ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter" 12TESTS="unregister down carrier nexthop suppress ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter"
13 13
14VERBOSE=0 14VERBOSE=0
15PAUSE_ON_FAIL=no 15PAUSE_ON_FAIL=no
@@ -17,6 +17,8 @@ PAUSE=no
17IP="ip -netns ns1" 17IP="ip -netns ns1"
18NS_EXEC="ip netns exec ns1" 18NS_EXEC="ip netns exec ns1"
19 19
20which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
21
20log_test() 22log_test()
21{ 23{
22 local rc=$1 24 local rc=$1
@@ -614,6 +616,20 @@ fib_nexthop_test()
614 cleanup 616 cleanup
615} 617}
616 618
619fib_suppress_test()
620{
621 $IP link add dummy1 type dummy
622 $IP link set dummy1 up
623 $IP -6 route add default dev dummy1
624 $IP -6 rule add table main suppress_prefixlength 0
625 ping -f -c 1000 -W 1 1234::1 || true
626 $IP -6 rule del table main suppress_prefixlength 0
627 $IP link del dummy1
628
629 # If we got here without crashing, we're good.
630 return 0
631}
632
617################################################################################ 633################################################################################
618# Tests on route add and replace 634# Tests on route add and replace
619 635
@@ -1086,7 +1102,7 @@ ipv6_route_metrics_test()
1086 log_test $rc 0 "Multipath route with mtu metric" 1102 log_test $rc 0 "Multipath route with mtu metric"
1087 1103
1088 $IP -6 ro add 2001:db8:104::/64 via 2001:db8:101::2 mtu 1300 1104 $IP -6 ro add 2001:db8:104::/64 via 2001:db8:101::2 mtu 1300
1089 run_cmd "ip netns exec ns1 ping6 -w1 -c1 -s 1500 2001:db8:104::1" 1105 run_cmd "ip netns exec ns1 ${ping6} -w1 -c1 -s 1500 2001:db8:104::1"
1090 log_test $? 0 "Using route with mtu metric" 1106 log_test $? 0 "Using route with mtu metric"
1091 1107
1092 run_cmd "$IP -6 ro add 2001:db8:114::/64 via 2001:db8:101::2 congctl lock foo" 1108 run_cmd "$IP -6 ro add 2001:db8:114::/64 via 2001:db8:101::2 congctl lock foo"
@@ -1591,6 +1607,7 @@ do
1591 fib_carrier_test|carrier) fib_carrier_test;; 1607 fib_carrier_test|carrier) fib_carrier_test;;
1592 fib_rp_filter_test|rp_filter) fib_rp_filter_test;; 1608 fib_rp_filter_test|rp_filter) fib_rp_filter_test;;
1593 fib_nexthop_test|nexthop) fib_nexthop_test;; 1609 fib_nexthop_test|nexthop) fib_nexthop_test;;
1610 fib_suppress_test|suppress) fib_suppress_test;;
1594 ipv6_route_test|ipv6_rt) ipv6_route_test;; 1611 ipv6_route_test|ipv6_rt) ipv6_route_test;;
1595 ipv4_route_test|ipv4_rt) ipv4_route_test;; 1612 ipv4_route_test|ipv4_rt) ipv4_route_test;;
1596 ipv6_addr_metric) ipv6_addr_metric_test;; 1613 ipv6_addr_metric) ipv6_addr_metric_test;;
diff --git a/usr/include/Makefile b/usr/include/Makefile
index 05c71ef42f51..c9449aaf438d 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -38,7 +38,6 @@ header-test- += linux/ivtv.h
38header-test- += linux/jffs2.h 38header-test- += linux/jffs2.h
39header-test- += linux/kexec.h 39header-test- += linux/kexec.h
40header-test- += linux/matroxfb.h 40header-test- += linux/matroxfb.h
41header-test- += linux/netfilter_bridge/ebtables.h
42header-test- += linux/netfilter_ipv4/ipt_LOG.h 41header-test- += linux/netfilter_ipv4/ipt_LOG.h
43header-test- += linux/netfilter_ipv6/ip6t_LOG.h 42header-test- += linux/netfilter_ipv6/ip6t_LOG.h
44header-test- += linux/nfc.h 43header-test- += linux/nfc.h