aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/net/dsa/marvell.txt4
-rw-r--r--Documentation/networking/dpaa.txt194
-rw-r--r--Documentation/networking/tcp.txt31
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/arm/boot/dts/imx6ul-14x14-evk.dts6
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c2
-rw-r--r--drivers/isdn/mISDN/stack.c2
-rw-r--r--drivers/net/dsa/mv88e6xxx/global2.h6
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-desc.c5
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c25
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c9
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h6
-rw-r--r--drivers/net/ethernet/ethoc.c3
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c9
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c36
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c3
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mcg.c15
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c19
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c5
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_main.c3
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h26
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c2
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac-mac.c2
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac-phy.c75
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac.c22
-rw-r--r--drivers/net/ethernet/renesas/ravb_main.c24
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c7
-rw-r--r--drivers/net/geneve.c2
-rw-r--r--drivers/net/hamradio/hdlcdrv.c2
-rw-r--r--drivers/net/phy/marvell.c2
-rw-r--r--drivers/net/phy/mdio_bus.c13
-rw-r--r--drivers/net/phy/micrel.c42
-rw-r--r--drivers/net/phy/phy.c2
-rw-r--r--drivers/net/virtio_net.c5
-rw-r--r--drivers/net/vxlan.c39
-rw-r--r--drivers/net/wireless/ath/wcn36xx/main.c2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-7000.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-8000.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-prph.h1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c12
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ops.c32
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.c46
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.h15
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c26
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tt.c8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c12
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c9
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/net/ipv6.h1
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/bridge/br_netlink.c2
-rw-r--r--net/bridge/br_stp_if.c3
-rw-r--r--net/core/devlink.c8
-rw-r--r--net/core/skbuff.c5
-rw-r--r--net/dsa/dsa.c47
-rw-r--r--net/dsa/dsa2.c4
-rw-r--r--net/dsa/legacy.c47
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/tcp.c6
-rw-r--r--net/ipv4/tcp_cong.c1
-rw-r--r--net/ipv6/calipso.c6
-rw-r--r--net/ipv6/ip6_offload.c4
-rw-r--r--net/ipv6/ip6_tunnel.c3
-rw-r--r--net/ipv6/ping.c2
-rw-r--r--net/ipv6/raw.c2
-rw-r--r--net/ipv6/xfrm6_mode_ro.c2
-rw-r--r--net/ipv6/xfrm6_mode_transport.c2
-rw-r--r--net/mac80211/agg-tx.c128
-rw-r--r--net/mac80211/ht.c16
-rw-r--r--net/mac80211/ieee80211_i.h14
-rw-r--r--net/mac80211/iface.c11
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/mpls/af_mpls.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c7
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c9
-rw-r--r--net/netfilter/nf_nat_core.c2
-rw-r--r--net/netfilter/nft_set_rbtree.c22
-rw-r--r--net/netlink/af_netlink.c4
96 files changed, 781 insertions, 486 deletions
diff --git a/Documentation/devicetree/bindings/net/dsa/marvell.txt b/Documentation/devicetree/bindings/net/dsa/marvell.txt
index 7ef9dbb08957..1d4d0f49c9d0 100644
--- a/Documentation/devicetree/bindings/net/dsa/marvell.txt
+++ b/Documentation/devicetree/bindings/net/dsa/marvell.txt
@@ -26,6 +26,10 @@ Optional properties:
26- interrupt-controller : Indicates the switch is itself an interrupt 26- interrupt-controller : Indicates the switch is itself an interrupt
27 controller. This is used for the PHY interrupts. 27 controller. This is used for the PHY interrupts.
28#interrupt-cells = <2> : Controller uses two cells, number and flag 28#interrupt-cells = <2> : Controller uses two cells, number and flag
29- eeprom-length : Set to the length of an EEPROM connected to the
30 switch. Must be set if the switch can not detect
31 the presence and/or size of a connected EEPROM,
32 otherwise optional.
29- mdio : Container of PHY and devices on the switches MDIO 33- mdio : Container of PHY and devices on the switches MDIO
30 bus. 34 bus.
31- mdio? : Container of PHYs and devices on the external MDIO 35- mdio? : Container of PHYs and devices on the external MDIO
diff --git a/Documentation/networking/dpaa.txt b/Documentation/networking/dpaa.txt
new file mode 100644
index 000000000000..76e016d4d344
--- /dev/null
+++ b/Documentation/networking/dpaa.txt
@@ -0,0 +1,194 @@
1The QorIQ DPAA Ethernet Driver
2==============================
3
4Authors:
5Madalin Bucur <madalin.bucur@nxp.com>
6Camelia Groza <camelia.groza@nxp.com>
7
8Contents
9========
10
11 - DPAA Ethernet Overview
12 - DPAA Ethernet Supported SoCs
13 - Configuring DPAA Ethernet in your kernel
14 - DPAA Ethernet Frame Processing
15 - DPAA Ethernet Features
16 - Debugging
17
18DPAA Ethernet Overview
19======================
20
21DPAA stands for Data Path Acceleration Architecture and it is a
22set of networking acceleration IPs that are available on several
23generations of SoCs, both on PowerPC and ARM64.
24
25The Freescale DPAA architecture consists of a series of hardware blocks
26that support Ethernet connectivity. The Ethernet driver depends upon the
27following drivers in the Linux kernel:
28
29 - Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms)
30 drivers/iommu/fsl_*
31 - Frame Manager (FMan)
32 drivers/net/ethernet/freescale/fman
33 - Queue Manager (QMan), Buffer Manager (BMan)
34 drivers/soc/fsl/qbman
35
36A simplified view of the dpaa_eth interfaces mapped to FMan MACs:
37
38 dpaa_eth /eth0\ ... /ethN\
39 driver | | | |
40 ------------- ---- ----------- ---- -------------
41 -Ports / Tx Rx \ ... / Tx Rx \
42 FMan | | | |
43 -MACs | MAC0 | | MACN |
44 / dtsec0 \ ... / dtsecN \ (or tgec)
45 / \ / \(or memac)
46 --------- -------------- --- -------------- ---------
47 FMan, FMan Port, FMan SP, FMan MURAM drivers
48 ---------------------------------------------------------
49 FMan HW blocks: MURAM, MACs, Ports, SP
50 ---------------------------------------------------------
51
52The dpaa_eth relation to the QMan, BMan and FMan:
53 ________________________________
54 dpaa_eth / eth0 \
55 driver / \
56 --------- -^- -^- -^- --- ---------
57 QMan driver / \ / \ / \ \ / | BMan |
58 |Rx | |Rx | |Tx | |Tx | | driver |
59 --------- |Dfl| |Err| |Cnf| |FQs| | |
60 QMan HW |FQ | |FQ | |FQs| | | | |
61 / \ / \ / \ \ / | |
62 --------- --- --- --- -v- ---------
63 | FMan QMI | |
64 | FMan HW FMan BMI | BMan HW |
65 ----------------------- --------
66
67where the acronyms used above (and in the code) are:
68DPAA = Data Path Acceleration Architecture
69FMan = DPAA Frame Manager
70QMan = DPAA Queue Manager
71BMan = DPAA Buffers Manager
72QMI = QMan interface in FMan
73BMI = BMan interface in FMan
74FMan SP = FMan Storage Profiles
75MURAM = Multi-user RAM in FMan
76FQ = QMan Frame Queue
77Rx Dfl FQ = default reception FQ
78Rx Err FQ = Rx error frames FQ
79Tx Cnf FQ = Tx confirmation FQs
80Tx FQs = transmission frame queues
81dtsec = datapath three speed Ethernet controller (10/100/1000 Mbps)
82tgec = ten gigabit Ethernet controller (10 Gbps)
83memac = multirate Ethernet MAC (10/100/1000/10000)
84
85DPAA Ethernet Supported SoCs
86============================
87
88The DPAA drivers enable the Ethernet controllers present on the following SoCs:
89
90# PPC
91P1023
92P2041
93P3041
94P4080
95P5020
96P5040
97T1023
98T1024
99T1040
100T1042
101T2080
102T4240
103B4860
104
105# ARM
106LS1043A
107LS1046A
108
109Configuring DPAA Ethernet in your kernel
110========================================
111
112To enable the DPAA Ethernet driver, the following Kconfig options are required:
113
114# common for arch/arm64 and arch/powerpc platforms
115CONFIG_FSL_DPAA=y
116CONFIG_FSL_FMAN=y
117CONFIG_FSL_DPAA_ETH=y
118CONFIG_FSL_XGMAC_MDIO=y
119
120# for arch/powerpc only
121CONFIG_FSL_PAMU=y
122
123# common options needed for the PHYs used on the RDBs
124CONFIG_VITESSE_PHY=y
125CONFIG_REALTEK_PHY=y
126CONFIG_AQUANTIA_PHY=y
127
128DPAA Ethernet Frame Processing
129==============================
130
131On Rx, buffers for the incoming frames are retrieved from one of the three
132existing buffers pools. The driver initializes and seeds these, each with
133buffers of different sizes: 1KB, 2KB and 4KB.
134
135On Tx, all transmitted frames are returned to the driver through Tx
136confirmation frame queues. The driver is then responsible for freeing the
137buffers. In order to do this properly, a backpointer is added to the buffer
138before transmission that points to the skb. When the buffer returns to the
139driver on a confirmation FQ, the skb can be correctly consumed.
140
141DPAA Ethernet Features
142======================
143
144Currently the DPAA Ethernet driver enables the basic features required for
145a Linux Ethernet driver. The support for advanced features will be added
146gradually.
147
148The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
149checksum offload feature is enabled by default and cannot be controlled through
150ethtool.
151
152The driver has support for multiple prioritized Tx traffic classes. Priorities
153range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
154strict priority levels. Each traffic class contains NR_CPU TX queues. By
155default, only one traffic class is enabled and the lowest priority Tx queues
156are used. Higher priority traffic classes can be enabled with the mqprio
157qdisc. For example, all four traffic classes are enabled on an interface with
158the following command. Furthermore, skb priority levels are mapped to traffic
159classes as follows:
160
161 * priorities 0 to 3 - traffic class 0 (low priority)
162 * priorities 4 to 7 - traffic class 1 (medium-low priority)
163 * priorities 8 to 11 - traffic class 2 (medium-high priority)
164 * priorities 12 to 15 - traffic class 3 (high priority)
165
166tc qdisc add dev <int> root handle 1: \
167 mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
168
169Debugging
170=========
171
172The following statistics are exported for each interface through ethtool:
173
174 - interrupt count per CPU
175 - Rx packets count per CPU
176 - Tx packets count per CPU
177 - Tx confirmed packets count per CPU
178 - Tx S/G frames count per CPU
179 - Tx error count per CPU
180 - Rx error count per CPU
181 - Rx error count per type
182 - congestion related statistics:
183 - congestion status
184 - time spent in congestion
185 - number of time the device entered congestion
186 - dropped packets count per cause
187
188The driver also exports the following information in sysfs:
189
190 - the FQ IDs for each FQ type
191 /sys/devices/platform/dpaa-ethernet.0/net/<int>/fqids
192
193 - the IDs of the buffer pools in use
194 /sys/devices/platform/dpaa-ethernet.0/net/<int>/bpids
diff --git a/Documentation/networking/tcp.txt b/Documentation/networking/tcp.txt
index bdc4c0db51e1..9c7139d57e57 100644
--- a/Documentation/networking/tcp.txt
+++ b/Documentation/networking/tcp.txt
@@ -1,7 +1,7 @@
1TCP protocol 1TCP protocol
2============ 2============
3 3
4Last updated: 9 February 2008 4Last updated: 3 June 2017
5 5
6Contents 6Contents
7======== 7========
@@ -29,18 +29,19 @@ As of 2.6.13, Linux supports pluggable congestion control algorithms.
29A congestion control mechanism can be registered through functions in 29A congestion control mechanism can be registered through functions in
30tcp_cong.c. The functions used by the congestion control mechanism are 30tcp_cong.c. The functions used by the congestion control mechanism are
31registered via passing a tcp_congestion_ops struct to 31registered via passing a tcp_congestion_ops struct to
32tcp_register_congestion_control. As a minimum name, ssthresh, 32tcp_register_congestion_control. As a minimum, the congestion control
33cong_avoid must be valid. 33mechanism must provide a valid name and must implement either ssthresh,
34cong_avoid and undo_cwnd hooks or the "omnipotent" cong_control hook.
34 35
35Private data for a congestion control mechanism is stored in tp->ca_priv. 36Private data for a congestion control mechanism is stored in tp->ca_priv.
36tcp_ca(tp) returns a pointer to this space. This is preallocated space - it 37tcp_ca(tp) returns a pointer to this space. This is preallocated space - it
37is important to check the size of your private data will fit this space, or 38is important to check the size of your private data will fit this space, or
38alternatively space could be allocated elsewhere and a pointer to it could 39alternatively, space could be allocated elsewhere and a pointer to it could
39be stored here. 40be stored here.
40 41
41There are three kinds of congestion control algorithms currently: The 42There are three kinds of congestion control algorithms currently: The
42simplest ones are derived from TCP reno (highspeed, scalable) and just 43simplest ones are derived from TCP reno (highspeed, scalable) and just
43provide an alternative the congestion window calculation. More complex 44provide an alternative congestion window calculation. More complex
44ones like BIC try to look at other events to provide better 45ones like BIC try to look at other events to provide better
45heuristics. There are also round trip time based algorithms like 46heuristics. There are also round trip time based algorithms like
46Vegas and Westwood+. 47Vegas and Westwood+.
@@ -49,21 +50,15 @@ Good TCP congestion control is a complex problem because the algorithm
49needs to maintain fairness and performance. Please review current 50needs to maintain fairness and performance. Please review current
50research and RFC's before developing new modules. 51research and RFC's before developing new modules.
51 52
52The method that is used to determine which congestion control mechanism is 53The default congestion control mechanism is chosen based on the
53determined by the setting of the sysctl net.ipv4.tcp_congestion_control. 54DEFAULT_TCP_CONG Kconfig parameter. If you really want a particular default
54The default congestion control will be the last one registered (LIFO); 55value then you can set it using sysctl net.ipv4.tcp_congestion_control. The
55so if you built everything as modules, the default will be reno. If you 56module will be autoloaded if needed and you will get the expected protocol. If
56build with the defaults from Kconfig, then CUBIC will be builtin (not a 57you ask for an unknown congestion method, then the sysctl attempt will fail.
57module) and it will end up the default.
58 58
59If you really want a particular default value then you will need 59If you remove a TCP congestion control module, then you will get the next
60to set it with the sysctl. If you use a sysctl, the module will be autoloaded
61if needed and you will get the expected protocol. If you ask for an
62unknown congestion method, then the sysctl attempt will fail.
63
64If you remove a tcp congestion control module, then you will get the next
65available one. Since reno cannot be built as a module, and cannot be 60available one. Since reno cannot be built as a module, and cannot be
66deleted, it will always be available. 61removed, it will always be available.
67 62
68How the new TCP output machine [nyi] works. 63How the new TCP output machine [nyi] works.
69=========================================== 64===========================================
diff --git a/MAINTAINERS b/MAINTAINERS
index 7a28acd7f525..fb60bf6dfead 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8508,7 +8508,7 @@ S: Odd Fixes
8508F: drivers/media/radio/radio-miropcm20* 8508F: drivers/media/radio/radio-miropcm20*
8509 8509
8510MELLANOX MLX4 core VPI driver 8510MELLANOX MLX4 core VPI driver
8511M: Yishai Hadas <yishaih@mellanox.com> 8511M: Tariq Toukan <tariqt@mellanox.com>
8512L: netdev@vger.kernel.org 8512L: netdev@vger.kernel.org
8513L: linux-rdma@vger.kernel.org 8513L: linux-rdma@vger.kernel.org
8514W: http://www.mellanox.com 8514W: http://www.mellanox.com
@@ -8516,7 +8516,6 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/
8516S: Supported 8516S: Supported
8517F: drivers/net/ethernet/mellanox/mlx4/ 8517F: drivers/net/ethernet/mellanox/mlx4/
8518F: include/linux/mlx4/ 8518F: include/linux/mlx4/
8519F: include/uapi/rdma/mlx4-abi.h
8520 8519
8521MELLANOX MLX4 IB driver 8520MELLANOX MLX4 IB driver
8522M: Yishai Hadas <yishaih@mellanox.com> 8521M: Yishai Hadas <yishaih@mellanox.com>
@@ -8526,6 +8525,7 @@ Q: http://patchwork.kernel.org/project/linux-rdma/list/
8526S: Supported 8525S: Supported
8527F: drivers/infiniband/hw/mlx4/ 8526F: drivers/infiniband/hw/mlx4/
8528F: include/linux/mlx4/ 8527F: include/linux/mlx4/
8528F: include/uapi/rdma/mlx4-abi.h
8529 8529
8530MELLANOX MLX5 core VPI driver 8530MELLANOX MLX5 core VPI driver
8531M: Saeed Mahameed <saeedm@mellanox.com> 8531M: Saeed Mahameed <saeedm@mellanox.com>
@@ -8538,7 +8538,6 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/
8538S: Supported 8538S: Supported
8539F: drivers/net/ethernet/mellanox/mlx5/core/ 8539F: drivers/net/ethernet/mellanox/mlx5/core/
8540F: include/linux/mlx5/ 8540F: include/linux/mlx5/
8541F: include/uapi/rdma/mlx5-abi.h
8542 8541
8543MELLANOX MLX5 IB driver 8542MELLANOX MLX5 IB driver
8544M: Matan Barak <matanb@mellanox.com> 8543M: Matan Barak <matanb@mellanox.com>
@@ -8549,6 +8548,7 @@ Q: http://patchwork.kernel.org/project/linux-rdma/list/
8549S: Supported 8548S: Supported
8550F: drivers/infiniband/hw/mlx5/ 8549F: drivers/infiniband/hw/mlx5/
8551F: include/linux/mlx5/ 8550F: include/linux/mlx5/
8551F: include/uapi/rdma/mlx5-abi.h
8552 8552
8553MELEXIS MLX90614 DRIVER 8553MELEXIS MLX90614 DRIVER
8554M: Crt Mori <cmo@melexis.com> 8554M: Crt Mori <cmo@melexis.com>
diff --git a/arch/arm/boot/dts/imx6ul-14x14-evk.dts b/arch/arm/boot/dts/imx6ul-14x14-evk.dts
index f18e1f1d0ce2..d2be8aa3370b 100644
--- a/arch/arm/boot/dts/imx6ul-14x14-evk.dts
+++ b/arch/arm/boot/dts/imx6ul-14x14-evk.dts
@@ -120,10 +120,16 @@
120 120
121 ethphy0: ethernet-phy@2 { 121 ethphy0: ethernet-phy@2 {
122 reg = <2>; 122 reg = <2>;
123 micrel,led-mode = <1>;
124 clocks = <&clks IMX6UL_CLK_ENET_REF>;
125 clock-names = "rmii-ref";
123 }; 126 };
124 127
125 ethphy1: ethernet-phy@1 { 128 ethphy1: ethernet-phy@1 {
126 reg = <1>; 129 reg = <1>;
130 micrel,led-mode = <1>;
131 clocks = <&clks IMX6UL_CLK_ENET2_REF>;
132 clock-names = "rmii-ref";
127 }; 133 };
128 }; 134 };
129}; 135};
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index d07dd5196ffc..8aa158a09180 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -2364,7 +2364,7 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s
2364 id); 2364 id);
2365 return NULL; 2365 return NULL;
2366 } else { 2366 } else {
2367 rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); 2367 rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_ATOMIC);
2368 if (!rs) 2368 if (!rs)
2369 return NULL; 2369 return NULL;
2370 rs->state = CCPResetIdle; 2370 rs->state = CCPResetIdle;
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c
index 8b7faea2ddf8..422dced7c90a 100644
--- a/drivers/isdn/mISDN/stack.c
+++ b/drivers/isdn/mISDN/stack.c
@@ -75,7 +75,7 @@ send_socklist(struct mISDN_sock_list *sl, struct sk_buff *skb)
75 if (sk->sk_state != MISDN_BOUND) 75 if (sk->sk_state != MISDN_BOUND)
76 continue; 76 continue;
77 if (!cskb) 77 if (!cskb)
78 cskb = skb_copy(skb, GFP_KERNEL); 78 cskb = skb_copy(skb, GFP_ATOMIC);
79 if (!cskb) { 79 if (!cskb) {
80 printk(KERN_WARNING "%s no skb\n", __func__); 80 printk(KERN_WARNING "%s no skb\n", __func__);
81 break; 81 break;
diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h
index 96046bb12ca1..14c0be98e0a4 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.h
+++ b/drivers/net/dsa/mv88e6xxx/global2.h
@@ -114,13 +114,13 @@ static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
114 return -EOPNOTSUPP; 114 return -EOPNOTSUPP;
115} 115}
116 116
117int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev, 117static inline int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip,
118 int src_port, u16 data) 118 int src_dev, int src_port, u16 data)
119{ 119{
120 return -EOPNOTSUPP; 120 return -EOPNOTSUPP;
121} 121}
122 122
123int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) 123static inline int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip)
124{ 124{
125 return -EOPNOTSUPP; 125 return -EOPNOTSUPP;
126} 126}
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
index b3bc87fe3764..0a98c369df20 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
@@ -324,7 +324,7 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
324 struct xgbe_ring *ring, 324 struct xgbe_ring *ring,
325 struct xgbe_ring_data *rdata) 325 struct xgbe_ring_data *rdata)
326{ 326{
327 int order, ret; 327 int ret;
328 328
329 if (!ring->rx_hdr_pa.pages) { 329 if (!ring->rx_hdr_pa.pages) {
330 ret = xgbe_alloc_pages(pdata, &ring->rx_hdr_pa, GFP_ATOMIC, 0); 330 ret = xgbe_alloc_pages(pdata, &ring->rx_hdr_pa, GFP_ATOMIC, 0);
@@ -333,9 +333,8 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
333 } 333 }
334 334
335 if (!ring->rx_buf_pa.pages) { 335 if (!ring->rx_buf_pa.pages) {
336 order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0);
337 ret = xgbe_alloc_pages(pdata, &ring->rx_buf_pa, GFP_ATOMIC, 336 ret = xgbe_alloc_pages(pdata, &ring->rx_buf_pa, GFP_ATOMIC,
338 order); 337 PAGE_ALLOC_COSTLY_ORDER);
339 if (ret) 338 if (ret)
340 return ret; 339 return ret;
341 } 340 }
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 099b374c1b17..5274501428e4 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2026,9 +2026,12 @@ static int bcm_sysport_probe(struct platform_device *pdev)
2026 priv->num_rx_desc_words = params->num_rx_desc_words; 2026 priv->num_rx_desc_words = params->num_rx_desc_words;
2027 2027
2028 priv->irq0 = platform_get_irq(pdev, 0); 2028 priv->irq0 = platform_get_irq(pdev, 0);
2029 if (!priv->is_lite) 2029 if (!priv->is_lite) {
2030 priv->irq1 = platform_get_irq(pdev, 1); 2030 priv->irq1 = platform_get_irq(pdev, 1);
2031 priv->wol_irq = platform_get_irq(pdev, 2); 2031 priv->wol_irq = platform_get_irq(pdev, 2);
2032 } else {
2033 priv->wol_irq = platform_get_irq(pdev, 1);
2034 }
2032 if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) { 2035 if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) {
2033 dev_err(&pdev->dev, "invalid interrupts\n"); 2036 dev_err(&pdev->dev, "invalid interrupts\n");
2034 ret = -EINVAL; 2037 ret = -EINVAL;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index eccb3d1b6abb..5f49334dcad5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -1926,7 +1926,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
1926 } 1926 }
1927 1927
1928 /* select a non-FCoE queue */ 1928 /* select a non-FCoE queue */
1929 return fallback(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp); 1929 return fallback(dev, skb) % (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos);
1930} 1930}
1931 1931
1932void bnx2x_set_num_queues(struct bnx2x *bp) 1932void bnx2x_set_num_queues(struct bnx2x *bp)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 38a5c6764bb5..77ed2f628f9c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2196,10 +2196,14 @@ static int cxgb_up(struct adapter *adap)
2196 if (err) 2196 if (err)
2197 goto irq_err; 2197 goto irq_err;
2198 } 2198 }
2199
2200 mutex_lock(&uld_mutex);
2199 enable_rx(adap); 2201 enable_rx(adap);
2200 t4_sge_start(adap); 2202 t4_sge_start(adap);
2201 t4_intr_enable(adap); 2203 t4_intr_enable(adap);
2202 adap->flags |= FULL_INIT_DONE; 2204 adap->flags |= FULL_INIT_DONE;
2205 mutex_unlock(&uld_mutex);
2206
2203 notify_ulds(adap, CXGB4_STATE_UP); 2207 notify_ulds(adap, CXGB4_STATE_UP);
2204#if IS_ENABLED(CONFIG_IPV6) 2208#if IS_ENABLED(CONFIG_IPV6)
2205 update_clip(adap); 2209 update_clip(adap);
@@ -2771,6 +2775,9 @@ void t4_fatal_err(struct adapter *adap)
2771{ 2775{
2772 int port; 2776 int port;
2773 2777
2778 if (pci_channel_offline(adap->pdev))
2779 return;
2780
2774 /* Disable the SGE since ULDs are going to free resources that 2781 /* Disable the SGE since ULDs are going to free resources that
2775 * could be exposed to the adapter. RDMA MWs for example... 2782 * could be exposed to the adapter. RDMA MWs for example...
2776 */ 2783 */
@@ -3882,9 +3889,10 @@ static pci_ers_result_t eeh_err_detected(struct pci_dev *pdev,
3882 spin_lock(&adap->stats_lock); 3889 spin_lock(&adap->stats_lock);
3883 for_each_port(adap, i) { 3890 for_each_port(adap, i) {
3884 struct net_device *dev = adap->port[i]; 3891 struct net_device *dev = adap->port[i];
3885 3892 if (dev) {
3886 netif_device_detach(dev); 3893 netif_device_detach(dev);
3887 netif_carrier_off(dev); 3894 netif_carrier_off(dev);
3895 }
3888 } 3896 }
3889 spin_unlock(&adap->stats_lock); 3897 spin_unlock(&adap->stats_lock);
3890 disable_interrupts(adap); 3898 disable_interrupts(adap);
@@ -3963,12 +3971,13 @@ static void eeh_resume(struct pci_dev *pdev)
3963 rtnl_lock(); 3971 rtnl_lock();
3964 for_each_port(adap, i) { 3972 for_each_port(adap, i) {
3965 struct net_device *dev = adap->port[i]; 3973 struct net_device *dev = adap->port[i];
3966 3974 if (dev) {
3967 if (netif_running(dev)) { 3975 if (netif_running(dev)) {
3968 link_start(dev); 3976 link_start(dev);
3969 cxgb_set_rxmode(dev); 3977 cxgb_set_rxmode(dev);
3978 }
3979 netif_device_attach(dev);
3970 } 3980 }
3971 netif_device_attach(dev);
3972 } 3981 }
3973 rtnl_unlock(); 3982 rtnl_unlock();
3974} 3983}
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index aded42b96f6d..3a34aa629f7d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -4557,8 +4557,13 @@ void t4_intr_enable(struct adapter *adapter)
4557 */ 4557 */
4558void t4_intr_disable(struct adapter *adapter) 4558void t4_intr_disable(struct adapter *adapter)
4559{ 4559{
4560 u32 whoami = t4_read_reg(adapter, PL_WHOAMI_A); 4560 u32 whoami, pf;
4561 u32 pf = CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5 ? 4561
4562 if (pci_channel_offline(adapter->pdev))
4563 return;
4564
4565 whoami = t4_read_reg(adapter, PL_WHOAMI_A);
4566 pf = CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5 ?
4562 SOURCEPF_G(whoami) : T6_SOURCEPF_G(whoami); 4567 SOURCEPF_G(whoami) : T6_SOURCEPF_G(whoami);
4563 4568
4564 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE_A), 0); 4569 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE_A), 0);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h
index 3549d3876278..f2d623a7aee0 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h
@@ -37,7 +37,7 @@
37 37
38#define T4FW_VERSION_MAJOR 0x01 38#define T4FW_VERSION_MAJOR 0x01
39#define T4FW_VERSION_MINOR 0x10 39#define T4FW_VERSION_MINOR 0x10
40#define T4FW_VERSION_MICRO 0x2B 40#define T4FW_VERSION_MICRO 0x2D
41#define T4FW_VERSION_BUILD 0x00 41#define T4FW_VERSION_BUILD 0x00
42 42
43#define T4FW_MIN_VERSION_MAJOR 0x01 43#define T4FW_MIN_VERSION_MAJOR 0x01
@@ -46,7 +46,7 @@
46 46
47#define T5FW_VERSION_MAJOR 0x01 47#define T5FW_VERSION_MAJOR 0x01
48#define T5FW_VERSION_MINOR 0x10 48#define T5FW_VERSION_MINOR 0x10
49#define T5FW_VERSION_MICRO 0x2B 49#define T5FW_VERSION_MICRO 0x2D
50#define T5FW_VERSION_BUILD 0x00 50#define T5FW_VERSION_BUILD 0x00
51 51
52#define T5FW_MIN_VERSION_MAJOR 0x00 52#define T5FW_MIN_VERSION_MAJOR 0x00
@@ -55,7 +55,7 @@
55 55
56#define T6FW_VERSION_MAJOR 0x01 56#define T6FW_VERSION_MAJOR 0x01
57#define T6FW_VERSION_MINOR 0x10 57#define T6FW_VERSION_MINOR 0x10
58#define T6FW_VERSION_MICRO 0x2B 58#define T6FW_VERSION_MICRO 0x2D
59#define T6FW_VERSION_BUILD 0x00 59#define T6FW_VERSION_BUILD 0x00
60 60
61#define T6FW_MIN_VERSION_MAJOR 0x00 61#define T6FW_MIN_VERSION_MAJOR 0x00
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index e863ba74d005..8bb0db990c8f 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -739,6 +739,8 @@ static int ethoc_open(struct net_device *dev)
739 if (ret) 739 if (ret)
740 return ret; 740 return ret;
741 741
742 napi_enable(&priv->napi);
743
742 ethoc_init_ring(priv, dev->mem_start); 744 ethoc_init_ring(priv, dev->mem_start);
743 ethoc_reset(priv); 745 ethoc_reset(priv);
744 746
@@ -754,7 +756,6 @@ static int ethoc_open(struct net_device *dev)
754 priv->old_duplex = -1; 756 priv->old_duplex = -1;
755 757
756 phy_start(dev->phydev); 758 phy_start(dev->phydev);
757 napi_enable(&priv->napi);
758 759
759 if (netif_msg_ifup(priv)) { 760 if (netif_msg_ifup(priv)) {
760 dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n", 761 dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n",
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 446c7b374ff5..a10de1e9c157 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -381,7 +381,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
381{ 381{
382 const struct of_device_id *id = 382 const struct of_device_id *id =
383 of_match_device(fsl_pq_mdio_match, &pdev->dev); 383 of_match_device(fsl_pq_mdio_match, &pdev->dev);
384 const struct fsl_pq_mdio_data *data = id->data; 384 const struct fsl_pq_mdio_data *data;
385 struct device_node *np = pdev->dev.of_node; 385 struct device_node *np = pdev->dev.of_node;
386 struct resource res; 386 struct resource res;
387 struct device_node *tbi; 387 struct device_node *tbi;
@@ -389,6 +389,13 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
389 struct mii_bus *new_bus; 389 struct mii_bus *new_bus;
390 int err; 390 int err;
391 391
392 if (!id) {
393 dev_err(&pdev->dev, "Failed to match device\n");
394 return -ENODEV;
395 }
396
397 data = id->data;
398
392 dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible); 399 dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible);
393 400
394 new_bus = mdiobus_alloc_size(sizeof(*priv)); 401 new_bus = mdiobus_alloc_size(sizeof(*priv));
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 4f2d329dba99..a93757c255f7 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -81,7 +81,7 @@
81static const char ibmvnic_driver_name[] = "ibmvnic"; 81static const char ibmvnic_driver_name[] = "ibmvnic";
82static const char ibmvnic_driver_string[] = "IBM System i/p Virtual NIC Driver"; 82static const char ibmvnic_driver_string[] = "IBM System i/p Virtual NIC Driver";
83 83
84MODULE_AUTHOR("Santiago Leon <santi_leon@yahoo.com>"); 84MODULE_AUTHOR("Santiago Leon");
85MODULE_DESCRIPTION("IBM System i/p Virtual NIC Driver"); 85MODULE_DESCRIPTION("IBM System i/p Virtual NIC Driver");
86MODULE_LICENSE("GPL"); 86MODULE_LICENSE("GPL");
87MODULE_VERSION(IBMVNIC_DRIVER_VERSION); 87MODULE_VERSION(IBMVNIC_DRIVER_VERSION);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index d5c9c9e06ff5..150caf6ca2b4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -295,7 +295,7 @@ struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id)
295 **/ 295 **/
296void i40e_service_event_schedule(struct i40e_pf *pf) 296void i40e_service_event_schedule(struct i40e_pf *pf)
297{ 297{
298 if (!test_bit(__I40E_VSI_DOWN, pf->state) && 298 if (!test_bit(__I40E_DOWN, pf->state) &&
299 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) 299 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
300 queue_work(i40e_wq, &pf->service_task); 300 queue_work(i40e_wq, &pf->service_task);
301} 301}
@@ -3611,7 +3611,7 @@ static irqreturn_t i40e_intr(int irq, void *data)
3611 * this is not a performance path and napi_schedule() 3611 * this is not a performance path and napi_schedule()
3612 * can deal with rescheduling. 3612 * can deal with rescheduling.
3613 */ 3613 */
3614 if (!test_bit(__I40E_VSI_DOWN, pf->state)) 3614 if (!test_bit(__I40E_DOWN, pf->state))
3615 napi_schedule_irqoff(&q_vector->napi); 3615 napi_schedule_irqoff(&q_vector->napi);
3616 } 3616 }
3617 3617
@@ -3687,7 +3687,7 @@ static irqreturn_t i40e_intr(int irq, void *data)
3687enable_intr: 3687enable_intr:
3688 /* re-enable interrupt causes */ 3688 /* re-enable interrupt causes */
3689 wr32(hw, I40E_PFINT_ICR0_ENA, ena_mask); 3689 wr32(hw, I40E_PFINT_ICR0_ENA, ena_mask);
3690 if (!test_bit(__I40E_VSI_DOWN, pf->state)) { 3690 if (!test_bit(__I40E_DOWN, pf->state)) {
3691 i40e_service_event_schedule(pf); 3691 i40e_service_event_schedule(pf);
3692 i40e_irq_dynamic_enable_icr0(pf, false); 3692 i40e_irq_dynamic_enable_icr0(pf, false);
3693 } 3693 }
@@ -6203,7 +6203,7 @@ static void i40e_fdir_reinit_subtask(struct i40e_pf *pf)
6203{ 6203{
6204 6204
6205 /* if interface is down do nothing */ 6205 /* if interface is down do nothing */
6206 if (test_bit(__I40E_VSI_DOWN, pf->state)) 6206 if (test_bit(__I40E_DOWN, pf->state))
6207 return; 6207 return;
6208 6208
6209 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) 6209 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state))
@@ -6344,7 +6344,7 @@ static void i40e_watchdog_subtask(struct i40e_pf *pf)
6344 int i; 6344 int i;
6345 6345
6346 /* if interface is down do nothing */ 6346 /* if interface is down do nothing */
6347 if (test_bit(__I40E_VSI_DOWN, pf->state) || 6347 if (test_bit(__I40E_DOWN, pf->state) ||
6348 test_bit(__I40E_CONFIG_BUSY, pf->state)) 6348 test_bit(__I40E_CONFIG_BUSY, pf->state))
6349 return; 6349 return;
6350 6350
@@ -6399,9 +6399,9 @@ static void i40e_reset_subtask(struct i40e_pf *pf)
6399 reset_flags |= BIT(__I40E_GLOBAL_RESET_REQUESTED); 6399 reset_flags |= BIT(__I40E_GLOBAL_RESET_REQUESTED);
6400 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); 6400 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state);
6401 } 6401 }
6402 if (test_bit(__I40E_VSI_DOWN_REQUESTED, pf->state)) { 6402 if (test_bit(__I40E_DOWN_REQUESTED, pf->state)) {
6403 reset_flags |= BIT(__I40E_VSI_DOWN_REQUESTED); 6403 reset_flags |= BIT(__I40E_DOWN_REQUESTED);
6404 clear_bit(__I40E_VSI_DOWN_REQUESTED, pf->state); 6404 clear_bit(__I40E_DOWN_REQUESTED, pf->state);
6405 } 6405 }
6406 6406
6407 /* If there's a recovery already waiting, it takes 6407 /* If there's a recovery already waiting, it takes
@@ -6415,7 +6415,7 @@ static void i40e_reset_subtask(struct i40e_pf *pf)
6415 6415
6416 /* If we're already down or resetting, just bail */ 6416 /* If we're already down or resetting, just bail */
6417 if (reset_flags && 6417 if (reset_flags &&
6418 !test_bit(__I40E_VSI_DOWN, pf->state) && 6418 !test_bit(__I40E_DOWN, pf->state) &&
6419 !test_bit(__I40E_CONFIG_BUSY, pf->state)) { 6419 !test_bit(__I40E_CONFIG_BUSY, pf->state)) {
6420 rtnl_lock(); 6420 rtnl_lock();
6421 i40e_do_reset(pf, reset_flags, true); 6421 i40e_do_reset(pf, reset_flags, true);
@@ -7002,7 +7002,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
7002 u32 val; 7002 u32 val;
7003 int v; 7003 int v;
7004 7004
7005 if (test_bit(__I40E_VSI_DOWN, pf->state)) 7005 if (test_bit(__I40E_DOWN, pf->state))
7006 goto clear_recovery; 7006 goto clear_recovery;
7007 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); 7007 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n");
7008 7008
@@ -9767,7 +9767,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
9767 return -ENODEV; 9767 return -ENODEV;
9768 } 9768 }
9769 if (vsi == pf->vsi[pf->lan_vsi] && 9769 if (vsi == pf->vsi[pf->lan_vsi] &&
9770 !test_bit(__I40E_VSI_DOWN, pf->state)) { 9770 !test_bit(__I40E_DOWN, pf->state)) {
9771 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n"); 9771 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n");
9772 return -ENODEV; 9772 return -ENODEV;
9773 } 9773 }
@@ -11003,7 +11003,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11003 } 11003 }
11004 pf->next_vsi = 0; 11004 pf->next_vsi = 0;
11005 pf->pdev = pdev; 11005 pf->pdev = pdev;
11006 set_bit(__I40E_VSI_DOWN, pf->state); 11006 set_bit(__I40E_DOWN, pf->state);
11007 11007
11008 hw = &pf->hw; 11008 hw = &pf->hw;
11009 hw->back = pf; 11009 hw->back = pf;
@@ -11293,7 +11293,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11293 * before setting up the misc vector or we get a race and the vector 11293 * before setting up the misc vector or we get a race and the vector
11294 * ends up disabled forever. 11294 * ends up disabled forever.
11295 */ 11295 */
11296 clear_bit(__I40E_VSI_DOWN, pf->state); 11296 clear_bit(__I40E_DOWN, pf->state);
11297 11297
11298 /* In case of MSIX we are going to setup the misc vector right here 11298 /* In case of MSIX we are going to setup the misc vector right here
11299 * to handle admin queue events etc. In case of legacy and MSI 11299 * to handle admin queue events etc. In case of legacy and MSI
@@ -11448,7 +11448,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11448 11448
11449 /* Unwind what we've done if something failed in the setup */ 11449 /* Unwind what we've done if something failed in the setup */
11450err_vsis: 11450err_vsis:
11451 set_bit(__I40E_VSI_DOWN, pf->state); 11451 set_bit(__I40E_DOWN, pf->state);
11452 i40e_clear_interrupt_scheme(pf); 11452 i40e_clear_interrupt_scheme(pf);
11453 kfree(pf->vsi); 11453 kfree(pf->vsi);
11454err_switch_setup: 11454err_switch_setup:
@@ -11500,7 +11500,7 @@ static void i40e_remove(struct pci_dev *pdev)
11500 11500
11501 /* no more scheduling of any task */ 11501 /* no more scheduling of any task */
11502 set_bit(__I40E_SUSPENDED, pf->state); 11502 set_bit(__I40E_SUSPENDED, pf->state);
11503 set_bit(__I40E_VSI_DOWN, pf->state); 11503 set_bit(__I40E_DOWN, pf->state);
11504 if (pf->service_timer.data) 11504 if (pf->service_timer.data)
11505 del_timer_sync(&pf->service_timer); 11505 del_timer_sync(&pf->service_timer);
11506 if (pf->service_task.func) 11506 if (pf->service_task.func)
@@ -11740,7 +11740,7 @@ static void i40e_shutdown(struct pci_dev *pdev)
11740 struct i40e_hw *hw = &pf->hw; 11740 struct i40e_hw *hw = &pf->hw;
11741 11741
11742 set_bit(__I40E_SUSPENDED, pf->state); 11742 set_bit(__I40E_SUSPENDED, pf->state);
11743 set_bit(__I40E_VSI_DOWN, pf->state); 11743 set_bit(__I40E_DOWN, pf->state);
11744 rtnl_lock(); 11744 rtnl_lock();
11745 i40e_prep_for_reset(pf, true); 11745 i40e_prep_for_reset(pf, true);
11746 rtnl_unlock(); 11746 rtnl_unlock();
@@ -11789,7 +11789,7 @@ static int i40e_suspend(struct pci_dev *pdev, pm_message_t state)
11789 int retval = 0; 11789 int retval = 0;
11790 11790
11791 set_bit(__I40E_SUSPENDED, pf->state); 11791 set_bit(__I40E_SUSPENDED, pf->state);
11792 set_bit(__I40E_VSI_DOWN, pf->state); 11792 set_bit(__I40E_DOWN, pf->state);
11793 11793
11794 if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE)) 11794 if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE))
11795 i40e_enable_mc_magic_wake(pf); 11795 i40e_enable_mc_magic_wake(pf);
@@ -11841,7 +11841,7 @@ static int i40e_resume(struct pci_dev *pdev)
11841 11841
11842 /* handling the reset will rebuild the device state */ 11842 /* handling the reset will rebuild the device state */
11843 if (test_and_clear_bit(__I40E_SUSPENDED, pf->state)) { 11843 if (test_and_clear_bit(__I40E_SUSPENDED, pf->state)) {
11844 clear_bit(__I40E_VSI_DOWN, pf->state); 11844 clear_bit(__I40E_DOWN, pf->state);
11845 rtnl_lock(); 11845 rtnl_lock();
11846 i40e_reset_and_rebuild(pf, false, true); 11846 i40e_reset_and_rebuild(pf, false, true);
11847 rtnl_unlock(); 11847 rtnl_unlock();
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 29321a6167a6..cd894f4023b1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1854,7 +1854,8 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,
1854#if (PAGE_SIZE < 8192) 1854#if (PAGE_SIZE < 8192)
1855 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; 1855 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2;
1856#else 1856#else
1857 unsigned int truesize = SKB_DATA_ALIGN(size); 1857 unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
1858 SKB_DATA_ALIGN(I40E_SKB_PAD + size);
1858#endif 1859#endif
1859 struct sk_buff *skb; 1860 struct sk_buff *skb;
1860 1861
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index dfe241a12ad0..12b02e530503 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1190,7 +1190,8 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,
1190#if (PAGE_SIZE < 8192) 1190#if (PAGE_SIZE < 8192)
1191 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; 1191 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2;
1192#else 1192#else
1193 unsigned int truesize = SKB_DATA_ALIGN(size); 1193 unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
1194 SKB_DATA_ALIGN(I40E_SKB_PAD + size);
1194#endif 1195#endif
1195 struct sk_buff *skb; 1196 struct sk_buff *skb;
1196 1197
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ae5fdc2df654..ffbcb27c05e5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1562,11 +1562,6 @@ static int mlx4_en_flow_replace(struct net_device *dev,
1562 qpn = priv->drop_qp.qpn; 1562 qpn = priv->drop_qp.qpn;
1563 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { 1563 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
1564 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); 1564 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
1565 if (qpn < priv->rss_map.base_qpn ||
1566 qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) {
1567 en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn);
1568 return -EINVAL;
1569 }
1570 } else { 1565 } else {
1571 if (cmd->fs.ring_cookie >= priv->rx_ring_num) { 1566 if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
1572 en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n", 1567 en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index 1a670b681555..0710b3677464 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -35,6 +35,7 @@
35#include <linux/etherdevice.h> 35#include <linux/etherdevice.h>
36 36
37#include <linux/mlx4/cmd.h> 37#include <linux/mlx4/cmd.h>
38#include <linux/mlx4/qp.h>
38#include <linux/export.h> 39#include <linux/export.h>
39 40
40#include "mlx4.h" 41#include "mlx4.h"
@@ -985,16 +986,21 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
985 if (IS_ERR(mailbox)) 986 if (IS_ERR(mailbox))
986 return PTR_ERR(mailbox); 987 return PTR_ERR(mailbox);
987 988
989 if (!mlx4_qp_lookup(dev, rule->qpn)) {
990 mlx4_err_rule(dev, "QP doesn't exist\n", rule);
991 ret = -EINVAL;
992 goto out;
993 }
994
988 trans_rule_ctrl_to_hw(rule, mailbox->buf); 995 trans_rule_ctrl_to_hw(rule, mailbox->buf);
989 996
990 size += sizeof(struct mlx4_net_trans_rule_hw_ctrl); 997 size += sizeof(struct mlx4_net_trans_rule_hw_ctrl);
991 998
992 list_for_each_entry(cur, &rule->list, list) { 999 list_for_each_entry(cur, &rule->list, list) {
993 ret = parse_trans_rule(dev, cur, mailbox->buf + size); 1000 ret = parse_trans_rule(dev, cur, mailbox->buf + size);
994 if (ret < 0) { 1001 if (ret < 0)
995 mlx4_free_cmd_mailbox(dev, mailbox); 1002 goto out;
996 return ret; 1003
997 }
998 size += ret; 1004 size += ret;
999 } 1005 }
1000 1006
@@ -1021,6 +1027,7 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
1021 } 1027 }
1022 } 1028 }
1023 1029
1030out:
1024 mlx4_free_cmd_mailbox(dev, mailbox); 1031 mlx4_free_cmd_mailbox(dev, mailbox);
1025 1032
1026 return ret; 1033 return ret;
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 2d6abd4662b1..5a310d313e94 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -384,6 +384,19 @@ static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn)
384 __mlx4_qp_free_icm(dev, qpn); 384 __mlx4_qp_free_icm(dev, qpn);
385} 385}
386 386
387struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
388{
389 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
390 struct mlx4_qp *qp;
391
392 spin_lock(&qp_table->lock);
393
394 qp = __mlx4_qp_lookup(dev, qpn);
395
396 spin_unlock(&qp_table->lock);
397 return qp;
398}
399
387int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp) 400int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp)
388{ 401{
389 struct mlx4_priv *priv = mlx4_priv(dev); 402 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -471,6 +484,12 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
471 } 484 }
472 485
473 if (attr & MLX4_UPDATE_QP_QOS_VPORT) { 486 if (attr & MLX4_UPDATE_QP_QOS_VPORT) {
487 if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_QOS_VPP)) {
488 mlx4_warn(dev, "Granular QoS per VF is not enabled\n");
489 err = -EOPNOTSUPP;
490 goto out;
491 }
492
474 qp_mask |= 1ULL << MLX4_UPD_QP_MASK_QOS_VPP; 493 qp_mask |= 1ULL << MLX4_UPD_QP_MASK_QOS_VPP;
475 cmd->qp_context.qos_vport = params->qos_vport; 494 cmd->qp_context.qos_vport = params->qos_vport;
476 } 495 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 07516545474f..812783865205 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -5255,6 +5255,13 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave)
5255 mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); 5255 mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex);
5256} 5256}
5257 5257
5258static void update_qos_vpp(struct mlx4_update_qp_context *ctx,
5259 struct mlx4_vf_immed_vlan_work *work)
5260{
5261 ctx->qp_mask |= cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_QOS_VPP);
5262 ctx->qp_context.qos_vport = work->qos_vport;
5263}
5264
5258void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work) 5265void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
5259{ 5266{
5260 struct mlx4_vf_immed_vlan_work *work = 5267 struct mlx4_vf_immed_vlan_work *work =
@@ -5369,11 +5376,10 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
5369 qp->sched_queue & 0xC7; 5376 qp->sched_queue & 0xC7;
5370 upd_context->qp_context.pri_path.sched_queue |= 5377 upd_context->qp_context.pri_path.sched_queue |=
5371 ((work->qos & 0x7) << 3); 5378 ((work->qos & 0x7) << 3);
5372 upd_context->qp_mask |= 5379
5373 cpu_to_be64(1ULL << 5380 if (dev->caps.flags2 &
5374 MLX4_UPD_QP_MASK_QOS_VPP); 5381 MLX4_DEV_CAP_FLAG2_QOS_VPP)
5375 upd_context->qp_context.qos_vport = 5382 update_qos_vpp(upd_context, work);
5376 work->qos_vport;
5377 } 5383 }
5378 5384
5379 err = mlx4_cmd(dev, mailbox->dma, 5385 err = mlx4_cmd(dev, mailbox->dma,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index fe5546bb4153..af945edfee19 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -621,10 +621,9 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
621 cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node), 621 cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
622 priv->irq_info[i].mask); 622 priv->irq_info[i].mask);
623 623
624#ifdef CONFIG_SMP 624 if (IS_ENABLED(CONFIG_SMP) &&
625 if (irq_set_affinity_hint(irq, priv->irq_info[i].mask)) 625 irq_set_affinity_hint(irq, priv->irq_info[i].mask))
626 mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", irq); 626 mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", irq);
627#endif
628 627
629 return 0; 628 return 0;
630} 629}
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 537d1236a4fe..715b3aaf83ac 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -1730,7 +1730,8 @@ void qed_get_protocol_stats(struct qed_dev *cdev,
1730 qed_get_protocol_stats_iscsi(cdev, &stats->iscsi_stats); 1730 qed_get_protocol_stats_iscsi(cdev, &stats->iscsi_stats);
1731 break; 1731 break;
1732 default: 1732 default:
1733 DP_ERR(cdev, "Invalid protocol type = %d\n", type); 1733 DP_VERBOSE(cdev, QED_MSG_SP,
1734 "Invalid protocol type = %d\n", type);
1734 return; 1735 return;
1735 } 1736 }
1736} 1737}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 7245b1072518..81312924df14 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1824,22 +1824,44 @@ struct qlcnic_hardware_ops {
1824 u32 (*get_cap_size)(void *, int); 1824 u32 (*get_cap_size)(void *, int);
1825 void (*set_sys_info)(void *, int, u32); 1825 void (*set_sys_info)(void *, int, u32);
1826 void (*store_cap_mask)(void *, u32); 1826 void (*store_cap_mask)(void *, u32);
1827 bool (*encap_rx_offload) (struct qlcnic_adapter *adapter);
1828 bool (*encap_tx_offload) (struct qlcnic_adapter *adapter);
1827}; 1829};
1828 1830
1829extern struct qlcnic_nic_template qlcnic_vf_ops; 1831extern struct qlcnic_nic_template qlcnic_vf_ops;
1830 1832
1831static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter) 1833static inline bool qlcnic_83xx_encap_tx_offload(struct qlcnic_adapter *adapter)
1832{ 1834{
1833 return adapter->ahw->extra_capability[0] & 1835 return adapter->ahw->extra_capability[0] &
1834 QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD; 1836 QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD;
1835} 1837}
1836 1838
1837static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter) 1839static inline bool qlcnic_83xx_encap_rx_offload(struct qlcnic_adapter *adapter)
1838{ 1840{
1839 return adapter->ahw->extra_capability[0] & 1841 return adapter->ahw->extra_capability[0] &
1840 QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD; 1842 QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD;
1841} 1843}
1842 1844
1845static inline bool qlcnic_82xx_encap_tx_offload(struct qlcnic_adapter *adapter)
1846{
1847 return false;
1848}
1849
1850static inline bool qlcnic_82xx_encap_rx_offload(struct qlcnic_adapter *adapter)
1851{
1852 return false;
1853}
1854
1855static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter)
1856{
1857 return adapter->ahw->hw_ops->encap_rx_offload(adapter);
1858}
1859
1860static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter)
1861{
1862 return adapter->ahw->hw_ops->encap_tx_offload(adapter);
1863}
1864
1843static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter) 1865static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter)
1844{ 1866{
1845 return adapter->nic_ops->start_firmware(adapter); 1867 return adapter->nic_ops->start_firmware(adapter);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 4fb68797630e..f7080d0ab874 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -242,6 +242,8 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = {
242 .get_cap_size = qlcnic_83xx_get_cap_size, 242 .get_cap_size = qlcnic_83xx_get_cap_size,
243 .set_sys_info = qlcnic_83xx_set_sys_info, 243 .set_sys_info = qlcnic_83xx_set_sys_info,
244 .store_cap_mask = qlcnic_83xx_store_cap_mask, 244 .store_cap_mask = qlcnic_83xx_store_cap_mask,
245 .encap_rx_offload = qlcnic_83xx_encap_rx_offload,
246 .encap_tx_offload = qlcnic_83xx_encap_tx_offload,
245}; 247};
246 248
247static struct qlcnic_nic_template qlcnic_83xx_ops = { 249static struct qlcnic_nic_template qlcnic_83xx_ops = {
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 838cc0ceafd8..7848cf04b29a 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -341,7 +341,7 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg)
341 } 341 }
342 return -EIO; 342 return -EIO;
343 } 343 }
344 usleep_range(1000, 1500); 344 udelay(1200);
345 } 345 }
346 346
347 if (id_reg) 347 if (id_reg)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index b6628aaa6e4a..1b5f7d57b6f8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -632,6 +632,8 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = {
632 .get_cap_size = qlcnic_82xx_get_cap_size, 632 .get_cap_size = qlcnic_82xx_get_cap_size,
633 .set_sys_info = qlcnic_82xx_set_sys_info, 633 .set_sys_info = qlcnic_82xx_set_sys_info,
634 .store_cap_mask = qlcnic_82xx_store_cap_mask, 634 .store_cap_mask = qlcnic_82xx_store_cap_mask,
635 .encap_rx_offload = qlcnic_82xx_encap_rx_offload,
636 .encap_tx_offload = qlcnic_82xx_encap_tx_offload,
635}; 637};
636 638
637static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter) 639static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 2f656f395f39..c58180f40844 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -77,6 +77,8 @@ static struct qlcnic_hardware_ops qlcnic_sriov_vf_hw_ops = {
77 .free_mac_list = qlcnic_sriov_vf_free_mac_list, 77 .free_mac_list = qlcnic_sriov_vf_free_mac_list,
78 .enable_sds_intr = qlcnic_83xx_enable_sds_intr, 78 .enable_sds_intr = qlcnic_83xx_enable_sds_intr,
79 .disable_sds_intr = qlcnic_83xx_disable_sds_intr, 79 .disable_sds_intr = qlcnic_83xx_disable_sds_intr,
80 .encap_rx_offload = qlcnic_83xx_encap_rx_offload,
81 .encap_tx_offload = qlcnic_83xx_encap_tx_offload,
80}; 82};
81 83
82static struct qlcnic_nic_template qlcnic_sriov_vf_ops = { 84static struct qlcnic_nic_template qlcnic_sriov_vf_ops = {
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index cc065ffbe4b5..bcd4708b3745 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -931,7 +931,7 @@ int emac_mac_up(struct emac_adapter *adpt)
931 emac_mac_config(adpt); 931 emac_mac_config(adpt);
932 emac_mac_rx_descs_refill(adpt, &adpt->rx_q); 932 emac_mac_rx_descs_refill(adpt, &adpt->rx_q);
933 933
934 adpt->phydev->irq = PHY_IGNORE_INTERRUPT; 934 adpt->phydev->irq = PHY_POLL;
935 ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link, 935 ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link,
936 PHY_INTERFACE_MODE_SGMII); 936 PHY_INTERFACE_MODE_SGMII);
937 if (ret) { 937 if (ret) {
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-phy.c b/drivers/net/ethernet/qualcomm/emac/emac-phy.c
index 441c19366489..18461fcb9815 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-phy.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-phy.c
@@ -13,15 +13,11 @@
13/* Qualcomm Technologies, Inc. EMAC PHY Controller driver. 13/* Qualcomm Technologies, Inc. EMAC PHY Controller driver.
14 */ 14 */
15 15
16#include <linux/module.h>
17#include <linux/of.h>
18#include <linux/of_net.h>
19#include <linux/of_mdio.h> 16#include <linux/of_mdio.h>
20#include <linux/phy.h> 17#include <linux/phy.h>
21#include <linux/iopoll.h> 18#include <linux/iopoll.h>
22#include <linux/acpi.h> 19#include <linux/acpi.h>
23#include "emac.h" 20#include "emac.h"
24#include "emac-mac.h"
25 21
26/* EMAC base register offsets */ 22/* EMAC base register offsets */
27#define EMAC_MDIO_CTRL 0x001414 23#define EMAC_MDIO_CTRL 0x001414
@@ -52,62 +48,10 @@
52 48
53#define MDIO_WAIT_TIMES 1000 49#define MDIO_WAIT_TIMES 1000
54 50
55#define EMAC_LINK_SPEED_DEFAULT (\
56 EMAC_LINK_SPEED_10_HALF |\
57 EMAC_LINK_SPEED_10_FULL |\
58 EMAC_LINK_SPEED_100_HALF |\
59 EMAC_LINK_SPEED_100_FULL |\
60 EMAC_LINK_SPEED_1GB_FULL)
61
62/**
63 * emac_phy_mdio_autopoll_disable() - disable mdio autopoll
64 * @adpt: the emac adapter
65 *
66 * The autopoll feature takes over the MDIO bus. In order for
67 * the PHY driver to be able to talk to the PHY over the MDIO
68 * bus, we need to temporarily disable the autopoll feature.
69 */
70static int emac_phy_mdio_autopoll_disable(struct emac_adapter *adpt)
71{
72 u32 val;
73
74 /* disable autopoll */
75 emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, MDIO_AP_EN, 0);
76
77 /* wait for any mdio polling to complete */
78 if (!readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, val,
79 !(val & MDIO_BUSY), 100, MDIO_WAIT_TIMES * 100))
80 return 0;
81
82 /* failed to disable; ensure it is enabled before returning */
83 emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN);
84
85 return -EBUSY;
86}
87
88/**
89 * emac_phy_mdio_autopoll_disable() - disable mdio autopoll
90 * @adpt: the emac adapter
91 *
92 * The EMAC has the ability to poll the external PHY on the MDIO
93 * bus for link state changes. This eliminates the need for the
94 * driver to poll the phy. If if the link state does change,
95 * the EMAC issues an interrupt on behalf of the PHY.
96 */
97static void emac_phy_mdio_autopoll_enable(struct emac_adapter *adpt)
98{
99 emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN);
100}
101
102static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) 51static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
103{ 52{
104 struct emac_adapter *adpt = bus->priv; 53 struct emac_adapter *adpt = bus->priv;
105 u32 reg; 54 u32 reg;
106 int ret;
107
108 ret = emac_phy_mdio_autopoll_disable(adpt);
109 if (ret)
110 return ret;
111 55
112 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK, 56 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK,
113 (addr << PHY_ADDR_SHFT)); 57 (addr << PHY_ADDR_SHFT));
@@ -122,24 +66,15 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
122 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, 66 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
123 !(reg & (MDIO_START | MDIO_BUSY)), 67 !(reg & (MDIO_START | MDIO_BUSY)),
124 100, MDIO_WAIT_TIMES * 100)) 68 100, MDIO_WAIT_TIMES * 100))
125 ret = -EIO; 69 return -EIO;
126 else
127 ret = (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK;
128 70
129 emac_phy_mdio_autopoll_enable(adpt); 71 return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK;
130
131 return ret;
132} 72}
133 73
134static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) 74static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
135{ 75{
136 struct emac_adapter *adpt = bus->priv; 76 struct emac_adapter *adpt = bus->priv;
137 u32 reg; 77 u32 reg;
138 int ret;
139
140 ret = emac_phy_mdio_autopoll_disable(adpt);
141 if (ret)
142 return ret;
143 78
144 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK, 79 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK,
145 (addr << PHY_ADDR_SHFT)); 80 (addr << PHY_ADDR_SHFT));
@@ -155,11 +90,9 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
155 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, 90 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
156 !(reg & (MDIO_START | MDIO_BUSY)), 100, 91 !(reg & (MDIO_START | MDIO_BUSY)), 100,
157 MDIO_WAIT_TIMES * 100)) 92 MDIO_WAIT_TIMES * 100))
158 ret = -EIO; 93 return -EIO;
159 94
160 emac_phy_mdio_autopoll_enable(adpt); 95 return 0;
161
162 return ret;
163} 96}
164 97
165/* Configure the MDIO bus and connect the external PHY */ 98/* Configure the MDIO bus and connect the external PHY */
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 28a8cdc36485..98a326faea29 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -50,19 +50,7 @@
50#define DMAR_DLY_CNT_DEF 15 50#define DMAR_DLY_CNT_DEF 15
51#define DMAW_DLY_CNT_DEF 4 51#define DMAW_DLY_CNT_DEF 4
52 52
53#define IMR_NORMAL_MASK (\ 53#define IMR_NORMAL_MASK (ISR_ERROR | ISR_OVER | ISR_TX_PKT)
54 ISR_ERROR |\
55 ISR_GPHY_LINK |\
56 ISR_TX_PKT |\
57 GPHY_WAKEUP_INT)
58
59#define IMR_EXTENDED_MASK (\
60 SW_MAN_INT |\
61 ISR_OVER |\
62 ISR_ERROR |\
63 ISR_GPHY_LINK |\
64 ISR_TX_PKT |\
65 GPHY_WAKEUP_INT)
66 54
67#define ISR_TX_PKT (\ 55#define ISR_TX_PKT (\
68 TX_PKT_INT |\ 56 TX_PKT_INT |\
@@ -70,10 +58,6 @@
70 TX_PKT_INT2 |\ 58 TX_PKT_INT2 |\
71 TX_PKT_INT3) 59 TX_PKT_INT3)
72 60
73#define ISR_GPHY_LINK (\
74 GPHY_LINK_UP_INT |\
75 GPHY_LINK_DOWN_INT)
76
77#define ISR_OVER (\ 61#define ISR_OVER (\
78 RFD0_UR_INT |\ 62 RFD0_UR_INT |\
79 RFD1_UR_INT |\ 63 RFD1_UR_INT |\
@@ -187,10 +171,6 @@ irqreturn_t emac_isr(int _irq, void *data)
187 if (status & ISR_OVER) 171 if (status & ISR_OVER)
188 net_warn_ratelimited("warning: TX/RX overflow\n"); 172 net_warn_ratelimited("warning: TX/RX overflow\n");
189 173
190 /* link event */
191 if (status & ISR_GPHY_LINK)
192 phy_mac_interrupt(adpt->phydev, !!(status & GPHY_LINK_UP_INT));
193
194exit: 174exit:
195 /* enable the interrupt */ 175 /* enable the interrupt */
196 writel(irq->mask, adpt->base + EMAC_INT_MASK); 176 writel(irq->mask, adpt->base + EMAC_INT_MASK);
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 3cd7989c007d..784782da3a85 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -230,18 +230,6 @@ static void ravb_ring_free(struct net_device *ndev, int q)
230 int ring_size; 230 int ring_size;
231 int i; 231 int i;
232 232
233 /* Free RX skb ringbuffer */
234 if (priv->rx_skb[q]) {
235 for (i = 0; i < priv->num_rx_ring[q]; i++)
236 dev_kfree_skb(priv->rx_skb[q][i]);
237 }
238 kfree(priv->rx_skb[q]);
239 priv->rx_skb[q] = NULL;
240
241 /* Free aligned TX buffers */
242 kfree(priv->tx_align[q]);
243 priv->tx_align[q] = NULL;
244
245 if (priv->rx_ring[q]) { 233 if (priv->rx_ring[q]) {
246 for (i = 0; i < priv->num_rx_ring[q]; i++) { 234 for (i = 0; i < priv->num_rx_ring[q]; i++) {
247 struct ravb_ex_rx_desc *desc = &priv->rx_ring[q][i]; 235 struct ravb_ex_rx_desc *desc = &priv->rx_ring[q][i];
@@ -270,6 +258,18 @@ static void ravb_ring_free(struct net_device *ndev, int q)
270 priv->tx_ring[q] = NULL; 258 priv->tx_ring[q] = NULL;
271 } 259 }
272 260
261 /* Free RX skb ringbuffer */
262 if (priv->rx_skb[q]) {
263 for (i = 0; i < priv->num_rx_ring[q]; i++)
264 dev_kfree_skb(priv->rx_skb[q][i]);
265 }
266 kfree(priv->rx_skb[q]);
267 priv->rx_skb[q] = NULL;
268
269 /* Free aligned TX buffers */
270 kfree(priv->tx_align[q]);
271 priv->tx_align[q] = NULL;
272
273 /* Free TX skb ringbuffer. 273 /* Free TX skb ringbuffer.
274 * SKBs are freed by ravb_tx_free() call above. 274 * SKBs are freed by ravb_tx_free() call above.
275 */ 275 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
index 489ef146201e..6a9c954492f2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
@@ -37,6 +37,7 @@
37#define TSE_PCS_CONTROL_AN_EN_MASK BIT(12) 37#define TSE_PCS_CONTROL_AN_EN_MASK BIT(12)
38#define TSE_PCS_CONTROL_REG 0x00 38#define TSE_PCS_CONTROL_REG 0x00
39#define TSE_PCS_CONTROL_RESTART_AN_MASK BIT(9) 39#define TSE_PCS_CONTROL_RESTART_AN_MASK BIT(9)
40#define TSE_PCS_CTRL_AUTONEG_SGMII 0x1140
40#define TSE_PCS_IF_MODE_REG 0x28 41#define TSE_PCS_IF_MODE_REG 0x28
41#define TSE_PCS_LINK_TIMER_0_REG 0x24 42#define TSE_PCS_LINK_TIMER_0_REG 0x24
42#define TSE_PCS_LINK_TIMER_1_REG 0x26 43#define TSE_PCS_LINK_TIMER_1_REG 0x26
@@ -65,6 +66,7 @@
65#define TSE_PCS_SW_RESET_TIMEOUT 100 66#define TSE_PCS_SW_RESET_TIMEOUT 100
66#define TSE_PCS_USE_SGMII_AN_MASK BIT(1) 67#define TSE_PCS_USE_SGMII_AN_MASK BIT(1)
67#define TSE_PCS_USE_SGMII_ENA BIT(0) 68#define TSE_PCS_USE_SGMII_ENA BIT(0)
69#define TSE_PCS_IF_USE_SGMII 0x03
68 70
69#define SGMII_ADAPTER_CTRL_REG 0x00 71#define SGMII_ADAPTER_CTRL_REG 0x00
70#define SGMII_ADAPTER_DISABLE 0x0001 72#define SGMII_ADAPTER_DISABLE 0x0001
@@ -101,7 +103,9 @@ int tse_pcs_init(void __iomem *base, struct tse_pcs *pcs)
101{ 103{
102 int ret = 0; 104 int ret = 0;
103 105
104 writew(TSE_PCS_USE_SGMII_ENA, base + TSE_PCS_IF_MODE_REG); 106 writew(TSE_PCS_IF_USE_SGMII, base + TSE_PCS_IF_MODE_REG);
107
108 writew(TSE_PCS_CTRL_AUTONEG_SGMII, base + TSE_PCS_CONTROL_REG);
105 109
106 writew(TSE_PCS_SGMII_LINK_TIMER_0, base + TSE_PCS_LINK_TIMER_0_REG); 110 writew(TSE_PCS_SGMII_LINK_TIMER_0, base + TSE_PCS_LINK_TIMER_0_REG);
107 writew(TSE_PCS_SGMII_LINK_TIMER_1, base + TSE_PCS_LINK_TIMER_1_REG); 111 writew(TSE_PCS_SGMII_LINK_TIMER_1, base + TSE_PCS_LINK_TIMER_1_REG);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a74c481401c4..12236daf7bb6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1208,7 +1208,7 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
1208 u32 rx_count = priv->plat->rx_queues_to_use; 1208 u32 rx_count = priv->plat->rx_queues_to_use;
1209 unsigned int bfsize = 0; 1209 unsigned int bfsize = 0;
1210 int ret = -ENOMEM; 1210 int ret = -ENOMEM;
1211 u32 queue; 1211 int queue;
1212 int i; 1212 int i;
1213 1213
1214 if (priv->hw->mode->set_16kib_bfsize) 1214 if (priv->hw->mode->set_16kib_bfsize)
@@ -2724,7 +2724,7 @@ static void stmmac_tso_allocator(struct stmmac_priv *priv, unsigned int des,
2724 2724
2725 priv->hw->desc->prepare_tso_tx_desc(desc, 0, buff_size, 2725 priv->hw->desc->prepare_tso_tx_desc(desc, 0, buff_size,
2726 0, 1, 2726 0, 1,
2727 (last_segment) && (buff_size < TSO_MAX_BUFF_SIZE), 2727 (last_segment) && (tmp_len <= TSO_MAX_BUFF_SIZE),
2728 0, 0); 2728 0, 0);
2729 2729
2730 tmp_len -= TSO_MAX_BUFF_SIZE; 2730 tmp_len -= TSO_MAX_BUFF_SIZE;
@@ -2947,7 +2947,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
2947 int i, csum_insertion = 0, is_jumbo = 0; 2947 int i, csum_insertion = 0, is_jumbo = 0;
2948 u32 queue = skb_get_queue_mapping(skb); 2948 u32 queue = skb_get_queue_mapping(skb);
2949 int nfrags = skb_shinfo(skb)->nr_frags; 2949 int nfrags = skb_shinfo(skb)->nr_frags;
2950 unsigned int entry, first_entry; 2950 int entry;
2951 unsigned int first_entry;
2951 struct dma_desc *desc, *first; 2952 struct dma_desc *desc, *first;
2952 struct stmmac_tx_queue *tx_q; 2953 struct stmmac_tx_queue *tx_q;
2953 unsigned int enh_desc; 2954 unsigned int enh_desc;
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 959fd12d2e67..6ebb0f559a42 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1133,7 +1133,7 @@ static int geneve_configure(struct net *net, struct net_device *dev,
1133 1133
1134 /* make enough headroom for basic scenario */ 1134 /* make enough headroom for basic scenario */
1135 encap_len = GENEVE_BASE_HLEN + ETH_HLEN; 1135 encap_len = GENEVE_BASE_HLEN + ETH_HLEN;
1136 if (ip_tunnel_info_af(info) == AF_INET) { 1136 if (!metadata && ip_tunnel_info_af(info) == AF_INET) {
1137 encap_len += sizeof(struct iphdr); 1137 encap_len += sizeof(struct iphdr);
1138 dev->max_mtu -= sizeof(struct iphdr); 1138 dev->max_mtu -= sizeof(struct iphdr);
1139 } else { 1139 } else {
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 8c3633c1d078..97e3bc60c3e7 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -576,6 +576,8 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
576 case HDLCDRVCTL_CALIBRATE: 576 case HDLCDRVCTL_CALIBRATE:
577 if(!capable(CAP_SYS_RAWIO)) 577 if(!capable(CAP_SYS_RAWIO))
578 return -EPERM; 578 return -EPERM;
579 if (s->par.bitrate <= 0)
580 return -EINVAL;
579 if (bi.data.calibrate > INT_MAX / s->par.bitrate) 581 if (bi.data.calibrate > INT_MAX / s->par.bitrate)
580 return -EINVAL; 582 return -EINVAL;
581 s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16; 583 s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 9097e42bec2e..57297ba23987 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1127,8 +1127,6 @@ static int marvell_read_status_page(struct phy_device *phydev, int page)
1127 if (adv < 0) 1127 if (adv < 0)
1128 return adv; 1128 return adv;
1129 1129
1130 lpa &= adv;
1131
1132 if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) 1130 if (status & MII_M1011_PHY_STATUS_FULLDUPLEX)
1133 phydev->duplex = DUPLEX_FULL; 1131 phydev->duplex = DUPLEX_FULL;
1134 else 1132 else
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 8e73f5f36e71..f99c21f78b63 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -658,6 +658,18 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
658 return 0; 658 return 0;
659} 659}
660 660
661static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
662{
663 int rc;
664
665 /* Some devices have extra OF data and an OF-style MODALIAS */
666 rc = of_device_uevent_modalias(dev, env);
667 if (rc != -ENODEV)
668 return rc;
669
670 return 0;
671}
672
661#ifdef CONFIG_PM 673#ifdef CONFIG_PM
662static int mdio_bus_suspend(struct device *dev) 674static int mdio_bus_suspend(struct device *dev)
663{ 675{
@@ -708,6 +720,7 @@ static const struct dev_pm_ops mdio_bus_pm_ops = {
708struct bus_type mdio_bus_type = { 720struct bus_type mdio_bus_type = {
709 .name = "mdio_bus", 721 .name = "mdio_bus",
710 .match = mdio_bus_match, 722 .match = mdio_bus_match,
723 .uevent = mdio_uevent,
711 .pm = MDIO_BUS_PM_OPS, 724 .pm = MDIO_BUS_PM_OPS,
712}; 725};
713EXPORT_SYMBOL(mdio_bus_type); 726EXPORT_SYMBOL(mdio_bus_type);
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 6a5fd18f062c..b9252b8d81ff 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -268,23 +268,12 @@ out:
268 return ret; 268 return ret;
269} 269}
270 270
271static int kszphy_config_init(struct phy_device *phydev) 271/* Some config bits need to be set again on resume, handle them here. */
272static int kszphy_config_reset(struct phy_device *phydev)
272{ 273{
273 struct kszphy_priv *priv = phydev->priv; 274 struct kszphy_priv *priv = phydev->priv;
274 const struct kszphy_type *type;
275 int ret; 275 int ret;
276 276
277 if (!priv)
278 return 0;
279
280 type = priv->type;
281
282 if (type->has_broadcast_disable)
283 kszphy_broadcast_disable(phydev);
284
285 if (type->has_nand_tree_disable)
286 kszphy_nand_tree_disable(phydev);
287
288 if (priv->rmii_ref_clk_sel) { 277 if (priv->rmii_ref_clk_sel) {
289 ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); 278 ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
290 if (ret) { 279 if (ret) {
@@ -295,11 +284,30 @@ static int kszphy_config_init(struct phy_device *phydev)
295 } 284 }
296 285
297 if (priv->led_mode >= 0) 286 if (priv->led_mode >= 0)
298 kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); 287 kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode);
299 288
300 return 0; 289 return 0;
301} 290}
302 291
292static int kszphy_config_init(struct phy_device *phydev)
293{
294 struct kszphy_priv *priv = phydev->priv;
295 const struct kszphy_type *type;
296
297 if (!priv)
298 return 0;
299
300 type = priv->type;
301
302 if (type->has_broadcast_disable)
303 kszphy_broadcast_disable(phydev);
304
305 if (type->has_nand_tree_disable)
306 kszphy_nand_tree_disable(phydev);
307
308 return kszphy_config_reset(phydev);
309}
310
303static int ksz8041_config_init(struct phy_device *phydev) 311static int ksz8041_config_init(struct phy_device *phydev)
304{ 312{
305 struct device_node *of_node = phydev->mdio.dev.of_node; 313 struct device_node *of_node = phydev->mdio.dev.of_node;
@@ -700,8 +708,14 @@ static int kszphy_suspend(struct phy_device *phydev)
700 708
701static int kszphy_resume(struct phy_device *phydev) 709static int kszphy_resume(struct phy_device *phydev)
702{ 710{
711 int ret;
712
703 genphy_resume(phydev); 713 genphy_resume(phydev);
704 714
715 ret = kszphy_config_reset(phydev);
716 if (ret)
717 return ret;
718
705 /* Enable PHY Interrupts */ 719 /* Enable PHY Interrupts */
706 if (phy_interrupt_is_valid(phydev)) { 720 if (phy_interrupt_is_valid(phydev)) {
707 phydev->interrupts = PHY_INTERRUPT_ENABLED; 721 phydev->interrupts = PHY_INTERRUPT_ENABLED;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 82ab8fb82587..7524caa0f29d 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -241,7 +241,7 @@ static const struct phy_setting settings[] = {
241 * phy_lookup_setting - lookup a PHY setting 241 * phy_lookup_setting - lookup a PHY setting
242 * @speed: speed to match 242 * @speed: speed to match
243 * @duplex: duplex to match 243 * @duplex: duplex to match
244 * @feature: allowed link modes 244 * @features: allowed link modes
245 * @exact: an exact match is required 245 * @exact: an exact match is required
246 * 246 *
247 * Search the settings array for a setting that matches the speed and 247 * Search the settings array for a setting that matches the speed and
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 3e9246cc49c3..a871f45ecc79 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -869,7 +869,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
869 unsigned int len; 869 unsigned int len;
870 870
871 len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len), 871 len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
872 rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len); 872 rq->min_buf_len, PAGE_SIZE - hdr_len);
873 return ALIGN(len, L1_CACHE_BYTES); 873 return ALIGN(len, L1_CACHE_BYTES);
874} 874}
875 875
@@ -2144,7 +2144,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
2144 unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len; 2144 unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
2145 unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size); 2145 unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
2146 2146
2147 return max(min_buf_len, hdr_len); 2147 return max(max(min_buf_len, hdr_len) - hdr_len,
2148 (unsigned int)GOOD_PACKET_LEN);
2148} 2149}
2149 2150
2150static int virtnet_find_vqs(struct virtnet_info *vi) 2151static int virtnet_find_vqs(struct virtnet_info *vi)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 328b4712683c..a6b5052c1d36 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -59,6 +59,8 @@ static const u8 all_zeros_mac[ETH_ALEN + 2];
59 59
60static int vxlan_sock_add(struct vxlan_dev *vxlan); 60static int vxlan_sock_add(struct vxlan_dev *vxlan);
61 61
62static void vxlan_vs_del_dev(struct vxlan_dev *vxlan);
63
62/* per-network namespace private data for this module */ 64/* per-network namespace private data for this module */
63struct vxlan_net { 65struct vxlan_net {
64 struct list_head vxlan_list; 66 struct list_head vxlan_list;
@@ -740,6 +742,22 @@ static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f)
740 call_rcu(&f->rcu, vxlan_fdb_free); 742 call_rcu(&f->rcu, vxlan_fdb_free);
741} 743}
742 744
745static void vxlan_dst_free(struct rcu_head *head)
746{
747 struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
748
749 dst_cache_destroy(&rd->dst_cache);
750 kfree(rd);
751}
752
753static void vxlan_fdb_dst_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
754 struct vxlan_rdst *rd)
755{
756 list_del_rcu(&rd->list);
757 vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH);
758 call_rcu(&rd->rcu, vxlan_dst_free);
759}
760
743static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, 761static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
744 union vxlan_addr *ip, __be16 *port, __be32 *src_vni, 762 union vxlan_addr *ip, __be16 *port, __be32 *src_vni,
745 __be32 *vni, u32 *ifindex) 763 __be32 *vni, u32 *ifindex)
@@ -864,9 +882,7 @@ static int __vxlan_fdb_delete(struct vxlan_dev *vxlan,
864 * otherwise destroy the fdb entry 882 * otherwise destroy the fdb entry
865 */ 883 */
866 if (rd && !list_is_singular(&f->remotes)) { 884 if (rd && !list_is_singular(&f->remotes)) {
867 list_del_rcu(&rd->list); 885 vxlan_fdb_dst_destroy(vxlan, f, rd);
868 vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH);
869 kfree_rcu(rd, rcu);
870 goto out; 886 goto out;
871 } 887 }
872 888
@@ -1067,6 +1083,8 @@ static void vxlan_sock_release(struct vxlan_dev *vxlan)
1067 rcu_assign_pointer(vxlan->vn4_sock, NULL); 1083 rcu_assign_pointer(vxlan->vn4_sock, NULL);
1068 synchronize_net(); 1084 synchronize_net();
1069 1085
1086 vxlan_vs_del_dev(vxlan);
1087
1070 if (__vxlan_sock_release_prep(sock4)) { 1088 if (__vxlan_sock_release_prep(sock4)) {
1071 udp_tunnel_sock_release(sock4->sock); 1089 udp_tunnel_sock_release(sock4->sock);
1072 kfree(sock4); 1090 kfree(sock4);
@@ -2342,6 +2360,15 @@ static void vxlan_cleanup(unsigned long arg)
2342 mod_timer(&vxlan->age_timer, next_timer); 2360 mod_timer(&vxlan->age_timer, next_timer);
2343} 2361}
2344 2362
2363static void vxlan_vs_del_dev(struct vxlan_dev *vxlan)
2364{
2365 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
2366
2367 spin_lock(&vn->sock_lock);
2368 hlist_del_init_rcu(&vxlan->hlist);
2369 spin_unlock(&vn->sock_lock);
2370}
2371
2345static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan) 2372static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan)
2346{ 2373{
2347 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 2374 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
@@ -3286,15 +3313,9 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
3286static void vxlan_dellink(struct net_device *dev, struct list_head *head) 3313static void vxlan_dellink(struct net_device *dev, struct list_head *head)
3287{ 3314{
3288 struct vxlan_dev *vxlan = netdev_priv(dev); 3315 struct vxlan_dev *vxlan = netdev_priv(dev);
3289 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
3290 3316
3291 vxlan_flush(vxlan, true); 3317 vxlan_flush(vxlan, true);
3292 3318
3293 spin_lock(&vn->sock_lock);
3294 if (!hlist_unhashed(&vxlan->hlist))
3295 hlist_del_rcu(&vxlan->hlist);
3296 spin_unlock(&vn->sock_lock);
3297
3298 gro_cells_destroy(&vxlan->gro_cells); 3319 gro_cells_destroy(&vxlan->gro_cells);
3299 list_del(&vxlan->next); 3320 list_del(&vxlan->next);
3300 unregister_netdevice_queue(dev, head); 3321 unregister_netdevice_queue(dev, head);
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index d5e993dc9b23..517a315e259b 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1271,6 +1271,8 @@ static int wcn36xx_remove(struct platform_device *pdev)
1271 qcom_smem_state_put(wcn->tx_enable_state); 1271 qcom_smem_state_put(wcn->tx_enable_state);
1272 qcom_smem_state_put(wcn->tx_rings_empty_state); 1272 qcom_smem_state_put(wcn->tx_rings_empty_state);
1273 1273
1274 rpmsg_destroy_ept(wcn->smd_channel);
1275
1274 iounmap(wcn->dxe_base); 1276 iounmap(wcn->dxe_base);
1275 iounmap(wcn->ccu_base); 1277 iounmap(wcn->ccu_base);
1276 1278
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index fc64b8913aa6..e03450059b06 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3422,7 +3422,7 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
3422 /* otherwise, set txglomalign */ 3422 /* otherwise, set txglomalign */
3423 value = sdiodev->settings->bus.sdio.sd_sgentry_align; 3423 value = sdiodev->settings->bus.sdio.sd_sgentry_align;
3424 /* SDIO ADMA requires at least 32 bit alignment */ 3424 /* SDIO ADMA requires at least 32 bit alignment */
3425 value = max_t(u32, value, 4); 3425 value = max_t(u32, value, ALIGNMENT);
3426 err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value, 3426 err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
3427 sizeof(u32)); 3427 sizeof(u32));
3428 } 3428 }
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
index 3b3e076571d6..45e2efc70d19 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
@@ -79,8 +79,8 @@
79/* Lowest firmware API version supported */ 79/* Lowest firmware API version supported */
80#define IWL7260_UCODE_API_MIN 17 80#define IWL7260_UCODE_API_MIN 17
81#define IWL7265_UCODE_API_MIN 17 81#define IWL7265_UCODE_API_MIN 17
82#define IWL7265D_UCODE_API_MIN 17 82#define IWL7265D_UCODE_API_MIN 22
83#define IWL3168_UCODE_API_MIN 20 83#define IWL3168_UCODE_API_MIN 22
84 84
85/* NVM versions */ 85/* NVM versions */
86#define IWL7260_NVM_VERSION 0x0a1d 86#define IWL7260_NVM_VERSION 0x0a1d
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index b9718c0cf174..89137717c1fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -74,8 +74,8 @@
74#define IWL8265_UCODE_API_MAX 30 74#define IWL8265_UCODE_API_MAX 30
75 75
76/* Lowest firmware API version supported */ 76/* Lowest firmware API version supported */
77#define IWL8000_UCODE_API_MIN 17 77#define IWL8000_UCODE_API_MIN 22
78#define IWL8265_UCODE_API_MIN 20 78#define IWL8265_UCODE_API_MIN 22
79 79
80/* NVM versions */ 80/* NVM versions */
81#define IWL8000_NVM_VERSION 0x0a1d 81#define IWL8000_NVM_VERSION 0x0a1d
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
index 306bc967742e..77efbb78e867 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
@@ -370,6 +370,7 @@
370#define MON_DMARB_RD_DATA_ADDR (0xa03c5c) 370#define MON_DMARB_RD_DATA_ADDR (0xa03c5c)
371 371
372#define DBGC_IN_SAMPLE (0xa03c00) 372#define DBGC_IN_SAMPLE (0xa03c00)
373#define DBGC_OUT_CTRL (0xa03c0c)
373 374
374/* enable the ID buf for read */ 375/* enable the ID buf for read */
375#define WFPM_PS_CTL_CLR 0xA0300C 376#define WFPM_PS_CTL_CLR 0xA0300C
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h
index 1b7d265ffb0a..a10c6aae9ab9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h
@@ -307,6 +307,11 @@ enum {
307/* Bit 1-3: LQ command color. Used to match responses to LQ commands */ 307/* Bit 1-3: LQ command color. Used to match responses to LQ commands */
308#define LQ_FLAG_COLOR_POS 1 308#define LQ_FLAG_COLOR_POS 1
309#define LQ_FLAG_COLOR_MSK (7 << LQ_FLAG_COLOR_POS) 309#define LQ_FLAG_COLOR_MSK (7 << LQ_FLAG_COLOR_POS)
310#define LQ_FLAG_COLOR_GET(_f) (((_f) & LQ_FLAG_COLOR_MSK) >>\
311 LQ_FLAG_COLOR_POS)
312#define LQ_FLAGS_COLOR_INC(_c) ((((_c) + 1) << LQ_FLAG_COLOR_POS) &\
313 LQ_FLAG_COLOR_MSK)
314#define LQ_FLAG_COLOR_SET(_f, _c) ((_c) | ((_f) & ~LQ_FLAG_COLOR_MSK))
310 315
311/* Bit 4-5: Tx RTS BW Signalling 316/* Bit 4-5: Tx RTS BW Signalling
312 * (0) No RTS BW signalling 317 * (0) No RTS BW signalling
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
index 81b98915b1a4..1360ebfdc51b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
@@ -519,8 +519,11 @@ struct agg_tx_status {
519 * bit-7 invalid rate indication 519 * bit-7 invalid rate indication
520 */ 520 */
521#define TX_RES_INIT_RATE_INDEX_MSK 0x0f 521#define TX_RES_INIT_RATE_INDEX_MSK 0x0f
522#define TX_RES_RATE_TABLE_COLOR_POS 4
522#define TX_RES_RATE_TABLE_COLOR_MSK 0x70 523#define TX_RES_RATE_TABLE_COLOR_MSK 0x70
523#define TX_RES_INV_RATE_INDEX_MSK 0x80 524#define TX_RES_INV_RATE_INDEX_MSK 0x80
525#define TX_RES_RATE_TABLE_COL_GET(_f) (((_f) & TX_RES_RATE_TABLE_COLOR_MSK) >>\
526 TX_RES_RATE_TABLE_COLOR_POS)
524 527
525#define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) 528#define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)
526#define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) 529#define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 7b86a4f1b574..c8712e6eea74 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -1002,14 +1002,6 @@ int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm,
1002 return 0; 1002 return 0;
1003} 1003}
1004 1004
1005static inline void iwl_mvm_restart_early_start(struct iwl_mvm *mvm)
1006{
1007 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000)
1008 iwl_clear_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100);
1009 else
1010 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 1);
1011}
1012
1013int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id) 1005int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id)
1014{ 1006{
1015 u8 *ptr; 1007 u8 *ptr;
@@ -1023,10 +1015,8 @@ int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id)
1023 /* EARLY START - firmware's configuration is hard coded */ 1015 /* EARLY START - firmware's configuration is hard coded */
1024 if ((!mvm->fw->dbg_conf_tlv[conf_id] || 1016 if ((!mvm->fw->dbg_conf_tlv[conf_id] ||
1025 !mvm->fw->dbg_conf_tlv[conf_id]->num_of_hcmds) && 1017 !mvm->fw->dbg_conf_tlv[conf_id]->num_of_hcmds) &&
1026 conf_id == FW_DBG_START_FROM_ALIVE) { 1018 conf_id == FW_DBG_START_FROM_ALIVE)
1027 iwl_mvm_restart_early_start(mvm);
1028 return 0; 1019 return 0;
1029 }
1030 1020
1031 if (!mvm->fw->dbg_conf_tlv[conf_id]) 1021 if (!mvm->fw->dbg_conf_tlv[conf_id])
1032 return -EINVAL; 1022 return -EINVAL;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 0f1831b41915..fd2fc46e2fe5 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1040,7 +1040,7 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
1040 struct iwl_mac_beacon_cmd_v6 beacon_cmd_v6; 1040 struct iwl_mac_beacon_cmd_v6 beacon_cmd_v6;
1041 struct iwl_mac_beacon_cmd_v7 beacon_cmd; 1041 struct iwl_mac_beacon_cmd_v7 beacon_cmd;
1042 } u = {}; 1042 } u = {};
1043 struct iwl_mac_beacon_cmd beacon_cmd; 1043 struct iwl_mac_beacon_cmd beacon_cmd = {};
1044 struct ieee80211_tx_info *info; 1044 struct ieee80211_tx_info *info;
1045 u32 beacon_skb_len; 1045 u32 beacon_skb_len;
1046 u32 rate, tx_flags; 1046 u32 rate, tx_flags;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 4e74a6b90e70..52f8d7a6a7dc 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1730,8 +1730,11 @@ int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq);
1730 */ 1730 */
1731static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm) 1731static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)
1732{ 1732{
1733 u32 cmd_queue = iwl_mvm_is_dqa_supported(mvm) ? IWL_MVM_DQA_CMD_QUEUE :
1734 IWL_MVM_CMD_QUEUE;
1735
1733 return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) & 1736 return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) &
1734 ~BIT(IWL_MVM_CMD_QUEUE)); 1737 ~BIT(cmd_queue));
1735} 1738}
1736 1739
1737static inline 1740static inline
@@ -1753,6 +1756,7 @@ static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
1753 if (!iwl_mvm_has_new_tx_api(mvm)) 1756 if (!iwl_mvm_has_new_tx_api(mvm))
1754 iwl_free_fw_paging(mvm); 1757 iwl_free_fw_paging(mvm);
1755 mvm->ucode_loaded = false; 1758 mvm->ucode_loaded = false;
1759 mvm->fw_dbg_conf = FW_DBG_INVALID;
1756 iwl_trans_stop_device(mvm->trans); 1760 iwl_trans_stop_device(mvm->trans);
1757} 1761}
1758 1762
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 9ffff6ed8133..3da5ec40aaea 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -1149,21 +1149,37 @@ static void iwl_mvm_fw_error_dump_wk(struct work_struct *work)
1149 1149
1150 mutex_lock(&mvm->mutex); 1150 mutex_lock(&mvm->mutex);
1151 1151
1152 /* stop recording */
1153 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { 1152 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
1153 /* stop recording */
1154 iwl_set_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100); 1154 iwl_set_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100);
1155
1156 iwl_mvm_fw_error_dump(mvm);
1157
1158 /* start recording again if the firmware is not crashed */
1159 if (!test_bit(STATUS_FW_ERROR, &mvm->trans->status) &&
1160 mvm->fw->dbg_dest_tlv)
1161 iwl_clear_bits_prph(mvm->trans,
1162 MON_BUFF_SAMPLE_CTL, 0x100);
1155 } else { 1163 } else {
1164 u32 in_sample = iwl_read_prph(mvm->trans, DBGC_IN_SAMPLE);
1165 u32 out_ctrl = iwl_read_prph(mvm->trans, DBGC_OUT_CTRL);
1166
1167 /* stop recording */
1156 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 0); 1168 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 0);
1157 /* wait before we collect the data till the DBGC stop */
1158 udelay(100); 1169 udelay(100);
1159 } 1170 iwl_write_prph(mvm->trans, DBGC_OUT_CTRL, 0);
1171 /* wait before we collect the data till the DBGC stop */
1172 udelay(500);
1160 1173
1161 iwl_mvm_fw_error_dump(mvm); 1174 iwl_mvm_fw_error_dump(mvm);
1162 1175
1163 /* start recording again if the firmware is not crashed */ 1176 /* start recording again if the firmware is not crashed */
1164 WARN_ON_ONCE((!test_bit(STATUS_FW_ERROR, &mvm->trans->status)) && 1177 if (!test_bit(STATUS_FW_ERROR, &mvm->trans->status) &&
1165 mvm->fw->dbg_dest_tlv && 1178 mvm->fw->dbg_dest_tlv) {
1166 iwl_mvm_start_fw_dbg_conf(mvm, mvm->fw_dbg_conf)); 1179 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, in_sample);
1180 iwl_write_prph(mvm->trans, DBGC_OUT_CTRL, out_ctrl);
1181 }
1182 }
1167 1183
1168 mutex_unlock(&mvm->mutex); 1184 mutex_unlock(&mvm->mutex);
1169 1185
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 7788eefcd2bd..aa785cf3cf68 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
5 * Copyright(c) 2016 Intel Deutschland GmbH 5 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as 8 * under the terms of version 2 of the GNU General Public License as
@@ -1083,34 +1083,6 @@ static void rs_get_lower_rate_down_column(struct iwl_lq_sta *lq_sta,
1083 rs_get_lower_rate_in_column(lq_sta, rate); 1083 rs_get_lower_rate_in_column(lq_sta, rate);
1084} 1084}
1085 1085
1086/* Check if both rates are identical
1087 * allow_ant_mismatch enables matching a SISO rate on ANT_A or ANT_B
1088 * with a rate indicating STBC/BFER and ANT_AB.
1089 */
1090static inline bool rs_rate_equal(struct rs_rate *a,
1091 struct rs_rate *b,
1092 bool allow_ant_mismatch)
1093
1094{
1095 bool ant_match = (a->ant == b->ant) && (a->stbc == b->stbc) &&
1096 (a->bfer == b->bfer);
1097
1098 if (allow_ant_mismatch) {
1099 if (a->stbc || a->bfer) {
1100 WARN_ONCE(a->ant != ANT_AB, "stbc %d bfer %d ant %d",
1101 a->stbc, a->bfer, a->ant);
1102 ant_match |= (b->ant == ANT_A || b->ant == ANT_B);
1103 } else if (b->stbc || b->bfer) {
1104 WARN_ONCE(b->ant != ANT_AB, "stbc %d bfer %d ant %d",
1105 b->stbc, b->bfer, b->ant);
1106 ant_match |= (a->ant == ANT_A || a->ant == ANT_B);
1107 }
1108 }
1109
1110 return (a->type == b->type) && (a->bw == b->bw) && (a->sgi == b->sgi) &&
1111 (a->ldpc == b->ldpc) && (a->index == b->index) && ant_match;
1112}
1113
1114/* Check if both rates share the same column */ 1086/* Check if both rates share the same column */
1115static inline bool rs_rate_column_match(struct rs_rate *a, 1087static inline bool rs_rate_column_match(struct rs_rate *a,
1116 struct rs_rate *b) 1088 struct rs_rate *b)
@@ -1182,12 +1154,12 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1182 u32 lq_hwrate; 1154 u32 lq_hwrate;
1183 struct rs_rate lq_rate, tx_resp_rate; 1155 struct rs_rate lq_rate, tx_resp_rate;
1184 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 1156 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
1185 u8 reduced_txp = (uintptr_t)info->status.status_driver_data[0]; 1157 u32 tlc_info = (uintptr_t)info->status.status_driver_data[0];
1158 u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK;
1159 u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info);
1186 u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; 1160 u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1];
1187 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1161 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1188 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta; 1162 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta;
1189 bool allow_ant_mismatch = fw_has_api(&mvm->fw->ucode_capa,
1190 IWL_UCODE_TLV_API_LQ_SS_PARAMS);
1191 1163
1192 /* Treat uninitialized rate scaling data same as non-existing. */ 1164 /* Treat uninitialized rate scaling data same as non-existing. */
1193 if (!lq_sta) { 1165 if (!lq_sta) {
@@ -1262,10 +1234,10 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1262 rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate); 1234 rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate);
1263 1235
1264 /* Here we actually compare this rate to the latest LQ command */ 1236 /* Here we actually compare this rate to the latest LQ command */
1265 if (!rs_rate_equal(&tx_resp_rate, &lq_rate, allow_ant_mismatch)) { 1237 if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) {
1266 IWL_DEBUG_RATE(mvm, 1238 IWL_DEBUG_RATE(mvm,
1267 "initial tx resp rate 0x%x does not match 0x%x\n", 1239 "tx resp color 0x%x does not match 0x%x\n",
1268 tx_resp_hwrate, lq_hwrate); 1240 lq_color, LQ_FLAG_COLOR_GET(table->flags));
1269 1241
1270 /* 1242 /*
1271 * Since rates mis-match, the last LQ command may have failed. 1243 * Since rates mis-match, the last LQ command may have failed.
@@ -3326,6 +3298,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
3326 u8 valid_tx_ant = 0; 3298 u8 valid_tx_ant = 0;
3327 struct iwl_lq_cmd *lq_cmd = &lq_sta->lq; 3299 struct iwl_lq_cmd *lq_cmd = &lq_sta->lq;
3328 bool toggle_ant = false; 3300 bool toggle_ant = false;
3301 u32 color;
3329 3302
3330 memcpy(&rate, initial_rate, sizeof(rate)); 3303 memcpy(&rate, initial_rate, sizeof(rate));
3331 3304
@@ -3380,6 +3353,9 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
3380 num_rates, num_retries, valid_tx_ant, 3353 num_rates, num_retries, valid_tx_ant,
3381 toggle_ant); 3354 toggle_ant);
3382 3355
3356 /* update the color of the LQ command (as a counter at bits 1-3) */
3357 color = LQ_FLAGS_COLOR_INC(LQ_FLAG_COLOR_GET(lq_cmd->flags));
3358 lq_cmd->flags = LQ_FLAG_COLOR_SET(lq_cmd->flags, color);
3383} 3359}
3384 3360
3385struct rs_bfer_active_iter_data { 3361struct rs_bfer_active_iter_data {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
index ee207f2c0a90..3abde1cb0303 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
4 * Copyright(c) 2015 Intel Mobile Communications GmbH 4 * Copyright(c) 2015 Intel Mobile Communications GmbH
5 * Copyright(c) 2017 Intel Deutschland GmbH
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as 8 * under the terms of version 2 of the GNU General Public License as
@@ -357,6 +358,20 @@ struct iwl_lq_sta {
357 } pers; 358 } pers;
358}; 359};
359 360
361/* ieee80211_tx_info's status_driver_data[0] is packed with lq color and txp
362 * Note, it's iwlmvm <-> mac80211 interface.
363 * bits 0-7: reduced tx power
364 * bits 8-10: LQ command's color
365 */
366#define RS_DRV_DATA_TXP_MSK 0xff
367#define RS_DRV_DATA_LQ_COLOR_POS 8
368#define RS_DRV_DATA_LQ_COLOR_MSK (7 << RS_DRV_DATA_LQ_COLOR_POS)
369#define RS_DRV_DATA_LQ_COLOR_GET(_f) (((_f) & RS_DRV_DATA_LQ_COLOR_MSK) >>\
370 RS_DRV_DATA_LQ_COLOR_POS)
371#define RS_DRV_DATA_PACK(_c, _p) ((void *)(uintptr_t)\
372 (((uintptr_t)_p) |\
373 ((_c) << RS_DRV_DATA_LQ_COLOR_POS)))
374
360/* Initialize station's rate scaling information after adding station */ 375/* Initialize station's rate scaling information after adding station */
361void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 376void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
362 enum nl80211_band band, bool init); 377 enum nl80211_band band, bool init);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index f5c786ddc526..614d67810d05 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2120,7 +2120,8 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2120 if (!iwl_mvm_is_dqa_supported(mvm)) 2120 if (!iwl_mvm_is_dqa_supported(mvm))
2121 return 0; 2121 return 0;
2122 2122
2123 if (WARN_ON(vif->type != NL80211_IFTYPE_AP)) 2123 if (WARN_ON(vif->type != NL80211_IFTYPE_AP &&
2124 vif->type != NL80211_IFTYPE_ADHOC))
2124 return -ENOTSUPP; 2125 return -ENOTSUPP;
2125 2126
2126 /* 2127 /*
@@ -2155,6 +2156,16 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2155 mvmvif->cab_queue = queue; 2156 mvmvif->cab_queue = queue;
2156 } else if (!fw_has_api(&mvm->fw->ucode_capa, 2157 } else if (!fw_has_api(&mvm->fw->ucode_capa,
2157 IWL_UCODE_TLV_API_STA_TYPE)) { 2158 IWL_UCODE_TLV_API_STA_TYPE)) {
2159 /*
2160 * In IBSS, ieee80211_check_queues() sets the cab_queue to be
2161 * invalid, so make sure we use the queue we want.
2162 * Note that this is done here as we want to avoid making DQA
2163 * changes in mac80211 layer.
2164 */
2165 if (vif->type == NL80211_IFTYPE_ADHOC) {
2166 vif->cab_queue = IWL_MVM_DQA_GCAST_QUEUE;
2167 mvmvif->cab_queue = vif->cab_queue;
2168 }
2158 iwl_mvm_enable_txq(mvm, vif->cab_queue, vif->cab_queue, 0, 2169 iwl_mvm_enable_txq(mvm, vif->cab_queue, vif->cab_queue, 0,
2159 &cfg, timeout); 2170 &cfg, timeout);
2160 } 2171 }
@@ -3321,18 +3332,15 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm,
3321 3332
3322 /* Get the station from the mvm local station table */ 3333 /* Get the station from the mvm local station table */
3323 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta); 3334 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta);
3324 if (!mvm_sta) { 3335 if (mvm_sta)
3325 IWL_ERR(mvm, "Failed to find station\n"); 3336 sta_id = mvm_sta->sta_id;
3326 return -EINVAL;
3327 }
3328 sta_id = mvm_sta->sta_id;
3329 3337
3330 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", 3338 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n",
3331 keyconf->keyidx, sta_id); 3339 keyconf->keyidx, sta_id);
3332 3340
3333 if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC || 3341 if (mvm_sta && (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
3334 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || 3342 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
3335 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) 3343 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256))
3336 return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true); 3344 return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true);
3337 3345
3338 if (!__test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table)) { 3346 if (!__test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table)) {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
index 2716cb5483bf..ad62b67dceb2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
@@ -313,6 +313,7 @@ enum iwl_mvm_agg_state {
313 * This is basically (last acked packet++). 313 * This is basically (last acked packet++).
314 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the 314 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
315 * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). 315 * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA).
316 * @lq_color: the color of the LQ command as it appears in tx response.
316 * @amsdu_in_ampdu_allowed: true if A-MSDU in A-MPDU is allowed. 317 * @amsdu_in_ampdu_allowed: true if A-MSDU in A-MPDU is allowed.
317 * @state: state of the BA agreement establishment / tear down. 318 * @state: state of the BA agreement establishment / tear down.
318 * @txq_id: Tx queue used by the BA session / DQA 319 * @txq_id: Tx queue used by the BA session / DQA
@@ -331,6 +332,7 @@ struct iwl_mvm_tid_data {
331 u16 next_reclaimed; 332 u16 next_reclaimed;
332 /* The rest is Tx AGG related */ 333 /* The rest is Tx AGG related */
333 u32 rate_n_flags; 334 u32 rate_n_flags;
335 u8 lq_color;
334 bool amsdu_in_ampdu_allowed; 336 bool amsdu_in_ampdu_allowed;
335 enum iwl_mvm_agg_state state; 337 enum iwl_mvm_agg_state state;
336 u16 txq_id; 338 u16 txq_id;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index f9cbd197246f..506d58104e1c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -790,11 +790,13 @@ static int iwl_mvm_tcool_set_cur_state(struct thermal_cooling_device *cdev,
790 struct iwl_mvm *mvm = (struct iwl_mvm *)(cdev->devdata); 790 struct iwl_mvm *mvm = (struct iwl_mvm *)(cdev->devdata);
791 int ret; 791 int ret;
792 792
793 if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR))
794 return -EIO;
795
796 mutex_lock(&mvm->mutex); 793 mutex_lock(&mvm->mutex);
797 794
795 if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) {
796 ret = -EIO;
797 goto unlock;
798 }
799
798 if (new_state >= ARRAY_SIZE(iwl_mvm_cdev_budgets)) { 800 if (new_state >= ARRAY_SIZE(iwl_mvm_cdev_budgets)) {
799 ret = -EINVAL; 801 ret = -EINVAL;
800 goto unlock; 802 goto unlock;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index bcaceb64a6e8..f21901cd4a4f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1323,6 +1323,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
1323 struct iwl_mvm_sta *mvmsta; 1323 struct iwl_mvm_sta *mvmsta;
1324 struct sk_buff_head skbs; 1324 struct sk_buff_head skbs;
1325 u8 skb_freed = 0; 1325 u8 skb_freed = 0;
1326 u8 lq_color;
1326 u16 next_reclaimed, seq_ctl; 1327 u16 next_reclaimed, seq_ctl;
1327 bool is_ndp = false; 1328 bool is_ndp = false;
1328 1329
@@ -1405,8 +1406,9 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
1405 info->status.tx_time = 1406 info->status.tx_time =
1406 le16_to_cpu(tx_resp->wireless_media_time); 1407 le16_to_cpu(tx_resp->wireless_media_time);
1407 BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1); 1408 BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1);
1409 lq_color = TX_RES_RATE_TABLE_COL_GET(tx_resp->tlc_info);
1408 info->status.status_driver_data[0] = 1410 info->status.status_driver_data[0] =
1409 (void *)(uintptr_t)tx_resp->reduced_tpc; 1411 RS_DRV_DATA_PACK(lq_color, tx_resp->reduced_tpc);
1410 1412
1411 ieee80211_tx_status(mvm->hw, skb); 1413 ieee80211_tx_status(mvm->hw, skb);
1412 } 1414 }
@@ -1638,6 +1640,9 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm,
1638 le32_to_cpu(tx_resp->initial_rate); 1640 le32_to_cpu(tx_resp->initial_rate);
1639 mvmsta->tid_data[tid].tx_time = 1641 mvmsta->tid_data[tid].tx_time =
1640 le16_to_cpu(tx_resp->wireless_media_time); 1642 le16_to_cpu(tx_resp->wireless_media_time);
1643 mvmsta->tid_data[tid].lq_color =
1644 (tx_resp->tlc_info & TX_RES_RATE_TABLE_COLOR_MSK) >>
1645 TX_RES_RATE_TABLE_COLOR_POS;
1641 } 1646 }
1642 1647
1643 rcu_read_unlock(); 1648 rcu_read_unlock();
@@ -1707,6 +1712,11 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,
1707 iwl_mvm_check_ratid_empty(mvm, sta, tid); 1712 iwl_mvm_check_ratid_empty(mvm, sta, tid);
1708 1713
1709 freed = 0; 1714 freed = 0;
1715
1716 /* pack lq color from tid_data along the reduced txp */
1717 ba_info->status.status_driver_data[0] =
1718 RS_DRV_DATA_PACK(tid_data->lq_color,
1719 ba_info->status.status_driver_data[0]);
1710 ba_info->status.status_driver_data[1] = (void *)(uintptr_t)rate; 1720 ba_info->status.status_driver_data[1] = (void *)(uintptr_t)rate;
1711 1721
1712 skb_queue_walk(&reclaimed_skbs, skb) { 1722 skb_queue_walk(&reclaimed_skbs, skb) {
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 70acf850a9f1..93cbc7a69bcd 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2803,7 +2803,8 @@ static struct iwl_trans_dump_data
2803#ifdef CONFIG_PM_SLEEP 2803#ifdef CONFIG_PM_SLEEP
2804static int iwl_trans_pcie_suspend(struct iwl_trans *trans) 2804static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
2805{ 2805{
2806 if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3) 2806 if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 &&
2807 (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3))
2807 return iwl_pci_fw_enter_d0i3(trans); 2808 return iwl_pci_fw_enter_d0i3(trans);
2808 2809
2809 return 0; 2810 return 0;
@@ -2811,7 +2812,8 @@ static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
2811 2812
2812static void iwl_trans_pcie_resume(struct iwl_trans *trans) 2813static void iwl_trans_pcie_resume(struct iwl_trans *trans)
2813{ 2814{
2814 if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3) 2815 if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 &&
2816 (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3))
2815 iwl_pci_fw_exit_d0i3(trans); 2817 iwl_pci_fw_exit_d0i3(trans);
2816} 2818}
2817#endif /* CONFIG_PM_SLEEP */ 2819#endif /* CONFIG_PM_SLEEP */
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
index 9fb46a6f47cf..9c9bfbbabdf1 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
@@ -906,7 +906,7 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
906 906
907 if (WARN_ON(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp))) { 907 if (WARN_ON(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp))) {
908 ret = -EINVAL; 908 ret = -EINVAL;
909 goto error; 909 goto error_free_resp;
910 } 910 }
911 911
912 rsp = (void *)hcmd.resp_pkt->data; 912 rsp = (void *)hcmd.resp_pkt->data;
@@ -915,13 +915,13 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
915 if (qid > ARRAY_SIZE(trans_pcie->txq)) { 915 if (qid > ARRAY_SIZE(trans_pcie->txq)) {
916 WARN_ONCE(1, "queue index %d unsupported", qid); 916 WARN_ONCE(1, "queue index %d unsupported", qid);
917 ret = -EIO; 917 ret = -EIO;
918 goto error; 918 goto error_free_resp;
919 } 919 }
920 920
921 if (test_and_set_bit(qid, trans_pcie->queue_used)) { 921 if (test_and_set_bit(qid, trans_pcie->queue_used)) {
922 WARN_ONCE(1, "queue %d already used", qid); 922 WARN_ONCE(1, "queue %d already used", qid);
923 ret = -EIO; 923 ret = -EIO;
924 goto error; 924 goto error_free_resp;
925 } 925 }
926 926
927 txq->id = qid; 927 txq->id = qid;
@@ -934,8 +934,11 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
934 (txq->write_ptr) | (qid << 16)); 934 (txq->write_ptr) | (qid << 16));
935 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d\n", qid); 935 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d\n", qid);
936 936
937 iwl_free_resp(&hcmd);
937 return qid; 938 return qid;
938 939
940error_free_resp:
941 iwl_free_resp(&hcmd);
939error: 942error:
940 iwl_pcie_gen2_txq_free_memory(trans, txq); 943 iwl_pcie_gen2_txq_free_memory(trans, txq);
941 return ret; 944 return ret;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index b4ee8f62ce8d..8e2828d48d7f 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -470,6 +470,7 @@ struct mlx4_update_qp_params {
470 u16 rate_val; 470 u16 rate_val;
471}; 471};
472 472
473struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn);
473int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 474int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
474 enum mlx4_update_qp_attr attr, 475 enum mlx4_update_qp_attr attr,
475 struct mlx4_update_qp_params *params); 476 struct mlx4_update_qp_params *params);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index dbf0abba33b8..3e505bbff8ca 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -1007,6 +1007,7 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row,
1007 */ 1007 */
1008extern const struct proto_ops inet6_stream_ops; 1008extern const struct proto_ops inet6_stream_ops;
1009extern const struct proto_ops inet6_dgram_ops; 1009extern const struct proto_ops inet6_dgram_ops;
1010extern const struct proto_ops inet6_sockraw_ops;
1010 1011
1011struct group_source_req; 1012struct group_source_req;
1012struct group_filter; 1013struct group_filter;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 38a7427ae902..be6223c586fa 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -924,7 +924,7 @@ struct tcp_congestion_ops {
924 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev); 924 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
925 /* call when ack arrives (optional) */ 925 /* call when ack arrives (optional) */
926 void (*in_ack_event)(struct sock *sk, u32 flags); 926 void (*in_ack_event)(struct sock *sk, u32 flags);
927 /* new value of cwnd after loss (optional) */ 927 /* new value of cwnd after loss (required) */
928 u32 (*undo_cwnd)(struct sock *sk); 928 u32 (*undo_cwnd)(struct sock *sk);
929 /* hook for packet ack accounting (optional) */ 929 /* hook for packet ack accounting (optional) */
930 void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); 930 void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample);
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 574f78824d8a..32bd3ead9ba1 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -595,7 +595,7 @@ static int br_afspec(struct net_bridge *br,
595 err = 0; 595 err = 0;
596 switch (nla_type(attr)) { 596 switch (nla_type(attr)) {
597 case IFLA_BRIDGE_VLAN_TUNNEL_INFO: 597 case IFLA_BRIDGE_VLAN_TUNNEL_INFO:
598 if (!(p->flags & BR_VLAN_TUNNEL)) 598 if (!p || !(p->flags & BR_VLAN_TUNNEL))
599 return -EINVAL; 599 return -EINVAL;
600 err = br_parse_vlan_tunnel_info(attr, &tinfo_curr); 600 err = br_parse_vlan_tunnel_info(attr, &tinfo_curr);
601 if (err) 601 if (err)
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 0db8102995a5..6f12a5271219 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -179,7 +179,8 @@ static void br_stp_start(struct net_bridge *br)
179 br_debug(br, "using kernel STP\n"); 179 br_debug(br, "using kernel STP\n");
180 180
181 /* To start timers on any ports left in blocking */ 181 /* To start timers on any ports left in blocking */
182 mod_timer(&br->hello_timer, jiffies + br->hello_time); 182 if (br->dev->flags & IFF_UP)
183 mod_timer(&br->hello_timer, jiffies + br->hello_time);
183 br_port_state_selection(br); 184 br_port_state_selection(br);
184 } 185 }
185 186
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b0b87a292e7c..a0adfc31a3fe 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1680,8 +1680,10 @@ start_again:
1680 1680
1681 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq, 1681 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq,
1682 &devlink_nl_family, NLM_F_MULTI, cmd); 1682 &devlink_nl_family, NLM_F_MULTI, cmd);
1683 if (!hdr) 1683 if (!hdr) {
1684 nlmsg_free(skb);
1684 return -EMSGSIZE; 1685 return -EMSGSIZE;
1686 }
1685 1687
1686 if (devlink_nl_put_handle(skb, devlink)) 1688 if (devlink_nl_put_handle(skb, devlink))
1687 goto nla_put_failure; 1689 goto nla_put_failure;
@@ -2098,8 +2100,10 @@ start_again:
2098 2100
2099 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq, 2101 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq,
2100 &devlink_nl_family, NLM_F_MULTI, cmd); 2102 &devlink_nl_family, NLM_F_MULTI, cmd);
2101 if (!hdr) 2103 if (!hdr) {
2104 nlmsg_free(skb);
2102 return -EMSGSIZE; 2105 return -EMSGSIZE;
2106 }
2103 2107
2104 if (devlink_nl_put_handle(skb, devlink)) 2108 if (devlink_nl_put_handle(skb, devlink))
2105 goto nla_put_failure; 2109 goto nla_put_failure;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 346d3e85dfbc..b1be7c01efe2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3754,8 +3754,11 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
3754 3754
3755 spin_lock_irqsave(&q->lock, flags); 3755 spin_lock_irqsave(&q->lock, flags);
3756 skb = __skb_dequeue(q); 3756 skb = __skb_dequeue(q);
3757 if (skb && (skb_next = skb_peek(q))) 3757 if (skb && (skb_next = skb_peek(q))) {
3758 icmp_next = is_icmp_err_skb(skb_next); 3758 icmp_next = is_icmp_err_skb(skb_next);
3759 if (icmp_next)
3760 sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin;
3761 }
3759 spin_unlock_irqrestore(&q->lock, flags); 3762 spin_unlock_irqrestore(&q->lock, flags);
3760 3763
3761 if (is_icmp_err_skb(skb) && !icmp_next) 3764 if (is_icmp_err_skb(skb) && !icmp_next)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 26130ae438da..90038d45a547 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -223,6 +223,53 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
223 return 0; 223 return 0;
224} 224}
225 225
226#ifdef CONFIG_PM_SLEEP
227int dsa_switch_suspend(struct dsa_switch *ds)
228{
229 int i, ret = 0;
230
231 /* Suspend slave network devices */
232 for (i = 0; i < ds->num_ports; i++) {
233 if (!dsa_is_port_initialized(ds, i))
234 continue;
235
236 ret = dsa_slave_suspend(ds->ports[i].netdev);
237 if (ret)
238 return ret;
239 }
240
241 if (ds->ops->suspend)
242 ret = ds->ops->suspend(ds);
243
244 return ret;
245}
246EXPORT_SYMBOL_GPL(dsa_switch_suspend);
247
248int dsa_switch_resume(struct dsa_switch *ds)
249{
250 int i, ret = 0;
251
252 if (ds->ops->resume)
253 ret = ds->ops->resume(ds);
254
255 if (ret)
256 return ret;
257
258 /* Resume slave network devices */
259 for (i = 0; i < ds->num_ports; i++) {
260 if (!dsa_is_port_initialized(ds, i))
261 continue;
262
263 ret = dsa_slave_resume(ds->ports[i].netdev);
264 if (ret)
265 return ret;
266 }
267
268 return 0;
269}
270EXPORT_SYMBOL_GPL(dsa_switch_resume);
271#endif
272
226static struct packet_type dsa_pack_type __read_mostly = { 273static struct packet_type dsa_pack_type __read_mostly = {
227 .type = cpu_to_be16(ETH_P_XDSA), 274 .type = cpu_to_be16(ETH_P_XDSA),
228 .func = dsa_switch_rcv, 275 .func = dsa_switch_rcv,
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 033b3bfb63dc..7796580e99ee 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -484,8 +484,10 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
484 dsa_ds_unapply(dst, ds); 484 dsa_ds_unapply(dst, ds);
485 } 485 }
486 486
487 if (dst->cpu_switch) 487 if (dst->cpu_switch) {
488 dsa_cpu_port_ethtool_restore(dst->cpu_switch); 488 dsa_cpu_port_ethtool_restore(dst->cpu_switch);
489 dst->cpu_switch = NULL;
490 }
489 491
490 pr_info("DSA: tree %d unapplied\n", dst->tree); 492 pr_info("DSA: tree %d unapplied\n", dst->tree);
491 dst->applied = false; 493 dst->applied = false;
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index ad345c8b0b06..7281098df04e 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -289,53 +289,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
289 dsa_switch_unregister_notifier(ds); 289 dsa_switch_unregister_notifier(ds);
290} 290}
291 291
292#ifdef CONFIG_PM_SLEEP
293int dsa_switch_suspend(struct dsa_switch *ds)
294{
295 int i, ret = 0;
296
297 /* Suspend slave network devices */
298 for (i = 0; i < ds->num_ports; i++) {
299 if (!dsa_is_port_initialized(ds, i))
300 continue;
301
302 ret = dsa_slave_suspend(ds->ports[i].netdev);
303 if (ret)
304 return ret;
305 }
306
307 if (ds->ops->suspend)
308 ret = ds->ops->suspend(ds);
309
310 return ret;
311}
312EXPORT_SYMBOL_GPL(dsa_switch_suspend);
313
314int dsa_switch_resume(struct dsa_switch *ds)
315{
316 int i, ret = 0;
317
318 if (ds->ops->resume)
319 ret = ds->ops->resume(ds);
320
321 if (ret)
322 return ret;
323
324 /* Resume slave network devices */
325 for (i = 0; i < ds->num_ports; i++) {
326 if (!dsa_is_port_initialized(ds, i))
327 continue;
328
329 ret = dsa_slave_resume(ds->ports[i].netdev);
330 if (ret)
331 return ret;
332 }
333
334 return 0;
335}
336EXPORT_SYMBOL_GPL(dsa_switch_resume);
337#endif
338
339/* platform driver init and cleanup *****************************************/ 292/* platform driver init and cleanup *****************************************/
340static int dev_is_class(struct device *dev, void *class) 293static int dev_is_class(struct device *dev, void *class)
341{ 294{
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f3dad1661343..58925b6597de 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1043,7 +1043,7 @@ static struct inet_protosw inetsw_array[] =
1043 .type = SOCK_DGRAM, 1043 .type = SOCK_DGRAM,
1044 .protocol = IPPROTO_ICMP, 1044 .protocol = IPPROTO_ICMP,
1045 .prot = &ping_prot, 1045 .prot = &ping_prot,
1046 .ops = &inet_dgram_ops, 1046 .ops = &inet_sockraw_ops,
1047 .flags = INET_PROTOSW_REUSE, 1047 .flags = INET_PROTOSW_REUSE,
1048 }, 1048 },
1049 1049
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 59792d283ff8..b5ea036ca781 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2381,9 +2381,10 @@ static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int l
2381 return 0; 2381 return 0;
2382} 2382}
2383 2383
2384static int tcp_repair_options_est(struct tcp_sock *tp, 2384static int tcp_repair_options_est(struct sock *sk,
2385 struct tcp_repair_opt __user *optbuf, unsigned int len) 2385 struct tcp_repair_opt __user *optbuf, unsigned int len)
2386{ 2386{
2387 struct tcp_sock *tp = tcp_sk(sk);
2387 struct tcp_repair_opt opt; 2388 struct tcp_repair_opt opt;
2388 2389
2389 while (len >= sizeof(opt)) { 2390 while (len >= sizeof(opt)) {
@@ -2396,6 +2397,7 @@ static int tcp_repair_options_est(struct tcp_sock *tp,
2396 switch (opt.opt_code) { 2397 switch (opt.opt_code) {
2397 case TCPOPT_MSS: 2398 case TCPOPT_MSS:
2398 tp->rx_opt.mss_clamp = opt.opt_val; 2399 tp->rx_opt.mss_clamp = opt.opt_val;
2400 tcp_mtup_init(sk);
2399 break; 2401 break;
2400 case TCPOPT_WINDOW: 2402 case TCPOPT_WINDOW:
2401 { 2403 {
@@ -2555,7 +2557,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2555 if (!tp->repair) 2557 if (!tp->repair)
2556 err = -EINVAL; 2558 err = -EINVAL;
2557 else if (sk->sk_state == TCP_ESTABLISHED) 2559 else if (sk->sk_state == TCP_ESTABLISHED)
2558 err = tcp_repair_options_est(tp, 2560 err = tcp_repair_options_est(sk,
2559 (struct tcp_repair_opt __user *)optval, 2561 (struct tcp_repair_opt __user *)optval,
2560 optlen); 2562 optlen);
2561 else 2563 else
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 6e3c512054a6..324c9bcc5456 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -180,6 +180,7 @@ void tcp_init_congestion_control(struct sock *sk)
180{ 180{
181 const struct inet_connection_sock *icsk = inet_csk(sk); 181 const struct inet_connection_sock *icsk = inet_csk(sk);
182 182
183 tcp_sk(sk)->prior_ssthresh = 0;
183 if (icsk->icsk_ca_ops->init) 184 if (icsk->icsk_ca_ops->init)
184 icsk->icsk_ca_ops->init(sk); 185 icsk->icsk_ca_ops->init(sk);
185 if (tcp_ca_needs_ecn(sk)) 186 if (tcp_ca_needs_ecn(sk))
diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index 37ac9de713c6..8d772fea1dde 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -1319,7 +1319,7 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
1319 struct ipv6hdr *ip6_hdr; 1319 struct ipv6hdr *ip6_hdr;
1320 struct ipv6_opt_hdr *hop; 1320 struct ipv6_opt_hdr *hop;
1321 unsigned char buf[CALIPSO_MAX_BUFFER]; 1321 unsigned char buf[CALIPSO_MAX_BUFFER];
1322 int len_delta, new_end, pad; 1322 int len_delta, new_end, pad, payload;
1323 unsigned int start, end; 1323 unsigned int start, end;
1324 1324
1325 ip6_hdr = ipv6_hdr(skb); 1325 ip6_hdr = ipv6_hdr(skb);
@@ -1346,6 +1346,8 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
1346 if (ret_val < 0) 1346 if (ret_val < 0)
1347 return ret_val; 1347 return ret_val;
1348 1348
1349 ip6_hdr = ipv6_hdr(skb); /* Reset as skb_cow() may have moved it */
1350
1349 if (len_delta) { 1351 if (len_delta) {
1350 if (len_delta > 0) 1352 if (len_delta > 0)
1351 skb_push(skb, len_delta); 1353 skb_push(skb, len_delta);
@@ -1355,6 +1357,8 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
1355 sizeof(*ip6_hdr) + start); 1357 sizeof(*ip6_hdr) + start);
1356 skb_reset_network_header(skb); 1358 skb_reset_network_header(skb);
1357 ip6_hdr = ipv6_hdr(skb); 1359 ip6_hdr = ipv6_hdr(skb);
1360 payload = ntohs(ip6_hdr->payload_len);
1361 ip6_hdr->payload_len = htons(payload + len_delta);
1358 } 1362 }
1359 1363
1360 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1); 1364 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 280268f1dd7b..cdb3728faca7 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -116,8 +116,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
116 116
117 if (udpfrag) { 117 if (udpfrag) {
118 int err = ip6_find_1stfragopt(skb, &prevhdr); 118 int err = ip6_find_1stfragopt(skb, &prevhdr);
119 if (err < 0) 119 if (err < 0) {
120 kfree_skb_list(segs);
120 return ERR_PTR(err); 121 return ERR_PTR(err);
122 }
121 fptr = (struct frag_hdr *)((u8 *)ipv6h + err); 123 fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
122 fptr->frag_off = htons(offset); 124 fptr->frag_off = htons(offset);
123 if (skb->next) 125 if (skb->next)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 7ae6c503f1ca..9b37f9747fc6 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1095,6 +1095,9 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
1095 1095
1096 if (!dst) { 1096 if (!dst) {
1097route_lookup: 1097route_lookup:
1098 /* add dsfield to flowlabel for route lookup */
1099 fl6->flowlabel = ip6_make_flowinfo(dsfield, fl6->flowlabel);
1100
1098 dst = ip6_route_output(net, NULL, fl6); 1101 dst = ip6_route_output(net, NULL, fl6);
1099 1102
1100 if (dst->error) 1103 if (dst->error)
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 9b522fa90e6d..ac826dd338ff 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -192,7 +192,7 @@ static struct inet_protosw pingv6_protosw = {
192 .type = SOCK_DGRAM, 192 .type = SOCK_DGRAM,
193 .protocol = IPPROTO_ICMPV6, 193 .protocol = IPPROTO_ICMPV6,
194 .prot = &pingv6_prot, 194 .prot = &pingv6_prot,
195 .ops = &inet6_dgram_ops, 195 .ops = &inet6_sockraw_ops,
196 .flags = INET_PROTOSW_REUSE, 196 .flags = INET_PROTOSW_REUSE,
197}; 197};
198 198
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 1f992d9e261d..60be012fe708 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1338,7 +1338,7 @@ void raw6_proc_exit(void)
1338#endif /* CONFIG_PROC_FS */ 1338#endif /* CONFIG_PROC_FS */
1339 1339
1340/* Same as inet6_dgram_ops, sans udp_poll. */ 1340/* Same as inet6_dgram_ops, sans udp_poll. */
1341static const struct proto_ops inet6_sockraw_ops = { 1341const struct proto_ops inet6_sockraw_ops = {
1342 .family = PF_INET6, 1342 .family = PF_INET6,
1343 .owner = THIS_MODULE, 1343 .owner = THIS_MODULE,
1344 .release = inet6_release, 1344 .release = inet6_release,
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c
index 0e015906f9ca..07d36573f50b 100644
--- a/net/ipv6/xfrm6_mode_ro.c
+++ b/net/ipv6/xfrm6_mode_ro.c
@@ -47,6 +47,8 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
47 iph = ipv6_hdr(skb); 47 iph = ipv6_hdr(skb);
48 48
49 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 49 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
50 if (hdr_len < 0)
51 return hdr_len;
50 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); 52 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
51 skb_set_network_header(skb, -x->props.header_len); 53 skb_set_network_header(skb, -x->props.header_len);
52 skb->transport_header = skb->network_header + hdr_len; 54 skb->transport_header = skb->network_header + hdr_len;
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
index 7a92c0f31912..9ad07a91708e 100644
--- a/net/ipv6/xfrm6_mode_transport.c
+++ b/net/ipv6/xfrm6_mode_transport.c
@@ -30,6 +30,8 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
30 skb_set_inner_transport_header(skb, skb_transport_offset(skb)); 30 skb_set_inner_transport_header(skb, skb_transport_offset(skb));
31 31
32 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 32 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
33 if (hdr_len < 0)
34 return hdr_len;
33 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); 35 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
34 skb_set_network_header(skb, -x->props.header_len); 36 skb_set_network_header(skb, -x->props.header_len);
35 skb->transport_header = skb->network_header + hdr_len; 37 skb->transport_header = skb->network_header + hdr_len;
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 60e2a62f7bef..cf2392b2ac71 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -7,7 +7,7 @@
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
9 * Copyright 2007-2010, Intel Corporation 9 * Copyright 2007-2010, Intel Corporation
10 * Copyright(c) 2015 Intel Deutschland GmbH 10 * Copyright(c) 2015-2017 Intel Deutschland GmbH
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -741,46 +741,43 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
741 ieee80211_agg_start_txq(sta, tid, true); 741 ieee80211_agg_start_txq(sta, tid, true);
742} 742}
743 743
744void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) 744void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
745 struct tid_ampdu_tx *tid_tx)
745{ 746{
746 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 747 struct ieee80211_sub_if_data *sdata = sta->sdata;
747 struct ieee80211_local *local = sdata->local; 748 struct ieee80211_local *local = sdata->local;
748 struct sta_info *sta;
749 struct tid_ampdu_tx *tid_tx;
750 749
751 trace_api_start_tx_ba_cb(sdata, ra, tid); 750 if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state)))
751 return;
752
753 if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state))
754 ieee80211_agg_tx_operational(local, sta, tid);
755}
756
757static struct tid_ampdu_tx *
758ieee80211_lookup_tid_tx(struct ieee80211_sub_if_data *sdata,
759 const u8 *ra, u16 tid, struct sta_info **sta)
760{
761 struct tid_ampdu_tx *tid_tx;
752 762
753 if (tid >= IEEE80211_NUM_TIDS) { 763 if (tid >= IEEE80211_NUM_TIDS) {
754 ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", 764 ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
755 tid, IEEE80211_NUM_TIDS); 765 tid, IEEE80211_NUM_TIDS);
756 return; 766 return NULL;
757 } 767 }
758 768
759 mutex_lock(&local->sta_mtx); 769 *sta = sta_info_get_bss(sdata, ra);
760 sta = sta_info_get_bss(sdata, ra); 770 if (!*sta) {
761 if (!sta) {
762 mutex_unlock(&local->sta_mtx);
763 ht_dbg(sdata, "Could not find station: %pM\n", ra); 771 ht_dbg(sdata, "Could not find station: %pM\n", ra);
764 return; 772 return NULL;
765 } 773 }
766 774
767 mutex_lock(&sta->ampdu_mlme.mtx); 775 tid_tx = rcu_dereference((*sta)->ampdu_mlme.tid_tx[tid]);
768 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
769 776
770 if (WARN_ON(!tid_tx)) { 777 if (WARN_ON(!tid_tx))
771 ht_dbg(sdata, "addBA was not requested!\n"); 778 ht_dbg(sdata, "addBA was not requested!\n");
772 goto unlock;
773 }
774 779
775 if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))) 780 return tid_tx;
776 goto unlock;
777
778 if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state))
779 ieee80211_agg_tx_operational(local, sta, tid);
780
781 unlock:
782 mutex_unlock(&sta->ampdu_mlme.mtx);
783 mutex_unlock(&local->sta_mtx);
784} 781}
785 782
786void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, 783void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
@@ -788,19 +785,20 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
788{ 785{
789 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 786 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
790 struct ieee80211_local *local = sdata->local; 787 struct ieee80211_local *local = sdata->local;
791 struct ieee80211_ra_tid *ra_tid; 788 struct sta_info *sta;
792 struct sk_buff *skb = dev_alloc_skb(0); 789 struct tid_ampdu_tx *tid_tx;
793 790
794 if (unlikely(!skb)) 791 trace_api_start_tx_ba_cb(sdata, ra, tid);
795 return;
796 792
797 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 793 rcu_read_lock();
798 memcpy(&ra_tid->ra, ra, ETH_ALEN); 794 tid_tx = ieee80211_lookup_tid_tx(sdata, ra, tid, &sta);
799 ra_tid->tid = tid; 795 if (!tid_tx)
796 goto out;
800 797
801 skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_START; 798 set_bit(HT_AGG_STATE_START_CB, &tid_tx->state);
802 skb_queue_tail(&sdata->skb_queue, skb); 799 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
803 ieee80211_queue_work(&local->hw, &sdata->work); 800 out:
801 rcu_read_unlock();
804} 802}
805EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); 803EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe);
806 804
@@ -860,37 +858,18 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid)
860} 858}
861EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); 859EXPORT_SYMBOL(ieee80211_stop_tx_ba_session);
862 860
863void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) 861void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
862 struct tid_ampdu_tx *tid_tx)
864{ 863{
865 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 864 struct ieee80211_sub_if_data *sdata = sta->sdata;
866 struct ieee80211_local *local = sdata->local;
867 struct sta_info *sta;
868 struct tid_ampdu_tx *tid_tx;
869 bool send_delba = false; 865 bool send_delba = false;
870 866
871 trace_api_stop_tx_ba_cb(sdata, ra, tid); 867 ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n",
872 868 sta->sta.addr, tid);
873 if (tid >= IEEE80211_NUM_TIDS) {
874 ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
875 tid, IEEE80211_NUM_TIDS);
876 return;
877 }
878
879 ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", ra, tid);
880
881 mutex_lock(&local->sta_mtx);
882
883 sta = sta_info_get_bss(sdata, ra);
884 if (!sta) {
885 ht_dbg(sdata, "Could not find station: %pM\n", ra);
886 goto unlock;
887 }
888 869
889 mutex_lock(&sta->ampdu_mlme.mtx);
890 spin_lock_bh(&sta->lock); 870 spin_lock_bh(&sta->lock);
891 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
892 871
893 if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 872 if (!test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
894 ht_dbg(sdata, 873 ht_dbg(sdata,
895 "unexpected callback to A-MPDU stop for %pM tid %d\n", 874 "unexpected callback to A-MPDU stop for %pM tid %d\n",
896 sta->sta.addr, tid); 875 sta->sta.addr, tid);
@@ -906,12 +885,8 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
906 spin_unlock_bh(&sta->lock); 885 spin_unlock_bh(&sta->lock);
907 886
908 if (send_delba) 887 if (send_delba)
909 ieee80211_send_delba(sdata, ra, tid, 888 ieee80211_send_delba(sdata, sta->sta.addr, tid,
910 WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); 889 WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
911
912 mutex_unlock(&sta->ampdu_mlme.mtx);
913 unlock:
914 mutex_unlock(&local->sta_mtx);
915} 890}
916 891
917void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, 892void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
@@ -919,19 +894,20 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
919{ 894{
920 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 895 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
921 struct ieee80211_local *local = sdata->local; 896 struct ieee80211_local *local = sdata->local;
922 struct ieee80211_ra_tid *ra_tid; 897 struct sta_info *sta;
923 struct sk_buff *skb = dev_alloc_skb(0); 898 struct tid_ampdu_tx *tid_tx;
924 899
925 if (unlikely(!skb)) 900 trace_api_stop_tx_ba_cb(sdata, ra, tid);
926 return;
927 901
928 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 902 rcu_read_lock();
929 memcpy(&ra_tid->ra, ra, ETH_ALEN); 903 tid_tx = ieee80211_lookup_tid_tx(sdata, ra, tid, &sta);
930 ra_tid->tid = tid; 904 if (!tid_tx)
905 goto out;
931 906
932 skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_STOP; 907 set_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state);
933 skb_queue_tail(&sdata->skb_queue, skb); 908 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
934 ieee80211_queue_work(&local->hw, &sdata->work); 909 out:
910 rcu_read_unlock();
935} 911}
936EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); 912EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe);
937 913
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index f4a528773563..6ca5442b1e03 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -7,6 +7,7 @@
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
9 * Copyright 2007-2010, Intel Corporation 9 * Copyright 2007-2010, Intel Corporation
10 * Copyright 2017 Intel Deutschland GmbH
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -289,8 +290,6 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
289{ 290{
290 int i; 291 int i;
291 292
292 cancel_work_sync(&sta->ampdu_mlme.work);
293
294 for (i = 0; i < IEEE80211_NUM_TIDS; i++) { 293 for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
295 __ieee80211_stop_tx_ba_session(sta, i, reason); 294 __ieee80211_stop_tx_ba_session(sta, i, reason);
296 __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT, 295 __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT,
@@ -298,6 +297,9 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
298 reason != AGG_STOP_DESTROY_STA && 297 reason != AGG_STOP_DESTROY_STA &&
299 reason != AGG_STOP_PEER_REQUEST); 298 reason != AGG_STOP_PEER_REQUEST);
300 } 299 }
300
301 /* stopping might queue the work again - so cancel only afterwards */
302 cancel_work_sync(&sta->ampdu_mlme.work);
301} 303}
302 304
303void ieee80211_ba_session_work(struct work_struct *work) 305void ieee80211_ba_session_work(struct work_struct *work)
@@ -352,10 +354,16 @@ void ieee80211_ba_session_work(struct work_struct *work)
352 spin_unlock_bh(&sta->lock); 354 spin_unlock_bh(&sta->lock);
353 355
354 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 356 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
355 if (tid_tx && test_and_clear_bit(HT_AGG_STATE_WANT_STOP, 357 if (!tid_tx)
356 &tid_tx->state)) 358 continue;
359
360 if (test_and_clear_bit(HT_AGG_STATE_START_CB, &tid_tx->state))
361 ieee80211_start_tx_ba_cb(sta, tid, tid_tx);
362 if (test_and_clear_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state))
357 ___ieee80211_stop_tx_ba_session(sta, tid, 363 ___ieee80211_stop_tx_ba_session(sta, tid,
358 AGG_STOP_LOCAL_REQUEST); 364 AGG_STOP_LOCAL_REQUEST);
365 if (test_and_clear_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state))
366 ieee80211_stop_tx_ba_cb(sta, tid, tid_tx);
359 } 367 }
360 mutex_unlock(&sta->ampdu_mlme.mtx); 368 mutex_unlock(&sta->ampdu_mlme.mtx);
361} 369}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f8f6c148f554..665501ac358f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1036,8 +1036,6 @@ struct ieee80211_rx_agg {
1036 1036
1037enum sdata_queue_type { 1037enum sdata_queue_type {
1038 IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, 1038 IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0,
1039 IEEE80211_SDATA_QUEUE_AGG_START = 1,
1040 IEEE80211_SDATA_QUEUE_AGG_STOP = 2,
1041 IEEE80211_SDATA_QUEUE_RX_AGG_START = 3, 1039 IEEE80211_SDATA_QUEUE_RX_AGG_START = 3,
1042 IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4, 1040 IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4,
1043}; 1041};
@@ -1427,12 +1425,6 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
1427 return local->hw.wiphy->bands[band]; 1425 return local->hw.wiphy->bands[band];
1428} 1426}
1429 1427
1430/* this struct represents 802.11n's RA/TID combination */
1431struct ieee80211_ra_tid {
1432 u8 ra[ETH_ALEN];
1433 u16 tid;
1434};
1435
1436/* this struct holds the value parsing from channel switch IE */ 1428/* this struct holds the value parsing from channel switch IE */
1437struct ieee80211_csa_ie { 1429struct ieee80211_csa_ie {
1438 struct cfg80211_chan_def chandef; 1430 struct cfg80211_chan_def chandef;
@@ -1794,8 +1786,10 @@ int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1794 enum ieee80211_agg_stop_reason reason); 1786 enum ieee80211_agg_stop_reason reason);
1795int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1787int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1796 enum ieee80211_agg_stop_reason reason); 1788 enum ieee80211_agg_stop_reason reason);
1797void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); 1789void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
1798void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); 1790 struct tid_ampdu_tx *tid_tx);
1791void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
1792 struct tid_ampdu_tx *tid_tx);
1799void ieee80211_ba_session_work(struct work_struct *work); 1793void ieee80211_ba_session_work(struct work_struct *work);
1800void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 1794void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
1801void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1795void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 3bd5b81f5d81..8fae1a72e6a7 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1237,7 +1237,6 @@ static void ieee80211_iface_work(struct work_struct *work)
1237 struct ieee80211_local *local = sdata->local; 1237 struct ieee80211_local *local = sdata->local;
1238 struct sk_buff *skb; 1238 struct sk_buff *skb;
1239 struct sta_info *sta; 1239 struct sta_info *sta;
1240 struct ieee80211_ra_tid *ra_tid;
1241 struct ieee80211_rx_agg *rx_agg; 1240 struct ieee80211_rx_agg *rx_agg;
1242 1241
1243 if (!ieee80211_sdata_running(sdata)) 1242 if (!ieee80211_sdata_running(sdata))
@@ -1253,15 +1252,7 @@ static void ieee80211_iface_work(struct work_struct *work)
1253 while ((skb = skb_dequeue(&sdata->skb_queue))) { 1252 while ((skb = skb_dequeue(&sdata->skb_queue))) {
1254 struct ieee80211_mgmt *mgmt = (void *)skb->data; 1253 struct ieee80211_mgmt *mgmt = (void *)skb->data;
1255 1254
1256 if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) { 1255 if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
1257 ra_tid = (void *)&skb->cb;
1258 ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra,
1259 ra_tid->tid);
1260 } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
1261 ra_tid = (void *)&skb->cb;
1262 ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra,
1263 ra_tid->tid);
1264 } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
1265 rx_agg = (void *)&skb->cb; 1256 rx_agg = (void *)&skb->cb;
1266 mutex_lock(&local->sta_mtx); 1257 mutex_lock(&local->sta_mtx);
1267 sta = sta_info_get_bss(sdata, rx_agg->addr); 1258 sta = sta_info_get_bss(sdata, rx_agg->addr);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 7cdf7a835bb0..403e3cc58b57 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2155,7 +2155,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
2155 struct ieee80211_sta_rx_stats *cpurxs; 2155 struct ieee80211_sta_rx_stats *cpurxs;
2156 2156
2157 cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu); 2157 cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu);
2158 sinfo->rx_packets += cpurxs->dropped; 2158 sinfo->rx_dropped_misc += cpurxs->dropped;
2159 } 2159 }
2160 } 2160 }
2161 2161
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 5609cacb20d5..ea0747d6a6da 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -116,6 +116,8 @@ enum ieee80211_sta_info_flags {
116#define HT_AGG_STATE_STOPPING 3 116#define HT_AGG_STATE_STOPPING 3
117#define HT_AGG_STATE_WANT_START 4 117#define HT_AGG_STATE_WANT_START 4
118#define HT_AGG_STATE_WANT_STOP 5 118#define HT_AGG_STATE_WANT_STOP 5
119#define HT_AGG_STATE_START_CB 6
120#define HT_AGG_STATE_STOP_CB 7
119 121
120enum ieee80211_agg_stop_reason { 122enum ieee80211_agg_stop_reason {
121 AGG_STOP_DECLINED, 123 AGG_STOP_DECLINED,
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 257ec66009da..7b05fd1497ce 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1418,7 +1418,7 @@ static void mpls_ifup(struct net_device *dev, unsigned int flags)
1418 continue; 1418 continue;
1419 alive++; 1419 alive++;
1420 nh_flags &= ~flags; 1420 nh_flags &= ~flags;
1421 WRITE_ONCE(nh->nh_flags, flags); 1421 WRITE_ONCE(nh->nh_flags, nh_flags);
1422 } endfor_nexthops(rt); 1422 } endfor_nexthops(rt);
1423 1423
1424 WRITE_ONCE(rt->rt_nhn_alive, alive); 1424 WRITE_ONCE(rt->rt_nhn_alive, alive);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9799a50bc604..a8be9b72e6cd 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -890,8 +890,13 @@ restart:
890 } 890 }
891out: 891out:
892 local_bh_enable(); 892 local_bh_enable();
893 if (last) 893 if (last) {
894 /* nf ct hash resize happened, now clear the leftover. */
895 if ((struct nf_conn *)cb->args[1] == last)
896 cb->args[1] = 0;
897
894 nf_ct_put(last); 898 nf_ct_put(last);
899 }
895 900
896 while (i) { 901 while (i) {
897 i--; 902 i--;
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 13875d599a85..1c5b14a6cab3 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -512,16 +512,19 @@ static int sctp_error(struct net *net, struct nf_conn *tpl, struct sk_buff *skb,
512 u8 pf, unsigned int hooknum) 512 u8 pf, unsigned int hooknum)
513{ 513{
514 const struct sctphdr *sh; 514 const struct sctphdr *sh;
515 struct sctphdr _sctph;
516 const char *logmsg; 515 const char *logmsg;
517 516
518 sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); 517 if (skb->len < dataoff + sizeof(struct sctphdr)) {
519 if (!sh) {
520 logmsg = "nf_ct_sctp: short packet "; 518 logmsg = "nf_ct_sctp: short packet ";
521 goto out_invalid; 519 goto out_invalid;
522 } 520 }
523 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && 521 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
524 skb->ip_summed == CHECKSUM_NONE) { 522 skb->ip_summed == CHECKSUM_NONE) {
523 if (!skb_make_writable(skb, dataoff + sizeof(struct sctphdr))) {
524 logmsg = "nf_ct_sctp: failed to read header ";
525 goto out_invalid;
526 }
527 sh = (const struct sctphdr *)(skb->data + dataoff);
525 if (sh->checksum != sctp_compute_cksum(skb, dataoff)) { 528 if (sh->checksum != sctp_compute_cksum(skb, dataoff)) {
526 logmsg = "nf_ct_sctp: bad CRC "; 529 logmsg = "nf_ct_sctp: bad CRC ";
527 goto out_invalid; 530 goto out_invalid;
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index ef0be325a0c6..6c72922d20ca 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -566,7 +566,7 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
566 * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() 566 * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
567 * will delete entry from already-freed table. 567 * will delete entry from already-freed table.
568 */ 568 */
569 ct->status &= ~IPS_NAT_DONE_MASK; 569 clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
570 rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource, 570 rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
571 nf_nat_bysource_params); 571 nf_nat_bysource_params);
572 572
diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index e97e2fb53f0a..fbdbaa00dd5f 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -116,17 +116,17 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
116 else if (d > 0) 116 else if (d > 0)
117 p = &parent->rb_right; 117 p = &parent->rb_right;
118 else { 118 else {
119 if (nft_set_elem_active(&rbe->ext, genmask)) { 119 if (nft_rbtree_interval_end(rbe) &&
120 if (nft_rbtree_interval_end(rbe) && 120 !nft_rbtree_interval_end(new)) {
121 !nft_rbtree_interval_end(new)) 121 p = &parent->rb_left;
122 p = &parent->rb_left; 122 } else if (!nft_rbtree_interval_end(rbe) &&
123 else if (!nft_rbtree_interval_end(rbe) && 123 nft_rbtree_interval_end(new)) {
124 nft_rbtree_interval_end(new)) 124 p = &parent->rb_right;
125 p = &parent->rb_right; 125 } else if (nft_set_elem_active(&rbe->ext, genmask)) {
126 else { 126 *ext = &rbe->ext;
127 *ext = &rbe->ext; 127 return -EEXIST;
128 return -EEXIST; 128 } else {
129 } 129 p = &parent->rb_left;
130 } 130 }
131 } 131 }
132 } 132 }
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index ee841f00a6ec..7586d446d7dc 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -62,6 +62,7 @@
62#include <asm/cacheflush.h> 62#include <asm/cacheflush.h>
63#include <linux/hash.h> 63#include <linux/hash.h>
64#include <linux/genetlink.h> 64#include <linux/genetlink.h>
65#include <linux/net_namespace.h>
65 66
66#include <net/net_namespace.h> 67#include <net/net_namespace.h>
67#include <net/sock.h> 68#include <net/sock.h>
@@ -1415,7 +1416,8 @@ static void do_one_broadcast(struct sock *sk,
1415 goto out; 1416 goto out;
1416 } 1417 }
1417 NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net); 1418 NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
1418 NETLINK_CB(p->skb2).nsid_is_set = true; 1419 if (NETLINK_CB(p->skb2).nsid != NETNSA_NSID_NOT_ASSIGNED)
1420 NETLINK_CB(p->skb2).nsid_is_set = true;
1419 val = netlink_broadcast_deliver(sk, p->skb2); 1421 val = netlink_broadcast_deliver(sk, p->skb2);
1420 if (val < 0) { 1422 if (val < 0) {
1421 netlink_overrun(sk); 1423 netlink_overrun(sk);