aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/ip-sysctl.txt2
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts15
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts15
-rw-r--r--drivers/isdn/hardware/eicon/message.c2
-rw-r--r--drivers/net/ethernet/atheros/alx/main.c24
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c23
-rw-r--r--drivers/net/ethernet/cadence/at91_ether.c10
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c2
-rw-r--r--drivers/net/ethernet/dnet.c18
-rw-r--r--drivers/net/ethernet/freescale/fec.h2
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c10
-rw-r--r--drivers/net/ethernet/intel/Kconfig11
-rw-r--r--drivers/net/ethernet/intel/i40e/Makefile2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_osdep.h4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c104
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.h1
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c9
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h5
-rw-r--r--drivers/net/ethernet/ti/cpsw.c11
-rw-r--r--drivers/net/ethernet/ti/cpsw_ale.c10
-rw-r--r--drivers/net/ethernet/ti/cpsw_ale.h2
-rw-r--r--drivers/net/team/team.c16
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-8000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fw-file.h4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c19
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/utils.c2
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c4
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c32
-rw-r--r--drivers/net/xen-netfront.c71
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--include/uapi/linux/openvswitch.h4
-rw-r--r--net/bridge/br_input.c3
-rw-r--r--net/core/neighbour.c44
-rw-r--r--net/ipv4/netfilter/nft_redir_ipv4.c8
-rw-r--r--net/ipv6/netfilter/nft_redir_ipv6.c8
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c10
-rw-r--r--net/netfilter/nf_conntrack_core.c20
-rw-r--r--net/netfilter/nf_tables_api.c14
-rw-r--r--net/netfilter/nfnetlink.c5
-rw-r--r--net/netfilter/nft_nat.c8
-rw-r--r--net/openvswitch/datapath.c3
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/tipc/bcast.c5
49 files changed, 419 insertions, 175 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 9bffdfc648dc..85b022179104 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -66,6 +66,8 @@ fwmark_reflect - BOOLEAN
66route/max_size - INTEGER 66route/max_size - INTEGER
67 Maximum number of routes allowed in the kernel. Increase 67 Maximum number of routes allowed in the kernel. Increase
68 this when using large numbers of interfaces and/or routes. 68 this when using large numbers of interfaces and/or routes.
69 From linux kernel 3.6 onwards, this is deprecated for ipv4
70 as route cache is no longer used.
69 71
70neigh/default/gc_thresh1 - INTEGER 72neigh/default/gc_thresh1 - INTEGER
71 Minimum number of entries to keep. Garbage collector will not 73 Minimum number of entries to keep. Garbage collector will not
diff --git a/MAINTAINERS b/MAINTAINERS
index 8bed045c0c48..600d2aad8276 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4749,7 +4749,7 @@ S: Supported
4749F: drivers/scsi/ipr.* 4749F: drivers/scsi/ipr.*
4750 4750
4751IBM Power Virtual Ethernet Device Driver 4751IBM Power Virtual Ethernet Device Driver
4752M: Santiago Leon <santil@linux.vnet.ibm.com> 4752M: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
4753L: netdev@vger.kernel.org 4753L: netdev@vger.kernel.org
4754S: Supported 4754S: Supported
4755F: drivers/net/ethernet/ibm/ibmveth.* 4755F: drivers/net/ethernet/ibm/ibmveth.*
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 1e6e5cc1c14c..8c1febd7e3f2 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -159,13 +159,28 @@
159 pinctrl-0 = <&pinctrl_enet1>; 159 pinctrl-0 = <&pinctrl_enet1>;
160 phy-supply = <&reg_enet_3v3>; 160 phy-supply = <&reg_enet_3v3>;
161 phy-mode = "rgmii"; 161 phy-mode = "rgmii";
162 phy-handle = <&ethphy1>;
162 status = "okay"; 163 status = "okay";
164
165 mdio {
166 #address-cells = <1>;
167 #size-cells = <0>;
168
169 ethphy1: ethernet-phy@0 {
170 reg = <0>;
171 };
172
173 ethphy2: ethernet-phy@1 {
174 reg = <1>;
175 };
176 };
163}; 177};
164 178
165&fec2 { 179&fec2 {
166 pinctrl-names = "default"; 180 pinctrl-names = "default";
167 pinctrl-0 = <&pinctrl_enet2>; 181 pinctrl-0 = <&pinctrl_enet2>;
168 phy-mode = "rgmii"; 182 phy-mode = "rgmii";
183 phy-handle = <&ethphy2>;
169 status = "okay"; 184 status = "okay";
170}; 185};
171 186
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index a0f762159cb2..f2b64b1b00fa 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -129,13 +129,28 @@
129 129
130&fec0 { 130&fec0 {
131 phy-mode = "rmii"; 131 phy-mode = "rmii";
132 phy-handle = <&ethphy0>;
132 pinctrl-names = "default"; 133 pinctrl-names = "default";
133 pinctrl-0 = <&pinctrl_fec0>; 134 pinctrl-0 = <&pinctrl_fec0>;
134 status = "okay"; 135 status = "okay";
136
137 mdio {
138 #address-cells = <1>;
139 #size-cells = <0>;
140
141 ethphy0: ethernet-phy@0 {
142 reg = <0>;
143 };
144
145 ethphy1: ethernet-phy@1 {
146 reg = <1>;
147 };
148 };
135}; 149};
136 150
137&fec1 { 151&fec1 {
138 phy-mode = "rmii"; 152 phy-mode = "rmii";
153 phy-handle = <&ethphy1>;
139 pinctrl-names = "default"; 154 pinctrl-names = "default";
140 pinctrl-0 = <&pinctrl_fec1>; 155 pinctrl-0 = <&pinctrl_fec1>;
141 status = "okay"; 156 status = "okay";
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index a82e542ffc21..0b380603a578 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -4880,7 +4880,7 @@ static void sig_ind(PLCI *plci)
4880 byte SS_Ind[] = "\x05\x02\x00\x02\x00\x00"; /* Hold_Ind struct*/ 4880 byte SS_Ind[] = "\x05\x02\x00\x02\x00\x00"; /* Hold_Ind struct*/
4881 byte CF_Ind[] = "\x09\x02\x00\x06\x00\x00\x00\x00\x00\x00"; 4881 byte CF_Ind[] = "\x09\x02\x00\x06\x00\x00\x00\x00\x00\x00";
4882 byte Interr_Err_Ind[] = "\x0a\x02\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 4882 byte Interr_Err_Ind[] = "\x0a\x02\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
4883 byte CONF_Ind[] = "\x09\x16\x00\x06\x00\x00\0x00\0x00\0x00\0x00"; 4883 byte CONF_Ind[] = "\x09\x16\x00\x06\x00\x00\x00\x00\x00\x00";
4884 byte force_mt_info = false; 4884 byte force_mt_info = false;
4885 byte dir; 4885 byte dir;
4886 dword d; 4886 dword d;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index e398eda07298..c8af3ce3ea38 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx)
184 schedule_work(&alx->reset_wk); 184 schedule_work(&alx->reset_wk);
185} 185}
186 186
187static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) 187static int alx_clean_rx_irq(struct alx_priv *alx, int budget)
188{ 188{
189 struct alx_rx_queue *rxq = &alx->rxq; 189 struct alx_rx_queue *rxq = &alx->rxq;
190 struct alx_rrd *rrd; 190 struct alx_rrd *rrd;
191 struct alx_buffer *rxb; 191 struct alx_buffer *rxb;
192 struct sk_buff *skb; 192 struct sk_buff *skb;
193 u16 length, rfd_cleaned = 0; 193 u16 length, rfd_cleaned = 0;
194 int work = 0;
194 195
195 while (budget > 0) { 196 while (work < budget) {
196 rrd = &rxq->rrd[rxq->rrd_read_idx]; 197 rrd = &rxq->rrd[rxq->rrd_read_idx];
197 if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) 198 if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT)))
198 break; 199 break;
@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
203 ALX_GET_FIELD(le32_to_cpu(rrd->word0), 204 ALX_GET_FIELD(le32_to_cpu(rrd->word0),
204 RRD_NOR) != 1) { 205 RRD_NOR) != 1) {
205 alx_schedule_reset(alx); 206 alx_schedule_reset(alx);
206 return 0; 207 return work;
207 } 208 }
208 209
209 rxb = &rxq->bufs[rxq->read_idx]; 210 rxb = &rxq->bufs[rxq->read_idx];
@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
243 } 244 }
244 245
245 napi_gro_receive(&alx->napi, skb); 246 napi_gro_receive(&alx->napi, skb);
246 budget--; 247 work++;
247 248
248next_pkt: 249next_pkt:
249 if (++rxq->read_idx == alx->rx_ringsz) 250 if (++rxq->read_idx == alx->rx_ringsz)
@@ -258,21 +259,22 @@ next_pkt:
258 if (rfd_cleaned) 259 if (rfd_cleaned)
259 alx_refill_rx_ring(alx, GFP_ATOMIC); 260 alx_refill_rx_ring(alx, GFP_ATOMIC);
260 261
261 return budget > 0; 262 return work;
262} 263}
263 264
264static int alx_poll(struct napi_struct *napi, int budget) 265static int alx_poll(struct napi_struct *napi, int budget)
265{ 266{
266 struct alx_priv *alx = container_of(napi, struct alx_priv, napi); 267 struct alx_priv *alx = container_of(napi, struct alx_priv, napi);
267 struct alx_hw *hw = &alx->hw; 268 struct alx_hw *hw = &alx->hw;
268 bool complete = true;
269 unsigned long flags; 269 unsigned long flags;
270 bool tx_complete;
271 int work;
270 272
271 complete = alx_clean_tx_irq(alx) && 273 tx_complete = alx_clean_tx_irq(alx);
272 alx_clean_rx_irq(alx, budget); 274 work = alx_clean_rx_irq(alx, budget);
273 275
274 if (!complete) 276 if (!tx_complete || work == budget)
275 return 1; 277 return budget;
276 278
277 napi_complete(&alx->napi); 279 napi_complete(&alx->napi);
278 280
@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget)
284 286
285 alx_post_write(hw); 287 alx_post_write(hw);
286 288
287 return 0; 289 return work;
288} 290}
289 291
290static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) 292static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 553dcd8a9df2..96bf01ba32dd 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7413,6 +7413,8 @@ static inline void tg3_netif_start(struct tg3 *tp)
7413} 7413}
7414 7414
7415static void tg3_irq_quiesce(struct tg3 *tp) 7415static void tg3_irq_quiesce(struct tg3 *tp)
7416 __releases(tp->lock)
7417 __acquires(tp->lock)
7416{ 7418{
7417 int i; 7419 int i;
7418 7420
@@ -7421,8 +7423,12 @@ static void tg3_irq_quiesce(struct tg3 *tp)
7421 tp->irq_sync = 1; 7423 tp->irq_sync = 1;
7422 smp_mb(); 7424 smp_mb();
7423 7425
7426 spin_unlock_bh(&tp->lock);
7427
7424 for (i = 0; i < tp->irq_cnt; i++) 7428 for (i = 0; i < tp->irq_cnt; i++)
7425 synchronize_irq(tp->napi[i].irq_vec); 7429 synchronize_irq(tp->napi[i].irq_vec);
7430
7431 spin_lock_bh(&tp->lock);
7426} 7432}
7427 7433
7428/* Fully shutdown all tg3 driver activity elsewhere in the system. 7434/* Fully shutdown all tg3 driver activity elsewhere in the system.
@@ -9018,6 +9024,8 @@ static void tg3_restore_clk(struct tg3 *tp)
9018 9024
9019/* tp->lock is held. */ 9025/* tp->lock is held. */
9020static int tg3_chip_reset(struct tg3 *tp) 9026static int tg3_chip_reset(struct tg3 *tp)
9027 __releases(tp->lock)
9028 __acquires(tp->lock)
9021{ 9029{
9022 u32 val; 9030 u32 val;
9023 void (*write_op)(struct tg3 *, u32, u32); 9031 void (*write_op)(struct tg3 *, u32, u32);
@@ -9073,9 +9081,13 @@ static int tg3_chip_reset(struct tg3 *tp)
9073 } 9081 }
9074 smp_mb(); 9082 smp_mb();
9075 9083
9084 tg3_full_unlock(tp);
9085
9076 for (i = 0; i < tp->irq_cnt; i++) 9086 for (i = 0; i < tp->irq_cnt; i++)
9077 synchronize_irq(tp->napi[i].irq_vec); 9087 synchronize_irq(tp->napi[i].irq_vec);
9078 9088
9089 tg3_full_lock(tp, 0);
9090
9079 if (tg3_asic_rev(tp) == ASIC_REV_57780) { 9091 if (tg3_asic_rev(tp) == ASIC_REV_57780) {
9080 val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN; 9092 val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN;
9081 tw32(TG3_PCIE_LNKCTL, val | TG3_PCIE_LNKCTL_L1_PLL_PD_DIS); 9093 tw32(TG3_PCIE_LNKCTL, val | TG3_PCIE_LNKCTL_L1_PLL_PD_DIS);
@@ -10903,11 +10915,13 @@ static void tg3_timer(unsigned long __opaque)
10903{ 10915{
10904 struct tg3 *tp = (struct tg3 *) __opaque; 10916 struct tg3 *tp = (struct tg3 *) __opaque;
10905 10917
10906 if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING))
10907 goto restart_timer;
10908
10909 spin_lock(&tp->lock); 10918 spin_lock(&tp->lock);
10910 10919
10920 if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING)) {
10921 spin_unlock(&tp->lock);
10922 goto restart_timer;
10923 }
10924
10911 if (tg3_asic_rev(tp) == ASIC_REV_5717 || 10925 if (tg3_asic_rev(tp) == ASIC_REV_5717 ||
10912 tg3_flag(tp, 57765_CLASS)) 10926 tg3_flag(tp, 57765_CLASS))
10913 tg3_chk_missed_msi(tp); 10927 tg3_chk_missed_msi(tp);
@@ -11101,11 +11115,13 @@ static void tg3_reset_task(struct work_struct *work)
11101 struct tg3 *tp = container_of(work, struct tg3, reset_task); 11115 struct tg3 *tp = container_of(work, struct tg3, reset_task);
11102 int err; 11116 int err;
11103 11117
11118 rtnl_lock();
11104 tg3_full_lock(tp, 0); 11119 tg3_full_lock(tp, 0);
11105 11120
11106 if (!netif_running(tp->dev)) { 11121 if (!netif_running(tp->dev)) {
11107 tg3_flag_clear(tp, RESET_TASK_PENDING); 11122 tg3_flag_clear(tp, RESET_TASK_PENDING);
11108 tg3_full_unlock(tp); 11123 tg3_full_unlock(tp);
11124 rtnl_unlock();
11109 return; 11125 return;
11110 } 11126 }
11111 11127
@@ -11138,6 +11154,7 @@ out:
11138 tg3_phy_start(tp); 11154 tg3_phy_start(tp);
11139 11155
11140 tg3_flag_clear(tp, RESET_TASK_PENDING); 11156 tg3_flag_clear(tp, RESET_TASK_PENDING);
11157 rtnl_unlock();
11141} 11158}
11142 11159
11143static int tg3_request_irq(struct tg3 *tp, int irq_num) 11160static int tg3_request_irq(struct tg3 *tp, int irq_num)
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 55eb7f2af2b4..7ef55f5fa664 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -340,7 +340,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
340 res = PTR_ERR(lp->pclk); 340 res = PTR_ERR(lp->pclk);
341 goto err_free_dev; 341 goto err_free_dev;
342 } 342 }
343 clk_enable(lp->pclk); 343 clk_prepare_enable(lp->pclk);
344 344
345 lp->hclk = ERR_PTR(-ENOENT); 345 lp->hclk = ERR_PTR(-ENOENT);
346 lp->tx_clk = ERR_PTR(-ENOENT); 346 lp->tx_clk = ERR_PTR(-ENOENT);
@@ -406,7 +406,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
406err_out_unregister_netdev: 406err_out_unregister_netdev:
407 unregister_netdev(dev); 407 unregister_netdev(dev);
408err_disable_clock: 408err_disable_clock:
409 clk_disable(lp->pclk); 409 clk_disable_unprepare(lp->pclk);
410err_free_dev: 410err_free_dev:
411 free_netdev(dev); 411 free_netdev(dev);
412 return res; 412 return res;
@@ -424,7 +424,7 @@ static int at91ether_remove(struct platform_device *pdev)
424 kfree(lp->mii_bus->irq); 424 kfree(lp->mii_bus->irq);
425 mdiobus_free(lp->mii_bus); 425 mdiobus_free(lp->mii_bus);
426 unregister_netdev(dev); 426 unregister_netdev(dev);
427 clk_disable(lp->pclk); 427 clk_disable_unprepare(lp->pclk);
428 free_netdev(dev); 428 free_netdev(dev);
429 429
430 return 0; 430 return 0;
@@ -440,7 +440,7 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg)
440 netif_stop_queue(net_dev); 440 netif_stop_queue(net_dev);
441 netif_device_detach(net_dev); 441 netif_device_detach(net_dev);
442 442
443 clk_disable(lp->pclk); 443 clk_disable_unprepare(lp->pclk);
444 } 444 }
445 return 0; 445 return 0;
446} 446}
@@ -451,7 +451,7 @@ static int at91ether_resume(struct platform_device *pdev)
451 struct macb *lp = netdev_priv(net_dev); 451 struct macb *lp = netdev_priv(net_dev);
452 452
453 if (netif_running(net_dev)) { 453 if (netif_running(net_dev)) {
454 clk_enable(lp->pclk); 454 clk_prepare_enable(lp->pclk);
455 455
456 netif_device_attach(net_dev); 456 netif_device_attach(net_dev);
457 netif_start_queue(net_dev); 457 netif_start_queue(net_dev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index 2215d432a059..a936ee8958c7 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -2430,7 +2430,7 @@ static void cfg_queues(struct adapter *adapter)
2430 */ 2430 */
2431 n10g = 0; 2431 n10g = 0;
2432 for_each_port(adapter, pidx) 2432 for_each_port(adapter, pidx)
2433 n10g += is_10g_port(&adap2pinfo(adapter, pidx)->link_cfg); 2433 n10g += is_x_10g_port(&adap2pinfo(adapter, pidx)->link_cfg);
2434 2434
2435 /* 2435 /*
2436 * We default to 1 queue per non-10G port and up to # of cores queues 2436 * We default to 1 queue per non-10G port and up to # of cores queues
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
index 21dc9a20308c..60426cf890a7 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
@@ -323,6 +323,8 @@ int t4vf_port_init(struct adapter *adapter, int pidx)
323 return v; 323 return v;
324 324
325 v = be32_to_cpu(port_rpl.u.info.lstatus_to_modtype); 325 v = be32_to_cpu(port_rpl.u.info.lstatus_to_modtype);
326 pi->mdio_addr = (v & FW_PORT_CMD_MDIOCAP_F) ?
327 FW_PORT_CMD_MDIOADDR_G(v) : -1;
326 pi->port_type = FW_PORT_CMD_PTYPE_G(v); 328 pi->port_type = FW_PORT_CMD_PTYPE_G(v);
327 pi->mod_type = FW_PORT_MOD_TYPE_NA; 329 pi->mod_type = FW_PORT_MOD_TYPE_NA;
328 330
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
index a379c3e4b57f..13d00a38a5bd 100644
--- a/drivers/net/ethernet/dnet.c
+++ b/drivers/net/ethernet/dnet.c
@@ -398,13 +398,8 @@ static int dnet_poll(struct napi_struct *napi, int budget)
398 * break out of while loop if there are no more 398 * break out of while loop if there are no more
399 * packets waiting 399 * packets waiting
400 */ 400 */
401 if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16)) { 401 if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16))
402 napi_complete(napi); 402 break;
403 int_enable = dnet_readl(bp, INTR_ENB);
404 int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
405 dnet_writel(bp, int_enable, INTR_ENB);
406 return 0;
407 }
408 403
409 cmd_word = dnet_readl(bp, RX_LEN_FIFO); 404 cmd_word = dnet_readl(bp, RX_LEN_FIFO);
410 pkt_len = cmd_word & 0xFFFF; 405 pkt_len = cmd_word & 0xFFFF;
@@ -433,20 +428,17 @@ static int dnet_poll(struct napi_struct *napi, int budget)
433 "size %u.\n", dev->name, pkt_len); 428 "size %u.\n", dev->name, pkt_len);
434 } 429 }
435 430
436 budget -= npackets;
437
438 if (npackets < budget) { 431 if (npackets < budget) {
439 /* We processed all packets available. Tell NAPI it can 432 /* We processed all packets available. Tell NAPI it can
440 * stop polling then re-enable rx interrupts */ 433 * stop polling then re-enable rx interrupts.
434 */
441 napi_complete(napi); 435 napi_complete(napi);
442 int_enable = dnet_readl(bp, INTR_ENB); 436 int_enable = dnet_readl(bp, INTR_ENB);
443 int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF; 437 int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
444 dnet_writel(bp, int_enable, INTR_ENB); 438 dnet_writel(bp, int_enable, INTR_ENB);
445 return 0;
446 } 439 }
447 440
448 /* There are still packets waiting */ 441 return npackets;
449 return 1;
450} 442}
451 443
452static irqreturn_t dnet_interrupt(int irq, void *dev_id) 444static irqreturn_t dnet_interrupt(int irq, void *dev_id)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 469691ad4a1e..40132929daf7 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -424,6 +424,8 @@ struct bufdesc_ex {
424 * (40ns * 6). 424 * (40ns * 6).
425 */ 425 */
426#define FEC_QUIRK_BUG_CAPTURE (1 << 10) 426#define FEC_QUIRK_BUG_CAPTURE (1 << 10)
427/* Controller has only one MDIO bus */
428#define FEC_QUIRK_SINGLE_MDIO (1 << 11)
427 429
428struct fec_enet_priv_tx_q { 430struct fec_enet_priv_tx_q {
429 int index; 431 int index;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 5ebdf8dc8a31..bba87775419d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -91,7 +91,8 @@ static struct platform_device_id fec_devtype[] = {
91 .driver_data = 0, 91 .driver_data = 0,
92 }, { 92 }, {
93 .name = "imx28-fec", 93 .name = "imx28-fec",
94 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, 94 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
95 FEC_QUIRK_SINGLE_MDIO,
95 }, { 96 }, {
96 .name = "imx6q-fec", 97 .name = "imx6q-fec",
97 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 98 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
@@ -1937,7 +1938,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
1937 int err = -ENXIO, i; 1938 int err = -ENXIO, i;
1938 1939
1939 /* 1940 /*
1940 * The dual fec interfaces are not equivalent with enet-mac. 1941 * The i.MX28 dual fec interfaces are not equal.
1941 * Here are the differences: 1942 * Here are the differences:
1942 * 1943 *
1943 * - fec0 supports MII & RMII modes while fec1 only supports RMII 1944 * - fec0 supports MII & RMII modes while fec1 only supports RMII
@@ -1952,7 +1953,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
1952 * mdio interface in board design, and need to be configured by 1953 * mdio interface in board design, and need to be configured by
1953 * fec0 mii_bus. 1954 * fec0 mii_bus.
1954 */ 1955 */
1955 if ((fep->quirks & FEC_QUIRK_ENET_MAC) && fep->dev_id > 0) { 1956 if ((fep->quirks & FEC_QUIRK_SINGLE_MDIO) && fep->dev_id > 0) {
1956 /* fec1 uses fec0 mii_bus */ 1957 /* fec1 uses fec0 mii_bus */
1957 if (mii_cnt && fec0_mii_bus) { 1958 if (mii_cnt && fec0_mii_bus) {
1958 fep->mii_bus = fec0_mii_bus; 1959 fep->mii_bus = fec0_mii_bus;
@@ -2015,7 +2016,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
2015 mii_cnt++; 2016 mii_cnt++;
2016 2017
2017 /* save fec0 mii_bus */ 2018 /* save fec0 mii_bus */
2018 if (fep->quirks & FEC_QUIRK_ENET_MAC) 2019 if (fep->quirks & FEC_QUIRK_SINGLE_MDIO)
2019 fec0_mii_bus = fep->mii_bus; 2020 fec0_mii_bus = fep->mii_bus;
2020 2021
2021 return 0; 2022 return 0;
@@ -3129,6 +3130,7 @@ fec_probe(struct platform_device *pdev)
3129 pdev->id_entry = of_id->data; 3130 pdev->id_entry = of_id->data;
3130 fep->quirks = pdev->id_entry->driver_data; 3131 fep->quirks = pdev->id_entry->driver_data;
3131 3132
3133 fep->netdev = ndev;
3132 fep->num_rx_queues = num_rx_qs; 3134 fep->num_rx_queues = num_rx_qs;
3133 fep->num_tx_queues = num_tx_qs; 3135 fep->num_tx_queues = num_tx_qs;
3134 3136
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index 5b8300a32bf5..4d61ef50b465 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -281,6 +281,17 @@ config I40E_DCB
281 281
282 If unsure, say N. 282 If unsure, say N.
283 283
284config I40E_FCOE
285 bool "Fibre Channel over Ethernet (FCoE)"
286 default n
287 depends on I40E && DCB && FCOE
288 ---help---
289 Say Y here if you want to use Fibre Channel over Ethernet (FCoE)
290 in the driver. This will create new netdev for exclusive FCoE
291 use with XL710 FCoE offloads enabled.
292
293 If unsure, say N.
294
284config I40EVF 295config I40EVF
285 tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" 296 tristate "Intel(R) XL710 X710 Virtual Function Ethernet support"
286 depends on PCI_MSI 297 depends on PCI_MSI
diff --git a/drivers/net/ethernet/intel/i40e/Makefile b/drivers/net/ethernet/intel/i40e/Makefile
index 4b94ddb29c24..c40581999121 100644
--- a/drivers/net/ethernet/intel/i40e/Makefile
+++ b/drivers/net/ethernet/intel/i40e/Makefile
@@ -44,4 +44,4 @@ i40e-objs := i40e_main.o \
44 i40e_virtchnl_pf.o 44 i40e_virtchnl_pf.o
45 45
46i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o 46i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o
47i40e-$(CONFIG_FCOE:m=y) += i40e_fcoe.o 47i40e-$(CONFIG_I40E_FCOE) += i40e_fcoe.o
diff --git a/drivers/net/ethernet/intel/i40e/i40e_osdep.h b/drivers/net/ethernet/intel/i40e/i40e_osdep.h
index 045b5c4b98b3..ad802dd0f67a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_osdep.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_osdep.h
@@ -78,7 +78,7 @@ do { \
78} while (0) 78} while (0)
79 79
80typedef enum i40e_status_code i40e_status; 80typedef enum i40e_status_code i40e_status;
81#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 81#ifdef CONFIG_I40E_FCOE
82#define I40E_FCOE 82#define I40E_FCOE
83#endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */ 83#endif
84#endif /* _I40E_OSDEP_H_ */ 84#endif /* _I40E_OSDEP_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 04b441460bbd..cecb340898fe 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -658,6 +658,8 @@ static inline u32 i40e_get_head(struct i40e_ring *tx_ring)
658 return le32_to_cpu(*(volatile __le32 *)head); 658 return le32_to_cpu(*(volatile __le32 *)head);
659} 659}
660 660
661#define WB_STRIDE 0x3
662
661/** 663/**
662 * i40e_clean_tx_irq - Reclaim resources after transmit completes 664 * i40e_clean_tx_irq - Reclaim resources after transmit completes
663 * @tx_ring: tx ring to clean 665 * @tx_ring: tx ring to clean
@@ -759,6 +761,18 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
759 tx_ring->q_vector->tx.total_bytes += total_bytes; 761 tx_ring->q_vector->tx.total_bytes += total_bytes;
760 tx_ring->q_vector->tx.total_packets += total_packets; 762 tx_ring->q_vector->tx.total_packets += total_packets;
761 763
764 /* check to see if there are any non-cache aligned descriptors
765 * waiting to be written back, and kick the hardware to force
766 * them to be written back in case of napi polling
767 */
768 if (budget &&
769 !((i & WB_STRIDE) == WB_STRIDE) &&
770 !test_bit(__I40E_DOWN, &tx_ring->vsi->state) &&
771 (I40E_DESC_UNUSED(tx_ring) != tx_ring->count))
772 tx_ring->arm_wb = true;
773 else
774 tx_ring->arm_wb = false;
775
762 if (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) { 776 if (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) {
763 /* schedule immediate reset if we believe we hung */ 777 /* schedule immediate reset if we believe we hung */
764 dev_info(tx_ring->dev, "Detected Tx Unit Hang\n" 778 dev_info(tx_ring->dev, "Detected Tx Unit Hang\n"
@@ -777,13 +791,16 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
777 netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); 791 netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
778 792
779 dev_info(tx_ring->dev, 793 dev_info(tx_ring->dev,
780 "tx hang detected on queue %d, resetting adapter\n", 794 "tx hang detected on queue %d, reset requested\n",
781 tx_ring->queue_index); 795 tx_ring->queue_index);
782 796
783 tx_ring->netdev->netdev_ops->ndo_tx_timeout(tx_ring->netdev); 797 /* do not fire the reset immediately, wait for the stack to
798 * decide we are truly stuck, also prevents every queue from
799 * simultaneously requesting a reset
800 */
784 801
785 /* the adapter is about to reset, no point in enabling stuff */ 802 /* the adapter is about to reset, no point in enabling polling */
786 return true; 803 budget = 1;
787 } 804 }
788 805
789 netdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev, 806 netdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev,
@@ -806,7 +823,25 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
806 } 823 }
807 } 824 }
808 825
809 return budget > 0; 826 return !!budget;
827}
828
829/**
830 * i40e_force_wb - Arm hardware to do a wb on noncache aligned descriptors
831 * @vsi: the VSI we care about
832 * @q_vector: the vector on which to force writeback
833 *
834 **/
835static void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector)
836{
837 u32 val = I40E_PFINT_DYN_CTLN_INTENA_MASK |
838 I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK |
839 I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_MASK
840 /* allow 00 to be written to the index */;
841
842 wr32(&vsi->back->hw,
843 I40E_PFINT_DYN_CTLN(q_vector->v_idx + vsi->base_vector - 1),
844 val);
810} 845}
811 846
812/** 847/**
@@ -1290,9 +1325,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
1290 * so the total length of IPv4 header is IHL*4 bytes 1325 * so the total length of IPv4 header is IHL*4 bytes
1291 * The UDP_0 bit *may* bet set if the *inner* header is UDP 1326 * The UDP_0 bit *may* bet set if the *inner* header is UDP
1292 */ 1327 */
1293 if (ipv4_tunnel && 1328 if (ipv4_tunnel) {
1294 (decoded.inner_prot != I40E_RX_PTYPE_INNER_PROT_UDP) &&
1295 !(rx_status & (1 << I40E_RX_DESC_STATUS_UDP_0_SHIFT))) {
1296 skb->transport_header = skb->mac_header + 1329 skb->transport_header = skb->mac_header +
1297 sizeof(struct ethhdr) + 1330 sizeof(struct ethhdr) +
1298 (ip_hdr(skb)->ihl * 4); 1331 (ip_hdr(skb)->ihl * 4);
@@ -1302,15 +1335,19 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
1302 skb->protocol == htons(ETH_P_8021AD)) 1335 skb->protocol == htons(ETH_P_8021AD))
1303 ? VLAN_HLEN : 0; 1336 ? VLAN_HLEN : 0;
1304 1337
1305 rx_udp_csum = udp_csum(skb); 1338 if ((ip_hdr(skb)->protocol == IPPROTO_UDP) &&
1306 iph = ip_hdr(skb); 1339 (udp_hdr(skb)->check != 0)) {
1307 csum = csum_tcpudp_magic( 1340 rx_udp_csum = udp_csum(skb);
1308 iph->saddr, iph->daddr, 1341 iph = ip_hdr(skb);
1309 (skb->len - skb_transport_offset(skb)), 1342 csum = csum_tcpudp_magic(
1310 IPPROTO_UDP, rx_udp_csum); 1343 iph->saddr, iph->daddr,
1344 (skb->len - skb_transport_offset(skb)),
1345 IPPROTO_UDP, rx_udp_csum);
1311 1346
1312 if (udp_hdr(skb)->check != csum) 1347 if (udp_hdr(skb)->check != csum)
1313 goto checksum_fail; 1348 goto checksum_fail;
1349
1350 } /* else its GRE and so no outer UDP header */
1314 } 1351 }
1315 1352
1316 skb->ip_summed = CHECKSUM_UNNECESSARY; 1353 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1581,6 +1618,7 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
1581 struct i40e_vsi *vsi = q_vector->vsi; 1618 struct i40e_vsi *vsi = q_vector->vsi;
1582 struct i40e_ring *ring; 1619 struct i40e_ring *ring;
1583 bool clean_complete = true; 1620 bool clean_complete = true;
1621 bool arm_wb = false;
1584 int budget_per_ring; 1622 int budget_per_ring;
1585 1623
1586 if (test_bit(__I40E_DOWN, &vsi->state)) { 1624 if (test_bit(__I40E_DOWN, &vsi->state)) {
@@ -1591,8 +1629,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
1591 /* Since the actual Tx work is minimal, we can give the Tx a larger 1629 /* Since the actual Tx work is minimal, we can give the Tx a larger
1592 * budget and be more aggressive about cleaning up the Tx descriptors. 1630 * budget and be more aggressive about cleaning up the Tx descriptors.
1593 */ 1631 */
1594 i40e_for_each_ring(ring, q_vector->tx) 1632 i40e_for_each_ring(ring, q_vector->tx) {
1595 clean_complete &= i40e_clean_tx_irq(ring, vsi->work_limit); 1633 clean_complete &= i40e_clean_tx_irq(ring, vsi->work_limit);
1634 arm_wb |= ring->arm_wb;
1635 }
1596 1636
1597 /* We attempt to distribute budget to each Rx queue fairly, but don't 1637 /* We attempt to distribute budget to each Rx queue fairly, but don't
1598 * allow the budget to go below 1 because that would exit polling early. 1638 * allow the budget to go below 1 because that would exit polling early.
@@ -1603,8 +1643,11 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
1603 clean_complete &= i40e_clean_rx_irq(ring, budget_per_ring); 1643 clean_complete &= i40e_clean_rx_irq(ring, budget_per_ring);
1604 1644
1605 /* If work not completed, return budget and polling will return */ 1645 /* If work not completed, return budget and polling will return */
1606 if (!clean_complete) 1646 if (!clean_complete) {
1647 if (arm_wb)
1648 i40e_force_wb(vsi, q_vector);
1607 return budget; 1649 return budget;
1650 }
1608 1651
1609 /* Work is done so exit the polling mode and re-enable the interrupt */ 1652 /* Work is done so exit the polling mode and re-enable the interrupt */
1610 napi_complete(napi); 1653 napi_complete(napi);
@@ -1840,17 +1883,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
1840 if (err < 0) 1883 if (err < 0)
1841 return err; 1884 return err;
1842 1885
1843 if (protocol == htons(ETH_P_IP)) { 1886 iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);
1844 iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); 1887 ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb);
1888
1889 if (iph->version == 4) {
1845 tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); 1890 tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);
1846 iph->tot_len = 0; 1891 iph->tot_len = 0;
1847 iph->check = 0; 1892 iph->check = 0;
1848 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 1893 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
1849 0, IPPROTO_TCP, 0); 1894 0, IPPROTO_TCP, 0);
1850 } else if (skb_is_gso_v6(skb)) { 1895 } else if (ipv6h->version == 6) {
1851
1852 ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb)
1853 : ipv6_hdr(skb);
1854 tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); 1896 tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);
1855 ipv6h->payload_len = 0; 1897 ipv6h->payload_len = 0;
1856 tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, 1898 tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr,
@@ -1946,13 +1988,9 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags,
1946 I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; 1988 I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM;
1947 } 1989 }
1948 } else if (tx_flags & I40E_TX_FLAGS_IPV6) { 1990 } else if (tx_flags & I40E_TX_FLAGS_IPV6) {
1949 if (tx_flags & I40E_TX_FLAGS_TSO) { 1991 *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6;
1950 *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; 1992 if (tx_flags & I40E_TX_FLAGS_TSO)
1951 ip_hdr(skb)->check = 0; 1993 ip_hdr(skb)->check = 0;
1952 } else {
1953 *cd_tunneling |=
1954 I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM;
1955 }
1956 } 1994 }
1957 1995
1958 /* Now set the ctx descriptor fields */ 1996 /* Now set the ctx descriptor fields */
@@ -1962,7 +2000,10 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags,
1962 ((skb_inner_network_offset(skb) - 2000 ((skb_inner_network_offset(skb) -
1963 skb_transport_offset(skb)) >> 1) << 2001 skb_transport_offset(skb)) >> 1) <<
1964 I40E_TXD_CTX_QW0_NATLEN_SHIFT; 2002 I40E_TXD_CTX_QW0_NATLEN_SHIFT;
1965 2003 if (this_ip_hdr->version == 6) {
2004 tx_flags &= ~I40E_TX_FLAGS_IPV4;
2005 tx_flags |= I40E_TX_FLAGS_IPV6;
2006 }
1966 } else { 2007 } else {
1967 network_hdr_len = skb_network_header_len(skb); 2008 network_hdr_len = skb_network_header_len(skb);
1968 this_ip_hdr = ip_hdr(skb); 2009 this_ip_hdr = ip_hdr(skb);
@@ -2198,7 +2239,6 @@ static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
2198 /* Place RS bit on last descriptor of any packet that spans across the 2239 /* Place RS bit on last descriptor of any packet that spans across the
2199 * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline. 2240 * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline.
2200 */ 2241 */
2201#define WB_STRIDE 0x3
2202 if (((i & WB_STRIDE) != WB_STRIDE) && 2242 if (((i & WB_STRIDE) != WB_STRIDE) &&
2203 (first <= &tx_ring->tx_bi[i]) && 2243 (first <= &tx_ring->tx_bi[i]) &&
2204 (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) { 2244 (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index e60d3accb2e2..18b00231d2f1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -241,6 +241,7 @@ struct i40e_ring {
241 unsigned long last_rx_timestamp; 241 unsigned long last_rx_timestamp;
242 242
243 bool ring_active; /* is ring online or not */ 243 bool ring_active; /* is ring online or not */
244 bool arm_wb; /* do something to arm write back */
244 245
245 /* stats structs */ 246 /* stats structs */
246 struct i40e_queue_stats stats; 247 struct i40e_queue_stats stats;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index c29ba80ae02b..37583a9d8853 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -473,6 +473,7 @@ static struct sh_eth_cpu_data r8a777x_data = {
473 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | 473 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
474 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | 474 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
475 EESR_ECI, 475 EESR_ECI,
476 .fdr_value = 0x00000f0f,
476 477
477 .apr = 1, 478 .apr = 1,
478 .mpr = 1, 479 .mpr = 1,
@@ -495,6 +496,7 @@ static struct sh_eth_cpu_data r8a779x_data = {
495 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | 496 .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
496 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | 497 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
497 EESR_ECI, 498 EESR_ECI,
499 .fdr_value = 0x00000f0f,
498 500
499 .apr = 1, 501 .apr = 1,
500 .mpr = 1, 502 .mpr = 1,
@@ -536,6 +538,8 @@ static struct sh_eth_cpu_data sh7724_data = {
536 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | 538 EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
537 EESR_ECI, 539 EESR_ECI,
538 540
541 .trscer_err_mask = DESC_I_RINT8,
542
539 .apr = 1, 543 .apr = 1,
540 .mpr = 1, 544 .mpr = 1,
541 .tpauser = 1, 545 .tpauser = 1,
@@ -856,6 +860,9 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd)
856 860
857 if (!cd->eesr_err_check) 861 if (!cd->eesr_err_check)
858 cd->eesr_err_check = DEFAULT_EESR_ERR_CHECK; 862 cd->eesr_err_check = DEFAULT_EESR_ERR_CHECK;
863
864 if (!cd->trscer_err_mask)
865 cd->trscer_err_mask = DEFAULT_TRSCER_ERR_MASK;
859} 866}
860 867
861static int sh_eth_check_reset(struct net_device *ndev) 868static int sh_eth_check_reset(struct net_device *ndev)
@@ -1294,7 +1301,7 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start)
1294 /* Frame recv control (enable multiple-packets per rx irq) */ 1301 /* Frame recv control (enable multiple-packets per rx irq) */
1295 sh_eth_write(ndev, RMCR_RNC, RMCR); 1302 sh_eth_write(ndev, RMCR_RNC, RMCR);
1296 1303
1297 sh_eth_write(ndev, DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2, TRSCER); 1304 sh_eth_write(ndev, mdp->cd->trscer_err_mask, TRSCER);
1298 1305
1299 if (mdp->cd->bculr) 1306 if (mdp->cd->bculr)
1300 sh_eth_write(ndev, 0x800, BCULR); /* Burst sycle set */ 1307 sh_eth_write(ndev, 0x800, BCULR); /* Burst sycle set */
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 22301bf9c21d..71f5de1171bd 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -369,6 +369,8 @@ enum DESC_I_BIT {
369 DESC_I_RINT1 = 0x0001, 369 DESC_I_RINT1 = 0x0001,
370}; 370};
371 371
372#define DEFAULT_TRSCER_ERR_MASK (DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2)
373
372/* RPADIR */ 374/* RPADIR */
373enum RPADIR_BIT { 375enum RPADIR_BIT {
374 RPADIR_PADS1 = 0x20000, RPADIR_PADS0 = 0x10000, 376 RPADIR_PADS1 = 0x20000, RPADIR_PADS0 = 0x10000,
@@ -470,6 +472,9 @@ struct sh_eth_cpu_data {
470 unsigned long tx_check; 472 unsigned long tx_check;
471 unsigned long eesr_err_check; 473 unsigned long eesr_err_check;
472 474
475 /* Error mask */
476 unsigned long trscer_err_mask;
477
473 /* hardware features */ 478 /* hardware features */
474 unsigned long irq_flags; /* IRQ configuration flags */ 479 unsigned long irq_flags; /* IRQ configuration flags */
475 unsigned no_psr:1; /* EtherC DO NOT have PSR */ 480 unsigned no_psr:1; /* EtherC DO NOT have PSR */
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e61ee8351272..64d1cef4cda1 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -610,7 +610,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
610 610
611 /* Clear all mcast from ALE */ 611 /* Clear all mcast from ALE */
612 cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS << 612 cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS <<
613 priv->host_port); 613 priv->host_port, -1);
614 614
615 /* Flood All Unicast Packets to Host port */ 615 /* Flood All Unicast Packets to Host port */
616 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); 616 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
@@ -634,6 +634,12 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
634static void cpsw_ndo_set_rx_mode(struct net_device *ndev) 634static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
635{ 635{
636 struct cpsw_priv *priv = netdev_priv(ndev); 636 struct cpsw_priv *priv = netdev_priv(ndev);
637 int vid;
638
639 if (priv->data.dual_emac)
640 vid = priv->slaves[priv->emac_port].port_vlan;
641 else
642 vid = priv->data.default_vlan;
637 643
638 if (ndev->flags & IFF_PROMISC) { 644 if (ndev->flags & IFF_PROMISC) {
639 /* Enable promiscuous mode */ 645 /* Enable promiscuous mode */
@@ -649,7 +655,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
649 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); 655 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI);
650 656
651 /* Clear all mcast from ALE */ 657 /* Clear all mcast from ALE */
652 cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); 658 cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port,
659 vid);
653 660
654 if (!netdev_mc_empty(ndev)) { 661 if (!netdev_mc_empty(ndev)) {
655 struct netdev_hw_addr *ha; 662 struct netdev_hw_addr *ha;
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 097ebe7077ac..5246b3a18ff8 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -234,7 +234,7 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry,
234 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); 234 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
235} 235}
236 236
237int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) 237int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
238{ 238{
239 u32 ale_entry[ALE_ENTRY_WORDS]; 239 u32 ale_entry[ALE_ENTRY_WORDS];
240 int ret, idx; 240 int ret, idx;
@@ -245,6 +245,14 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask)
245 if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR) 245 if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR)
246 continue; 246 continue;
247 247
248 /* if vid passed is -1 then remove all multicast entry from
249 * the table irrespective of vlan id, if a valid vlan id is
250 * passed then remove only multicast added to that vlan id.
251 * if vlan id doesn't match then move on to next entry.
252 */
253 if (vid != -1 && cpsw_ale_get_vlan_id(ale_entry) != vid)
254 continue;
255
248 if (cpsw_ale_get_mcast(ale_entry)) { 256 if (cpsw_ale_get_mcast(ale_entry)) {
249 u8 addr[6]; 257 u8 addr[6];
250 258
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
index c0d4127aa549..af1e7ecd87c6 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.h
+++ b/drivers/net/ethernet/ti/cpsw_ale.h
@@ -92,7 +92,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale);
92 92
93int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); 93int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout);
94int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); 94int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask);
95int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask); 95int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid);
96int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, 96int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
97 int flags, u16 vid); 97 int flags, u16 vid);
98int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, 98int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 93e224217e24..f7ff493f1e73 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -629,6 +629,7 @@ static int team_change_mode(struct team *team, const char *kind)
629static void team_notify_peers_work(struct work_struct *work) 629static void team_notify_peers_work(struct work_struct *work)
630{ 630{
631 struct team *team; 631 struct team *team;
632 int val;
632 633
633 team = container_of(work, struct team, notify_peers.dw.work); 634 team = container_of(work, struct team, notify_peers.dw.work);
634 635
@@ -636,9 +637,14 @@ static void team_notify_peers_work(struct work_struct *work)
636 schedule_delayed_work(&team->notify_peers.dw, 0); 637 schedule_delayed_work(&team->notify_peers.dw, 0);
637 return; 638 return;
638 } 639 }
640 val = atomic_dec_if_positive(&team->notify_peers.count_pending);
641 if (val < 0) {
642 rtnl_unlock();
643 return;
644 }
639 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); 645 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev);
640 rtnl_unlock(); 646 rtnl_unlock();
641 if (!atomic_dec_and_test(&team->notify_peers.count_pending)) 647 if (val)
642 schedule_delayed_work(&team->notify_peers.dw, 648 schedule_delayed_work(&team->notify_peers.dw,
643 msecs_to_jiffies(team->notify_peers.interval)); 649 msecs_to_jiffies(team->notify_peers.interval));
644} 650}
@@ -669,6 +675,7 @@ static void team_notify_peers_fini(struct team *team)
669static void team_mcast_rejoin_work(struct work_struct *work) 675static void team_mcast_rejoin_work(struct work_struct *work)
670{ 676{
671 struct team *team; 677 struct team *team;
678 int val;
672 679
673 team = container_of(work, struct team, mcast_rejoin.dw.work); 680 team = container_of(work, struct team, mcast_rejoin.dw.work);
674 681
@@ -676,9 +683,14 @@ static void team_mcast_rejoin_work(struct work_struct *work)
676 schedule_delayed_work(&team->mcast_rejoin.dw, 0); 683 schedule_delayed_work(&team->mcast_rejoin.dw, 0);
677 return; 684 return;
678 } 685 }
686 val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending);
687 if (val < 0) {
688 rtnl_unlock();
689 return;
690 }
679 call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); 691 call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev);
680 rtnl_unlock(); 692 rtnl_unlock();
681 if (!atomic_dec_and_test(&team->mcast_rejoin.count_pending)) 693 if (val)
682 schedule_delayed_work(&team->mcast_rejoin.dw, 694 schedule_delayed_work(&team->mcast_rejoin.dw,
683 msecs_to_jiffies(team->mcast_rejoin.interval)); 695 msecs_to_jiffies(team->mcast_rejoin.interval));
684} 696}
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index dcb6d33141e0..1e9cdca37014 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1276,7 +1276,7 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
1276 awd.done = 0; 1276 awd.done = 0;
1277 1277
1278 urb->context = &awd; 1278 urb->context = &awd;
1279 status = usb_submit_urb(urb, GFP_NOIO); 1279 status = usb_submit_urb(urb, GFP_ATOMIC);
1280 if (status) { 1280 if (status) {
1281 // something went wrong 1281 // something went wrong
1282 usb_free_urb(urb); 1282 usb_free_urb(urb);
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index e5be2d21868f..a5f9198d5747 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -69,8 +69,8 @@
69#include "iwl-agn-hw.h" 69#include "iwl-agn-hw.h"
70 70
71/* Highest firmware API version supported */ 71/* Highest firmware API version supported */
72#define IWL7260_UCODE_API_MAX 10 72#define IWL7260_UCODE_API_MAX 12
73#define IWL3160_UCODE_API_MAX 10 73#define IWL3160_UCODE_API_MAX 12
74 74
75/* Oldest version we won't warn about */ 75/* Oldest version we won't warn about */
76#define IWL7260_UCODE_API_OK 10 76#define IWL7260_UCODE_API_OK 10
@@ -105,7 +105,7 @@
105#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" 105#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
106 106
107#define IWL7265D_FW_PRE "iwlwifi-7265D-" 107#define IWL7265D_FW_PRE "iwlwifi-7265D-"
108#define IWL7265D_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" 108#define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode"
109 109
110#define NVM_HW_SECTION_NUM_FAMILY_7000 0 110#define NVM_HW_SECTION_NUM_FAMILY_7000 0
111 111
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c
index bf0a95cb7153..3668fc57e770 100644
--- a/drivers/net/wireless/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-8000.c
@@ -69,7 +69,7 @@
69#include "iwl-agn-hw.h" 69#include "iwl-agn-hw.h"
70 70
71/* Highest firmware API version supported */ 71/* Highest firmware API version supported */
72#define IWL8000_UCODE_API_MAX 10 72#define IWL8000_UCODE_API_MAX 12
73 73
74/* Oldest version we won't warn about */ 74/* Oldest version we won't warn about */
75#define IWL8000_UCODE_API_OK 10 75#define IWL8000_UCODE_API_OK 10
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/iwlwifi/iwl-fw-file.h
index f2a047f6bb3e..1bbe4fc47b97 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fw-file.h
@@ -243,6 +243,9 @@ enum iwl_ucode_tlv_flag {
243 * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif. 243 * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif.
244 * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time 244 * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
245 * longer than the passive one, which is essential for fragmented scan. 245 * longer than the passive one, which is essential for fragmented scan.
246 * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
247 * regardless of the band or the number of the probes. FW will calculate
248 * the actual dwell time.
246 */ 249 */
247enum iwl_ucode_tlv_api { 250enum iwl_ucode_tlv_api {
248 IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), 251 IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0),
@@ -253,6 +256,7 @@ enum iwl_ucode_tlv_api {
253 IWL_UCODE_TLV_API_LMAC_SCAN = BIT(6), 256 IWL_UCODE_TLV_API_LMAC_SCAN = BIT(6),
254 IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF = BIT(7), 257 IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF = BIT(7),
255 IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8), 258 IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8),
259 IWL_UCODE_TLV_API_BASIC_DWELL = BIT(13),
256}; 260};
257 261
258/** 262/**
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
index 1f2acf47bfb2..201846de94e7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
@@ -672,6 +672,7 @@ struct iwl_scan_channel_opt {
672 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented 672 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
673 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report 673 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
674 * and DS parameter set IEs into probe requests. 674 * and DS parameter set IEs into probe requests.
675 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
675 */ 676 */
676enum iwl_mvm_lmac_scan_flags { 677enum iwl_mvm_lmac_scan_flags {
677 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0), 678 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
@@ -681,6 +682,7 @@ enum iwl_mvm_lmac_scan_flags {
681 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4), 682 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
682 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5), 683 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
683 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6), 684 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
685 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
684}; 686};
685 687
686enum iwl_scan_priority { 688enum iwl_scan_priority {
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index e5294d01181e..ec9a8e7bae1d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -171,15 +171,21 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_ssid_ie *cmd_ssid,
171 * already included in the probe template, so we need to set only 171 * already included in the probe template, so we need to set only
172 * req->n_ssids - 1 bits in addition to the first bit. 172 * req->n_ssids - 1 bits in addition to the first bit.
173 */ 173 */
174static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) 174static u16 iwl_mvm_get_active_dwell(struct iwl_mvm *mvm,
175 enum ieee80211_band band, int n_ssids)
175{ 176{
177 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL)
178 return 10;
176 if (band == IEEE80211_BAND_2GHZ) 179 if (band == IEEE80211_BAND_2GHZ)
177 return 20 + 3 * (n_ssids + 1); 180 return 20 + 3 * (n_ssids + 1);
178 return 10 + 2 * (n_ssids + 1); 181 return 10 + 2 * (n_ssids + 1);
179} 182}
180 183
181static u16 iwl_mvm_get_passive_dwell(enum ieee80211_band band) 184static u16 iwl_mvm_get_passive_dwell(struct iwl_mvm *mvm,
185 enum ieee80211_band band)
182{ 186{
187 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL)
188 return 110;
183 return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10; 189 return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10;
184} 190}
185 191
@@ -331,7 +337,8 @@ static void iwl_mvm_scan_calc_params(struct iwl_mvm *mvm,
331 */ 337 */
332 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 338 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
333 u32 passive_dwell = 339 u32 passive_dwell =
334 iwl_mvm_get_passive_dwell(IEEE80211_BAND_2GHZ); 340 iwl_mvm_get_passive_dwell(mvm,
341 IEEE80211_BAND_2GHZ);
335 params->max_out_time = passive_dwell; 342 params->max_out_time = passive_dwell;
336 } else { 343 } else {
337 params->passive_fragmented = true; 344 params->passive_fragmented = true;
@@ -348,8 +355,8 @@ not_bound:
348 params->dwell[band].passive = frag_passive_dwell; 355 params->dwell[band].passive = frag_passive_dwell;
349 else 356 else
350 params->dwell[band].passive = 357 params->dwell[band].passive =
351 iwl_mvm_get_passive_dwell(band); 358 iwl_mvm_get_passive_dwell(mvm, band);
352 params->dwell[band].active = iwl_mvm_get_active_dwell(band, 359 params->dwell[band].active = iwl_mvm_get_active_dwell(mvm, band,
353 n_ssids); 360 n_ssids);
354 } 361 }
355} 362}
@@ -1448,6 +1455,8 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
1448 1455
1449 if (iwl_mvm_scan_pass_all(mvm, req)) 1456 if (iwl_mvm_scan_pass_all(mvm, req))
1450 flags |= IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL; 1457 flags |= IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL;
1458 else
1459 flags |= IWL_MVM_LMAC_SCAN_FLAG_MATCH;
1451 1460
1452 if (req->n_ssids == 1 && req->ssids[0].ssid_len != 0) 1461 if (req->n_ssids == 1 && req->ssids[0].ssid_len != 0)
1453 flags |= IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION; 1462 flags |= IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 4f15d9decc81..4333306ccdee 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -108,8 +108,12 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
108 tx_flags &= ~TX_CMD_FLG_SEQ_CTL; 108 tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
109 } 109 }
110 110
111 /* tid_tspec will default to 0 = BE when QOS isn't enabled */ 111 /* Default to 0 (BE) when tid_spec is set to IWL_TID_NON_QOS */
112 ac = tid_to_mac80211_ac[tx_cmd->tid_tspec]; 112 if (tx_cmd->tid_tspec < IWL_MAX_TID_COUNT)
113 ac = tid_to_mac80211_ac[tx_cmd->tid_tspec];
114 else
115 ac = tid_to_mac80211_ac[0];
116
113 tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info, ac) << 117 tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info, ac) <<
114 TX_CMD_FLG_BT_PRIO_POS; 118 TX_CMD_FLG_BT_PRIO_POS;
115 119
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c
index e56e77ef5d2e..917431e30f74 100644
--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
@@ -665,7 +665,7 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
665 if (num_of_ant(mvm->fw->valid_rx_ant) == 1) 665 if (num_of_ant(mvm->fw->valid_rx_ant) == 1)
666 return false; 666 return false;
667 667
668 if (!mvm->cfg->rx_with_siso_diversity) 668 if (mvm->cfg->rx_with_siso_diversity)
669 return false; 669 return false;
670 670
671 ieee80211_iterate_active_interfaces_atomic( 671 ieee80211_iterate_active_interfaces_atomic(
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 2f0c4b170344..d5aadb00dd9e 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -527,8 +527,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
527 else if (cfg == &iwl7265_n_cfg) 527 else if (cfg == &iwl7265_n_cfg)
528 cfg_7265d = &iwl7265d_n_cfg; 528 cfg_7265d = &iwl7265d_n_cfg;
529 if (cfg_7265d && 529 if (cfg_7265d &&
530 (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) 530 (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) {
531 cfg = cfg_7265d; 531 cfg = cfg_7265d;
532 iwl_trans->cfg = cfg_7265d;
533 }
532#endif 534#endif
533 535
534 pci_set_drvdata(pdev, iwl_trans); 536 pci_set_drvdata(pdev, iwl_trans);
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 846a2e6e34d8..c70efb9a6e78 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -666,7 +666,8 @@ tx_status_ok:
666} 666}
667 667
668static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, 668static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
669 u8 *entry, int rxring_idx, int desc_idx) 669 struct sk_buff *new_skb, u8 *entry,
670 int rxring_idx, int desc_idx)
670{ 671{
671 struct rtl_priv *rtlpriv = rtl_priv(hw); 672 struct rtl_priv *rtlpriv = rtl_priv(hw);
672 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 673 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -674,11 +675,15 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
674 u8 tmp_one = 1; 675 u8 tmp_one = 1;
675 struct sk_buff *skb; 676 struct sk_buff *skb;
676 677
678 if (likely(new_skb)) {
679 skb = new_skb;
680 goto remap;
681 }
677 skb = dev_alloc_skb(rtlpci->rxbuffersize); 682 skb = dev_alloc_skb(rtlpci->rxbuffersize);
678 if (!skb) 683 if (!skb)
679 return 0; 684 return 0;
680 rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb;
681 685
686remap:
682 /* just set skb->cb to mapping addr for pci_unmap_single use */ 687 /* just set skb->cb to mapping addr for pci_unmap_single use */
683 *((dma_addr_t *)skb->cb) = 688 *((dma_addr_t *)skb->cb) =
684 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), 689 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb),
@@ -686,6 +691,7 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
686 bufferaddress = *((dma_addr_t *)skb->cb); 691 bufferaddress = *((dma_addr_t *)skb->cb);
687 if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) 692 if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress))
688 return 0; 693 return 0;
694 rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb;
689 if (rtlpriv->use_new_trx_flow) { 695 if (rtlpriv->use_new_trx_flow) {
690 rtlpriv->cfg->ops->set_desc(hw, (u8 *)entry, false, 696 rtlpriv->cfg->ops->set_desc(hw, (u8 *)entry, false,
691 HW_DESC_RX_PREPARE, 697 HW_DESC_RX_PREPARE,
@@ -781,6 +787,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
781 /*rx pkt */ 787 /*rx pkt */
782 struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[ 788 struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[
783 rtlpci->rx_ring[rxring_idx].idx]; 789 rtlpci->rx_ring[rxring_idx].idx];
790 struct sk_buff *new_skb;
784 791
785 if (rtlpriv->use_new_trx_flow) { 792 if (rtlpriv->use_new_trx_flow) {
786 rx_remained_cnt = 793 rx_remained_cnt =
@@ -807,6 +814,13 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
807 pci_unmap_single(rtlpci->pdev, *((dma_addr_t *)skb->cb), 814 pci_unmap_single(rtlpci->pdev, *((dma_addr_t *)skb->cb),
808 rtlpci->rxbuffersize, PCI_DMA_FROMDEVICE); 815 rtlpci->rxbuffersize, PCI_DMA_FROMDEVICE);
809 816
817 /* get a new skb - if fail, old one will be reused */
818 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
819 if (unlikely(!new_skb)) {
820 pr_err("Allocation of new skb failed in %s\n",
821 __func__);
822 goto no_new;
823 }
810 if (rtlpriv->use_new_trx_flow) { 824 if (rtlpriv->use_new_trx_flow) {
811 buffer_desc = 825 buffer_desc =
812 &rtlpci->rx_ring[rxring_idx].buffer_desc 826 &rtlpci->rx_ring[rxring_idx].buffer_desc
@@ -911,14 +925,16 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
911 schedule_work(&rtlpriv->works.lps_change_work); 925 schedule_work(&rtlpriv->works.lps_change_work);
912 } 926 }
913end: 927end:
928 skb = new_skb;
929no_new:
914 if (rtlpriv->use_new_trx_flow) { 930 if (rtlpriv->use_new_trx_flow) {
915 _rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, 931 _rtl_pci_init_one_rxdesc(hw, skb, (u8 *)buffer_desc,
916 rxring_idx, 932 rxring_idx,
917 rtlpci->rx_ring[rxring_idx].idx); 933 rtlpci->rx_ring[rxring_idx].idx);
918 } else { 934 } else {
919 _rtl_pci_init_one_rxdesc(hw, (u8 *)pdesc, rxring_idx, 935 _rtl_pci_init_one_rxdesc(hw, skb, (u8 *)pdesc,
936 rxring_idx,
920 rtlpci->rx_ring[rxring_idx].idx); 937 rtlpci->rx_ring[rxring_idx].idx);
921
922 if (rtlpci->rx_ring[rxring_idx].idx == 938 if (rtlpci->rx_ring[rxring_idx].idx ==
923 rtlpci->rxringcount - 1) 939 rtlpci->rxringcount - 1)
924 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, 940 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc,
@@ -1307,7 +1323,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx)
1307 rtlpci->rx_ring[rxring_idx].idx = 0; 1323 rtlpci->rx_ring[rxring_idx].idx = 0;
1308 for (i = 0; i < rtlpci->rxringcount; i++) { 1324 for (i = 0; i < rtlpci->rxringcount; i++) {
1309 entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i]; 1325 entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i];
1310 if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, 1326 if (!_rtl_pci_init_one_rxdesc(hw, NULL, (u8 *)entry,
1311 rxring_idx, i)) 1327 rxring_idx, i))
1312 return -ENOMEM; 1328 return -ENOMEM;
1313 } 1329 }
@@ -1332,7 +1348,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx)
1332 1348
1333 for (i = 0; i < rtlpci->rxringcount; i++) { 1349 for (i = 0; i < rtlpci->rxringcount; i++) {
1334 entry = &rtlpci->rx_ring[rxring_idx].desc[i]; 1350 entry = &rtlpci->rx_ring[rxring_idx].desc[i];
1335 if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, 1351 if (!_rtl_pci_init_one_rxdesc(hw, NULL, (u8 *)entry,
1336 rxring_idx, i)) 1352 rxring_idx, i))
1337 return -ENOMEM; 1353 return -ENOMEM;
1338 } 1354 }
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 22bcb4e12e2a..d8c10764f130 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -88,10 +88,8 @@ struct netfront_cb {
88#define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) 88#define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
89 89
90struct netfront_stats { 90struct netfront_stats {
91 u64 rx_packets; 91 u64 packets;
92 u64 tx_packets; 92 u64 bytes;
93 u64 rx_bytes;
94 u64 tx_bytes;
95 struct u64_stats_sync syncp; 93 struct u64_stats_sync syncp;
96}; 94};
97 95
@@ -160,7 +158,8 @@ struct netfront_info {
160 struct netfront_queue *queues; 158 struct netfront_queue *queues;
161 159
162 /* Statistics */ 160 /* Statistics */
163 struct netfront_stats __percpu *stats; 161 struct netfront_stats __percpu *rx_stats;
162 struct netfront_stats __percpu *tx_stats;
164 163
165 atomic_t rx_gso_checksum_fixup; 164 atomic_t rx_gso_checksum_fixup;
166}; 165};
@@ -565,7 +564,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
565{ 564{
566 unsigned short id; 565 unsigned short id;
567 struct netfront_info *np = netdev_priv(dev); 566 struct netfront_info *np = netdev_priv(dev);
568 struct netfront_stats *stats = this_cpu_ptr(np->stats); 567 struct netfront_stats *tx_stats = this_cpu_ptr(np->tx_stats);
569 struct xen_netif_tx_request *tx; 568 struct xen_netif_tx_request *tx;
570 char *data = skb->data; 569 char *data = skb->data;
571 RING_IDX i; 570 RING_IDX i;
@@ -672,10 +671,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
672 if (notify) 671 if (notify)
673 notify_remote_via_irq(queue->tx_irq); 672 notify_remote_via_irq(queue->tx_irq);
674 673
675 u64_stats_update_begin(&stats->syncp); 674 u64_stats_update_begin(&tx_stats->syncp);
676 stats->tx_bytes += skb->len; 675 tx_stats->bytes += skb->len;
677 stats->tx_packets++; 676 tx_stats->packets++;
678 u64_stats_update_end(&stats->syncp); 677 u64_stats_update_end(&tx_stats->syncp);
679 678
680 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ 679 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
681 xennet_tx_buf_gc(queue); 680 xennet_tx_buf_gc(queue);
@@ -931,7 +930,7 @@ static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
931static int handle_incoming_queue(struct netfront_queue *queue, 930static int handle_incoming_queue(struct netfront_queue *queue,
932 struct sk_buff_head *rxq) 931 struct sk_buff_head *rxq)
933{ 932{
934 struct netfront_stats *stats = this_cpu_ptr(queue->info->stats); 933 struct netfront_stats *rx_stats = this_cpu_ptr(queue->info->rx_stats);
935 int packets_dropped = 0; 934 int packets_dropped = 0;
936 struct sk_buff *skb; 935 struct sk_buff *skb;
937 936
@@ -952,10 +951,10 @@ static int handle_incoming_queue(struct netfront_queue *queue,
952 continue; 951 continue;
953 } 952 }
954 953
955 u64_stats_update_begin(&stats->syncp); 954 u64_stats_update_begin(&rx_stats->syncp);
956 stats->rx_packets++; 955 rx_stats->packets++;
957 stats->rx_bytes += skb->len; 956 rx_stats->bytes += skb->len;
958 u64_stats_update_end(&stats->syncp); 957 u64_stats_update_end(&rx_stats->syncp);
959 958
960 /* Pass it up. */ 959 /* Pass it up. */
961 napi_gro_receive(&queue->napi, skb); 960 napi_gro_receive(&queue->napi, skb);
@@ -1079,18 +1078,22 @@ static struct rtnl_link_stats64 *xennet_get_stats64(struct net_device *dev,
1079 int cpu; 1078 int cpu;
1080 1079
1081 for_each_possible_cpu(cpu) { 1080 for_each_possible_cpu(cpu) {
1082 struct netfront_stats *stats = per_cpu_ptr(np->stats, cpu); 1081 struct netfront_stats *rx_stats = per_cpu_ptr(np->rx_stats, cpu);
1082 struct netfront_stats *tx_stats = per_cpu_ptr(np->tx_stats, cpu);
1083 u64 rx_packets, rx_bytes, tx_packets, tx_bytes; 1083 u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
1084 unsigned int start; 1084 unsigned int start;
1085 1085
1086 do { 1086 do {
1087 start = u64_stats_fetch_begin_irq(&stats->syncp); 1087 start = u64_stats_fetch_begin_irq(&tx_stats->syncp);
1088 tx_packets = tx_stats->packets;
1089 tx_bytes = tx_stats->bytes;
1090 } while (u64_stats_fetch_retry_irq(&tx_stats->syncp, start));
1088 1091
1089 rx_packets = stats->rx_packets; 1092 do {
1090 tx_packets = stats->tx_packets; 1093 start = u64_stats_fetch_begin_irq(&rx_stats->syncp);
1091 rx_bytes = stats->rx_bytes; 1094 rx_packets = rx_stats->packets;
1092 tx_bytes = stats->tx_bytes; 1095 rx_bytes = rx_stats->bytes;
1093 } while (u64_stats_fetch_retry_irq(&stats->syncp, start)); 1096 } while (u64_stats_fetch_retry_irq(&rx_stats->syncp, start));
1094 1097
1095 tot->rx_packets += rx_packets; 1098 tot->rx_packets += rx_packets;
1096 tot->tx_packets += tx_packets; 1099 tot->tx_packets += tx_packets;
@@ -1275,6 +1278,15 @@ static const struct net_device_ops xennet_netdev_ops = {
1275#endif 1278#endif
1276}; 1279};
1277 1280
1281static void xennet_free_netdev(struct net_device *netdev)
1282{
1283 struct netfront_info *np = netdev_priv(netdev);
1284
1285 free_percpu(np->rx_stats);
1286 free_percpu(np->tx_stats);
1287 free_netdev(netdev);
1288}
1289
1278static struct net_device *xennet_create_dev(struct xenbus_device *dev) 1290static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1279{ 1291{
1280 int err; 1292 int err;
@@ -1295,8 +1307,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1295 np->queues = NULL; 1307 np->queues = NULL;
1296 1308
1297 err = -ENOMEM; 1309 err = -ENOMEM;
1298 np->stats = netdev_alloc_pcpu_stats(struct netfront_stats); 1310 np->rx_stats = netdev_alloc_pcpu_stats(struct netfront_stats);
1299 if (np->stats == NULL) 1311 if (np->rx_stats == NULL)
1312 goto exit;
1313 np->tx_stats = netdev_alloc_pcpu_stats(struct netfront_stats);
1314 if (np->tx_stats == NULL)
1300 goto exit; 1315 goto exit;
1301 1316
1302 netdev->netdev_ops = &xennet_netdev_ops; 1317 netdev->netdev_ops = &xennet_netdev_ops;
@@ -1327,7 +1342,7 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1327 return netdev; 1342 return netdev;
1328 1343
1329 exit: 1344 exit:
1330 free_netdev(netdev); 1345 xennet_free_netdev(netdev);
1331 return ERR_PTR(err); 1346 return ERR_PTR(err);
1332} 1347}
1333 1348
@@ -1369,7 +1384,7 @@ static int netfront_probe(struct xenbus_device *dev,
1369 return 0; 1384 return 0;
1370 1385
1371 fail: 1386 fail:
1372 free_netdev(netdev); 1387 xennet_free_netdev(netdev);
1373 dev_set_drvdata(&dev->dev, NULL); 1388 dev_set_drvdata(&dev->dev, NULL);
1374 return err; 1389 return err;
1375} 1390}
@@ -2189,9 +2204,7 @@ static int xennet_remove(struct xenbus_device *dev)
2189 info->queues = NULL; 2204 info->queues = NULL;
2190 } 2205 }
2191 2206
2192 free_percpu(info->stats); 2207 xennet_free_netdev(info->netdev);
2193
2194 free_netdev(info->netdev);
2195 2208
2196 return 0; 2209 return 0;
2197} 2210}
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 679e6e90aa4c..52fd8e8694cf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -852,11 +852,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
852 * 3. Update dev->stats asynchronously and atomically, and define 852 * 3. Update dev->stats asynchronously and atomically, and define
853 * neither operation. 853 * neither operation.
854 * 854 *
855 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); 855 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid);
856 * If device support VLAN filtering this function is called when a 856 * If device support VLAN filtering this function is called when a
857 * VLAN id is registered. 857 * VLAN id is registered.
858 * 858 *
859 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 859 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, __be16 proto, u16 vid);
860 * If device support VLAN filtering this function is called when a 860 * If device support VLAN filtering this function is called when a
861 * VLAN id is unregistered. 861 * VLAN id is unregistered.
862 * 862 *
@@ -2085,7 +2085,7 @@ extern rwlock_t dev_base_lock; /* Device list lock */
2085 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) 2085 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
2086#define for_each_netdev_in_bond_rcu(bond, slave) \ 2086#define for_each_netdev_in_bond_rcu(bond, slave) \
2087 for_each_netdev_rcu(&init_net, slave) \ 2087 for_each_netdev_rcu(&init_net, slave) \
2088 if (netdev_master_upper_dev_get_rcu(slave) == bond) 2088 if (netdev_master_upper_dev_get_rcu(slave) == (bond))
2089#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 2089#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
2090 2090
2091static inline struct net_device *next_net_device(struct net_device *dev) 2091static inline struct net_device *next_net_device(struct net_device *dev)
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 3a6dcaa359b7..f714e8633352 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -174,6 +174,10 @@ enum ovs_packet_attr {
174 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 174 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
175 OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_* 175 OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_*
176 attributes. */ 176 attributes. */
177 OVS_PACKET_ATTR_UNUSED1,
178 OVS_PACKET_ATTR_UNUSED2,
179 OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe,
180 error logging should be suppressed. */
177 __OVS_PACKET_ATTR_MAX 181 __OVS_PACKET_ATTR_MAX
178}; 182};
179 183
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 1f1de715197c..e2aa7be3a847 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -154,7 +154,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
154 dst = NULL; 154 dst = NULL;
155 155
156 if (is_broadcast_ether_addr(dest)) { 156 if (is_broadcast_ether_addr(dest)) {
157 if (p->flags & BR_PROXYARP && 157 if (IS_ENABLED(CONFIG_INET) &&
158 p->flags & BR_PROXYARP &&
158 skb->protocol == htons(ETH_P_ARP)) 159 skb->protocol == htons(ETH_P_ARP))
159 br_do_proxy_arp(skb, br, vid); 160 br_do_proxy_arp(skb, br, vid);
160 161
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8e38f17288d3..8d614c93f86a 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2043,6 +2043,12 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh)
2043 case NDTPA_BASE_REACHABLE_TIME: 2043 case NDTPA_BASE_REACHABLE_TIME:
2044 NEIGH_VAR_SET(p, BASE_REACHABLE_TIME, 2044 NEIGH_VAR_SET(p, BASE_REACHABLE_TIME,
2045 nla_get_msecs(tbp[i])); 2045 nla_get_msecs(tbp[i]));
2046 /* update reachable_time as well, otherwise, the change will
2047 * only be effective after the next time neigh_periodic_work
2048 * decides to recompute it (can be multiple minutes)
2049 */
2050 p->reachable_time =
2051 neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
2046 break; 2052 break;
2047 case NDTPA_GC_STALETIME: 2053 case NDTPA_GC_STALETIME:
2048 NEIGH_VAR_SET(p, GC_STALETIME, 2054 NEIGH_VAR_SET(p, GC_STALETIME,
@@ -2921,6 +2927,31 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,
2921 return ret; 2927 return ret;
2922} 2928}
2923 2929
2930static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,
2931 void __user *buffer,
2932 size_t *lenp, loff_t *ppos)
2933{
2934 struct neigh_parms *p = ctl->extra2;
2935 int ret;
2936
2937 if (strcmp(ctl->procname, "base_reachable_time") == 0)
2938 ret = neigh_proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos);
2939 else if (strcmp(ctl->procname, "base_reachable_time_ms") == 0)
2940 ret = neigh_proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos);
2941 else
2942 ret = -1;
2943
2944 if (write && ret == 0) {
2945 /* update reachable_time as well, otherwise, the change will
2946 * only be effective after the next time neigh_periodic_work
2947 * decides to recompute it
2948 */
2949 p->reachable_time =
2950 neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
2951 }
2952 return ret;
2953}
2954
2924#define NEIGH_PARMS_DATA_OFFSET(index) \ 2955#define NEIGH_PARMS_DATA_OFFSET(index) \
2925 (&((struct neigh_parms *) 0)->data[index]) 2956 (&((struct neigh_parms *) 0)->data[index])
2926 2957
@@ -3047,6 +3078,19 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
3047 t->neigh_vars[NEIGH_VAR_RETRANS_TIME_MS].proc_handler = handler; 3078 t->neigh_vars[NEIGH_VAR_RETRANS_TIME_MS].proc_handler = handler;
3048 /* ReachableTime (in milliseconds) */ 3079 /* ReachableTime (in milliseconds) */
3049 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler = handler; 3080 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler = handler;
3081 } else {
3082 /* Those handlers will update p->reachable_time after
3083 * base_reachable_time(_ms) is set to ensure the new timer starts being
3084 * applied after the next neighbour update instead of waiting for
3085 * neigh_periodic_work to update its value (can be multiple minutes)
3086 * So any handler that replaces them should do this as well
3087 */
3088 /* ReachableTime */
3089 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME].proc_handler =
3090 neigh_proc_base_reachable_time;
3091 /* ReachableTime (in milliseconds) */
3092 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler =
3093 neigh_proc_base_reachable_time;
3050 } 3094 }
3051 3095
3052 /* Don't export sysctls to unprivileged users */ 3096 /* Don't export sysctls to unprivileged users */
diff --git a/net/ipv4/netfilter/nft_redir_ipv4.c b/net/ipv4/netfilter/nft_redir_ipv4.c
index ff2d23d8c87a..6ecfce63201a 100644
--- a/net/ipv4/netfilter/nft_redir_ipv4.c
+++ b/net/ipv4/netfilter/nft_redir_ipv4.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr,
27 27
28 memset(&mr, 0, sizeof(mr)); 28 memset(&mr, 0, sizeof(mr));
29 if (priv->sreg_proto_min) { 29 if (priv->sreg_proto_min) {
30 mr.range[0].min.all = (__force __be16) 30 mr.range[0].min.all =
31 data[priv->sreg_proto_min].data[0]; 31 *(__be16 *)&data[priv->sreg_proto_min].data[0];
32 mr.range[0].max.all = (__force __be16) 32 mr.range[0].max.all =
33 data[priv->sreg_proto_max].data[0]; 33 *(__be16 *)&data[priv->sreg_proto_max].data[0];
34 mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 34 mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
35 } 35 }
36 36
diff --git a/net/ipv6/netfilter/nft_redir_ipv6.c b/net/ipv6/netfilter/nft_redir_ipv6.c
index 2433a6bfb191..11820b6b3613 100644
--- a/net/ipv6/netfilter/nft_redir_ipv6.c
+++ b/net/ipv6/netfilter/nft_redir_ipv6.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr,
27 27
28 memset(&range, 0, sizeof(range)); 28 memset(&range, 0, sizeof(range));
29 if (priv->sreg_proto_min) { 29 if (priv->sreg_proto_min) {
30 range.min_proto.all = (__force __be16) 30 range.min_proto.all =
31 data[priv->sreg_proto_min].data[0]; 31 *(__be16 *)&data[priv->sreg_proto_min].data[0];
32 range.max_proto.all = (__force __be16) 32 range.max_proto.all =
33 data[priv->sreg_proto_max].data[0]; 33 *(__be16 *)&data[priv->sreg_proto_max].data[0];
34 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 34 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
35 } 35 }
36 36
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 1d5341f3761d..5d3daae98bf0 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
183 struct nf_conn *ct; 183 struct nf_conn *ct;
184 struct net *net; 184 struct net *net;
185 185
186 *diff = 0;
187
186#ifdef CONFIG_IP_VS_IPV6 188#ifdef CONFIG_IP_VS_IPV6
187 /* This application helper doesn't work with IPv6 yet, 189 /* This application helper doesn't work with IPv6 yet,
188 * so turn this into a no-op for IPv6 packets 190 * so turn this into a no-op for IPv6 packets
@@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
191 return 1; 193 return 1;
192#endif 194#endif
193 195
194 *diff = 0;
195
196 /* Only useful for established sessions */ 196 /* Only useful for established sessions */
197 if (cp->state != IP_VS_TCP_S_ESTABLISHED) 197 if (cp->state != IP_VS_TCP_S_ESTABLISHED)
198 return 1; 198 return 1;
@@ -322,6 +322,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
322 struct ip_vs_conn *n_cp; 322 struct ip_vs_conn *n_cp;
323 struct net *net; 323 struct net *net;
324 324
325 /* no diff required for incoming packets */
326 *diff = 0;
327
325#ifdef CONFIG_IP_VS_IPV6 328#ifdef CONFIG_IP_VS_IPV6
326 /* This application helper doesn't work with IPv6 yet, 329 /* This application helper doesn't work with IPv6 yet,
327 * so turn this into a no-op for IPv6 packets 330 * so turn this into a no-op for IPv6 packets
@@ -330,9 +333,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
330 return 1; 333 return 1;
331#endif 334#endif
332 335
333 /* no diff required for incoming packets */
334 *diff = 0;
335
336 /* Only useful for established sessions */ 336 /* Only useful for established sessions */
337 if (cp->state != IP_VS_TCP_S_ESTABLISHED) 337 if (cp->state != IP_VS_TCP_S_ESTABLISHED)
338 return 1; 338 return 1;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index a11674806707..46d1b26a468e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -611,16 +611,15 @@ __nf_conntrack_confirm(struct sk_buff *skb)
611 */ 611 */
612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
613 pr_debug("Confirming conntrack %p\n", ct); 613 pr_debug("Confirming conntrack %p\n", ct);
614 /* We have to check the DYING flag inside the lock to prevent 614 /* We have to check the DYING flag after unlink to prevent
615 a race against nf_ct_get_next_corpse() possibly called from 615 * a race against nf_ct_get_next_corpse() possibly called from
616 user context, else we insert an already 'dead' hash, blocking 616 * user context, else we insert an already 'dead' hash, blocking
617 further use of that particular connection -JM */ 617 * further use of that particular connection -JM.
618 */
619 nf_ct_del_from_dying_or_unconfirmed_list(ct);
618 620
619 if (unlikely(nf_ct_is_dying(ct))) { 621 if (unlikely(nf_ct_is_dying(ct)))
620 nf_conntrack_double_unlock(hash, reply_hash); 622 goto out;
621 local_bh_enable();
622 return NF_ACCEPT;
623 }
624 623
625 /* See if there's one in the list already, including reverse: 624 /* See if there's one in the list already, including reverse:
626 NAT could have grabbed it without realizing, since we're 625 NAT could have grabbed it without realizing, since we're
@@ -636,8 +635,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
636 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) 635 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
637 goto out; 636 goto out;
638 637
639 nf_ct_del_from_dying_or_unconfirmed_list(ct);
640
641 /* Timer relative to confirmation time, not original 638 /* Timer relative to confirmation time, not original
642 setting time, otherwise we'd get timer wrap in 639 setting time, otherwise we'd get timer wrap in
643 weird delay cases. */ 640 weird delay cases. */
@@ -673,6 +670,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
673 return NF_ACCEPT; 670 return NF_ACCEPT;
674 671
675out: 672out:
673 nf_ct_add_to_dying_list(ct);
676 nf_conntrack_double_unlock(hash, reply_hash); 674 nf_conntrack_double_unlock(hash, reply_hash);
677 NF_CT_STAT_INC(net, insert_failed); 675 NF_CT_STAT_INC(net, insert_failed);
678 local_bh_enable(); 676 local_bh_enable();
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 129a8daa4abf..3b3ddb4fb9ee 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -713,16 +713,12 @@ static int nft_flush_table(struct nft_ctx *ctx)
713 struct nft_chain *chain, *nc; 713 struct nft_chain *chain, *nc;
714 struct nft_set *set, *ns; 714 struct nft_set *set, *ns;
715 715
716 list_for_each_entry_safe(chain, nc, &ctx->table->chains, list) { 716 list_for_each_entry(chain, &ctx->table->chains, list) {
717 ctx->chain = chain; 717 ctx->chain = chain;
718 718
719 err = nft_delrule_by_chain(ctx); 719 err = nft_delrule_by_chain(ctx);
720 if (err < 0) 720 if (err < 0)
721 goto out; 721 goto out;
722
723 err = nft_delchain(ctx);
724 if (err < 0)
725 goto out;
726 } 722 }
727 723
728 list_for_each_entry_safe(set, ns, &ctx->table->sets, list) { 724 list_for_each_entry_safe(set, ns, &ctx->table->sets, list) {
@@ -735,6 +731,14 @@ static int nft_flush_table(struct nft_ctx *ctx)
735 goto out; 731 goto out;
736 } 732 }
737 733
734 list_for_each_entry_safe(chain, nc, &ctx->table->chains, list) {
735 ctx->chain = chain;
736
737 err = nft_delchain(ctx);
738 if (err < 0)
739 goto out;
740 }
741
738 err = nft_deltable(ctx); 742 err = nft_deltable(ctx);
739out: 743out:
740 return err; 744 return err;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index cde4a6702fa3..c421d94c4652 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -321,7 +321,8 @@ replay:
321 nlh = nlmsg_hdr(skb); 321 nlh = nlmsg_hdr(skb);
322 err = 0; 322 err = 0;
323 323
324 if (nlh->nlmsg_len < NLMSG_HDRLEN) { 324 if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) ||
325 skb->len < nlh->nlmsg_len) {
325 err = -EINVAL; 326 err = -EINVAL;
326 goto ack; 327 goto ack;
327 } 328 }
@@ -469,7 +470,7 @@ static int nfnetlink_bind(struct net *net, int group)
469 int type; 470 int type;
470 471
471 if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) 472 if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX)
472 return -EINVAL; 473 return 0;
473 474
474 type = nfnl_group2type[group]; 475 type = nfnl_group2type[group];
475 476
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index afe2b0b45ec4..aff54fb1c8a0 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
65 } 65 }
66 66
67 if (priv->sreg_proto_min) { 67 if (priv->sreg_proto_min) {
68 range.min_proto.all = (__force __be16) 68 range.min_proto.all =
69 data[priv->sreg_proto_min].data[0]; 69 *(__be16 *)&data[priv->sreg_proto_min].data[0];
70 range.max_proto.all = (__force __be16) 70 range.max_proto.all =
71 data[priv->sreg_proto_max].data[0]; 71 *(__be16 *)&data[priv->sreg_proto_max].data[0];
72 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 72 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
73 } 73 }
74 74
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4e9a5f035cbc..b07349e82d78 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -524,7 +524,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
524 struct vport *input_vport; 524 struct vport *input_vport;
525 int len; 525 int len;
526 int err; 526 int err;
527 bool log = !a[OVS_FLOW_ATTR_PROBE]; 527 bool log = !a[OVS_PACKET_ATTR_PROBE];
528 528
529 err = -EINVAL; 529 err = -EINVAL;
530 if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] || 530 if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
@@ -610,6 +610,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
610 [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN }, 610 [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
611 [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED }, 611 [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
612 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, 612 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
613 [OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
613}; 614};
614 615
615static const struct genl_ops dp_packet_genl_ops[] = { 616static const struct genl_ops dp_packet_genl_ops[] = {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 6880f34a529a..9cfe2e1dd8b5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2517,7 +2517,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2517 err = -EINVAL; 2517 err = -EINVAL;
2518 if (sock->type == SOCK_DGRAM) { 2518 if (sock->type == SOCK_DGRAM) {
2519 offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len); 2519 offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len);
2520 if (unlikely(offset) < 0) 2520 if (unlikely(offset < 0))
2521 goto out_free; 2521 goto out_free;
2522 } else { 2522 } else {
2523 if (ll_header_truncated(dev, len)) 2523 if (ll_header_truncated(dev, len))
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 96ceefeb9daf..a9e174fc0f91 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -220,10 +220,11 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
220 struct sk_buff *skb; 220 struct sk_buff *skb;
221 221
222 skb_queue_walk(&bcl->outqueue, skb) { 222 skb_queue_walk(&bcl->outqueue, skb) {
223 if (more(buf_seqno(skb), after)) 223 if (more(buf_seqno(skb), after)) {
224 tipc_link_retransmit(bcl, skb, mod(to - after));
224 break; 225 break;
226 }
225 } 227 }
226 tipc_link_retransmit(bcl, skb, mod(to - after));
227} 228}
228 229
229/** 230/**