[OpenWrt-Devel] [PATCH 1/2] kernel: bump 4.9 to 4.9.116 for 18.06

Stijn Segers foss at volatilesystems.org
Mon Jul 30 15:31:46 EDT 2018


* Refreshed patches.
* Removed patches:
  - target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch superseded by upstream
  - target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch superseded by upstream
  - target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch accepted upstream
  - target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch accepted upstream
  - target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch accepted upstream

Compile-tested on: ar71xx
Run-tested on: ar71xx

Signed-off-by: Stijn Segers <foss at volatilesystems.org>
---
 include/kernel-version.mk                          |   4 +-
 ...fix-register-address-in-ath79_ddr_wb_flus.patch |  23 --
 .../403-mtd_fix_cfi_cmdset_0002_status_check.patch |  69 -----
 ...low-to-pass-probe-types-via-platform-data.patch |   4 +-
 .../411-mtd-cfi_cmdset_0002-force-word-write.patch |   8 +-
 .../patches-4.9/910-unaligned_access_hacks.patch   |  10 +-
 ...gnore-dtco-targets-when-filtering-symbols.patch |   2 +-
 .../patches-4.9/950-0031-Add-dwc_otg-driver.patch  |   2 +-
 ...-consider-max-message-size-in-m25p80_read.patch |  30 --
 ...-4.15-08-bcm63xx_enet-correct-clock-usage.patch | 101 ------
 ...t-do-not-write-to-random-DMA-channel-on-B.patch |  29 --
 .../024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch     |   6 +-
 ...-remove-one-locked-operation-in-tcp_wfree.patch |   4 +-
 ...-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch |   6 +-
 ...4-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch |   4 +-
 ...q-add-a-shortcut-in-tcp_small_queue_check.patch |   2 +-
 ...tcp-tcp_mtu_probe-is-likely-to-exit-early.patch |   2 +-
 ...tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch |  14 +-
 ...add-a-missing-barrier-in-tcp_tasklet_func.patch |   2 +-
 .../025-tcp-allow-drivers-to-tweak-TSQ-logic.patch |   4 +-
 ...ort-for-releasing-multiple-instances-of-a.patch |   2 +-
 ..._alloc_page_frag-to-page_frag_alloc-and-_.patch |   4 +-
 ..._page_frag-functions-to-__page_frag_cache.patch |   6 +-
 .../090-net-generalize-napi_complete_done.patch    |   8 +-
 .../generic/hack-4.9/207-disable-modorder.patch    |   4 +-
 .../hack-4.9/211-host_tools_portability.patch      |   2 +-
 .../linux/generic/hack-4.9/220-gc_sections.patch   |   4 +-
 ...c_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch |   2 +-
 .../pending-4.9/201-extra_optimization.patch       |   2 +-
 ...610-netfilter_match_bypass_default_checks.patch |   6 +-
 .../pending-4.9/630-packet_socket_type.patch       |   6 +-
 .../generic/pending-4.9/834-ledtrig-libata.patch   |  10 +-
 .../900-gen_stats-fix-netlink-stats-padding.patch  |  49 ---
 .../patches-4.9/600-skb_avoid_dmabounce.patch      |   2 +-
 ...MTD-m25p80-allow-loading-mtd-name-from-OF.patch |   4 +-
 .../202-core-linux-support-layerscape.patch        |   6 +-
 .../patches-4.9/703-phy-support-layerscape.patch   |   2 +-
 .../patches-4.9/817-usb-support-layerscape.patch   |  10 +-
 .../sunxi/patches-4.9/0052-stmmac-form-4-12.patch  | 344 ++++++++++-----------
 39 files changed, 238 insertions(+), 561 deletions(-)
 delete mode 100644 target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
 delete mode 100644 target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch
 delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch
 delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
 delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
 delete mode 100644 target/linux/generic/pending-4.9/900-gen_stats-fix-netlink-stats-padding.patch

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index f0d8160e34..2e77f812df 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -4,12 +4,12 @@ LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .71
 LINUX_VERSION-4.4 = .121
-LINUX_VERSION-4.9 = .111
+LINUX_VERSION-4.9 = .116
 LINUX_VERSION-4.14 = .54
 
 LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
 LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
-LINUX_KERNEL_HASH-4.9.111 = 5966558959dc580f163766f3fdefd7e57c01b2b45d51202d00b3807c253759dd
+LINUX_KERNEL_HASH-4.9.116 = 999e8291bec0bcef2e0b91b6d58d8be5eb5e7c70881df59439364b22b693ff1d
 LINUX_KERNEL_HASH-4.14.54 = 451642ac28c539a91072f1fb83b1c061d6d44df870ddf5562400ade5e1c4b6c6
 
 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
diff --git a/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch b/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
deleted file mode 100644
index 64fb545b24..0000000000
--- a/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Felix Fietkau <nbd at nbd.name>
-Date: Wed, 18 May 2016 18:03:31 +0200
-Subject: [PATCH] MIPS: ath79: fix register address in ath79_ddr_wb_flush()
-
-ath79_ddr_wb_flush_base has the type void __iomem *, so register offsets
-need to be a multiple of 4.
-
-Cc: Alban Bedel <albeu at free.fr>
-Fixes: 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface")
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
-
---- a/arch/mips/ath79/common.c
-+++ b/arch/mips/ath79/common.c
-@@ -58,7 +58,7 @@ EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init);
- 
- void ath79_ddr_wb_flush(u32 reg)
- {
--	void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg;
-+	void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg * 4;
- 
- 	/* Flush the DDR write buffer. */
- 	__raw_writel(0x1, flush_reg);
diff --git a/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch b/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch
deleted file mode 100644
index 3a7fe99e65..0000000000
--- a/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch
+++ /dev/null
@@ -1,69 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -1631,8 +1631,8 @@ static int __xipram do_write_oneword(str
- 			break;
- 		}
- 
--		if (chip_ready(map, adr))
--			break;
-+		if (chip_good(map, adr, datum))
-+			goto enable_xip;
- 
- 		/* Latency issues. Drop the lock, wait a while and retry */
- 		UDELAY(map, chip, adr, 1);
-@@ -1648,6 +1648,8 @@ static int __xipram do_write_oneword(str
- 
- 		ret = -EIO;
- 	}
-+
-+ enable_xip:
- 	xip_enable(map, chip, adr);
-  op_done:
- 	if (mode == FL_OTP_WRITE)
-@@ -2226,7 +2228,6 @@ static int cfi_amdstd_panic_write(struct
- 	return 0;
- }
- 
--
- /*
-  * Handle devices with one erase region, that only implement
-  * the chip erase command.
-@@ -2291,8 +2292,8 @@ static int __xipram do_erase_chip(struct
- 			chip->erase_suspended = 0;
- 		}
- 
--		if (chip_ready(map, adr))
--			break;
-+		if (chip_good(map, adr, map_word_ff(map)))
-+			goto op_done;
- 
- 		if (time_after(jiffies, timeo)) {
- 			printk(KERN_WARNING "MTD %s(): software timeout\n",
-@@ -2312,6 +2313,7 @@ static int __xipram do_erase_chip(struct
- 		ret = -EIO;
- 	}
- 
-+ op_done:
- 	chip->state = FL_READY;
- 	xip_enable(map, chip, adr);
- 	DISABLE_VPP(map);
-@@ -2381,9 +2383,9 @@ static int __xipram do_erase_oneblock(st
- 			chip->erase_suspended = 0;
- 		}
- 
--		if (chip_ready(map, adr)) {
-+		if (chip_good(map, adr, map_word_ff(map))) {
- 			xip_enable(map, chip, adr);
--			break;
-+			goto op_done;
- 		}
- 
- 		if (time_after(jiffies, timeo)) {
-@@ -2405,6 +2407,7 @@ static int __xipram do_erase_oneblock(st
- 		ret = -EIO;
- 	}
- 
-+ op_done:
- 	chip->state = FL_READY;
- 	DISABLE_VPP(map);
- 	put_chip(map, chip, adr);
diff --git a/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch b/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch
index 418db2a2bf..cfc84c4afa 100644
--- a/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch
+++ b/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/devices/m25p80.c
 +++ b/drivers/mtd/devices/m25p80.c
-@@ -194,6 +194,7 @@ static ssize_t m25p80_read(struct spi_no
+@@ -195,6 +195,7 @@ static ssize_t m25p80_read(struct spi_no
   */
  static int m25p_probe(struct spi_device *spi)
  {
@@ -8,7 +8,7 @@
  	struct flash_platform_data	*data;
  	struct m25p *flash;
  	struct spi_nor *nor;
-@@ -246,8 +247,11 @@ static int m25p_probe(struct spi_device
+@@ -247,8 +248,11 @@ static int m25p_probe(struct spi_device
  	if (ret)
  		return ret;
  
diff --git a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch
index 25a73dcdff..ddd69f17e1 100644
--- a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch
+++ b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch
@@ -7,7 +7,7 @@
 -#define FORCE_WORD_WRITE 0
 +#define FORCE_WORD_WRITE 1
  
- #define MAX_WORD_RETRIES 3
+ #define MAX_RETRIES 3
  
 @@ -51,7 +51,9 @@
  
@@ -35,7 +35,7 @@
  
  /* Atmel chips don't use the same PRI format as AMD chips */
  static void fixup_convert_atmel_pri(struct mtd_info *mtd)
-@@ -1790,6 +1794,7 @@ static int cfi_amdstd_write_words(struct
+@@ -1788,6 +1792,7 @@ static int cfi_amdstd_write_words(struct
  /*
   * FIXME: interleaved mode not tested, and probably not supported!
   */
@@ -43,7 +43,7 @@
  static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
  				    unsigned long adr, const u_char *buf,
  				    int len)
-@@ -1918,7 +1923,6 @@ static int __xipram do_write_buffer(stru
+@@ -1916,7 +1921,6 @@ static int __xipram do_write_buffer(stru
  	return ret;
  }
  
@@ -51,7 +51,7 @@
  static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
  				    size_t *retlen, const u_char *buf)
  {
-@@ -1993,6 +1997,7 @@ static int cfi_amdstd_write_buffers(stru
+@@ -1991,6 +1995,7 @@ static int cfi_amdstd_write_buffers(stru
  
  	return 0;
  }
diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
index 1815ccb1d3..54a41b6e3a 100644
--- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
+++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch
@@ -250,7 +250,7 @@
  					       &sin->sin6_addr);
  			sin->sin6_scope_id = 0;
  		}
-@@ -814,12 +814,12 @@ int ip6_datagram_send_ctl(struct net *ne
+@@ -817,12 +817,12 @@ int ip6_datagram_send_ctl(struct net *ne
  			}
  
  			if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
@@ -327,7 +327,7 @@
  	return neigh_create(&arp_tbl, pkey, dev);
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -448,48 +448,53 @@ static void tcp_options_write(__be32 *pt
+@@ -453,48 +453,53 @@ static void tcp_options_write(__be32 *pt
  	u16 options = opts->options;	/* mungable copy */
  
  	if (unlikely(OPTION_MD5 & options)) {
@@ -404,7 +404,7 @@
  	}
  
  	if (unlikely(opts->num_sack_blocks)) {
-@@ -497,16 +502,17 @@ static void tcp_options_write(__be32 *pt
+@@ -502,16 +507,17 @@ static void tcp_options_write(__be32 *pt
  			tp->duplicate_sack : tp->selective_acks;
  		int this_sack;
  
@@ -428,7 +428,7 @@
  		}
  
  		tp->rx_opt.dsack = 0;
-@@ -519,13 +525,14 @@ static void tcp_options_write(__be32 *pt
+@@ -524,13 +530,14 @@ static void tcp_options_write(__be32 *pt
  
  		if (foc->exp) {
  			len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
@@ -795,7 +795,7 @@
  
 --- a/net/ipv4/tcp_input.c
 +++ b/net/ipv4/tcp_input.c
-@@ -3896,14 +3896,16 @@ static bool tcp_parse_aligned_timestamp(
+@@ -3906,14 +3906,16 @@ static bool tcp_parse_aligned_timestamp(
  {
  	const __be32 *ptr = (const __be32 *)(th + 1);
  
diff --git a/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch b/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch
index 0f5afac4ea..52fe8a2281 100644
--- a/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch
+++ b/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch
@@ -9,7 +9,7 @@ Subject: [PATCH] kbuild: Ignore dtco targets when filtering symbols
 
 --- a/scripts/Kbuild.include
 +++ b/scripts/Kbuild.include
-@@ -284,7 +284,7 @@ ksym_dep_filter =
+@@ -285,7 +285,7 @@ ksym_dep_filter =
  	    $(CPP) $(call flags_nodeps,c_flags) -D__KSYM_DEPS__ $< ;;        \
  	  as_*_S|cpp_s_S)                                                    \
  	    $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;;        \
diff --git a/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch b/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch
index d19027a2f0..258299fcf1 100644
--- a/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch
+++ b/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch
@@ -696,7 +696,7 @@ Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
  }
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
-@@ -5064,7 +5064,7 @@ static void port_event(struct usb_hub *h
+@@ -5068,7 +5068,7 @@ static void port_event(struct usb_hub *h
  	if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
  		u16 status = 0, unused;
  
diff --git a/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch b/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch
deleted file mode 100644
index 9d41b3cce4..0000000000
--- a/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 80a79a889ce5df16c5261ab2f1e8e63b94b78102 Mon Sep 17 00:00:00 2001
-From: Heiner Kallweit <hkallweit1 at gmail.com>
-Date: Fri, 28 Oct 2016 07:58:46 +0200
-Subject: [PATCH 1/8] mtd: m25p80: consider max message size in m25p80_read
-
-Consider a message size limit when calculating the maximum amount
-of data that can be read.
-
-The message size limit has been introduced with 4.9, so cc it
-to stable.
-
-Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>
-Cc: <stable at vger.kernel.org> # 4.9.x
-Signed-off-by: Cyrille Pitchen <cyrille.pitchen at atmel.com>
----
- drivers/mtd/devices/m25p80.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -174,7 +174,8 @@ static ssize_t m25p80_read(struct spi_no
- 
- 	t[1].rx_buf = buf;
- 	t[1].rx_nbits = m25p80_rx_nbits(nor);
--	t[1].len = min(len, spi_max_transfer_size(spi));
-+	t[1].len = min3(len, spi_max_transfer_size(spi),
-+			spi_max_message_size(spi) - t[0].len);
- 	spi_message_add_tail(&t[1], &m);
- 
- 	ret = spi_sync(spi, &m);
diff --git a/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch b/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
deleted file mode 100644
index d1d8516789..0000000000
--- a/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From d0423d3e4fa7ae305729cb50369427f075ccb279 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Sat, 25 Feb 2017 12:41:28 +0100
-Subject: [PATCH 1/6] bcm63xx_enet: correct clock usage
-
-Check the return code of prepare_enable and change one last instance of
-enable only to prepare_enable. Also properly disable and release the
-clock in error paths and on remove for enetsw.
-
-Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
----
- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++-------
- 1 file changed, 23 insertions(+), 8 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1790,7 +1790,9 @@ static int bcm_enet_probe(struct platfor
- 		ret = PTR_ERR(priv->mac_clk);
- 		goto out;
- 	}
--	clk_prepare_enable(priv->mac_clk);
-+	ret = clk_prepare_enable(priv->mac_clk);
-+	if (ret)
-+		goto out_put_clk_mac;
- 
- 	/* initialize default and fetch platform data */
- 	priv->rx_ring_size = BCMENET_DEF_RX_DESC;
-@@ -1822,9 +1824,11 @@ static int bcm_enet_probe(struct platfor
- 		if (IS_ERR(priv->phy_clk)) {
- 			ret = PTR_ERR(priv->phy_clk);
- 			priv->phy_clk = NULL;
--			goto out_put_clk_mac;
-+			goto out_disable_clk_mac;
- 		}
--		clk_prepare_enable(priv->phy_clk);
-+		ret = clk_prepare_enable(priv->phy_clk);
-+		if (ret)
-+			goto out_put_clk_phy;
- 	}
- 
- 	/* do minimal hardware init to be able to probe mii bus */
-@@ -1915,13 +1919,16 @@ out_free_mdio:
- out_uninit_hw:
- 	/* turn off mdc clock */
- 	enet_writel(priv, 0, ENET_MIISC_REG);
--	if (priv->phy_clk) {
-+	if (priv->phy_clk)
- 		clk_disable_unprepare(priv->phy_clk);
-+
-+out_put_clk_phy:
-+	if (priv->phy_clk)
- 		clk_put(priv->phy_clk);
--	}
- 
--out_put_clk_mac:
-+out_disable_clk_mac:
- 	clk_disable_unprepare(priv->mac_clk);
-+out_put_clk_mac:
- 	clk_put(priv->mac_clk);
- out:
- 	free_netdev(dev);
-@@ -2766,7 +2773,9 @@ static int bcm_enetsw_probe(struct platf
- 		ret = PTR_ERR(priv->mac_clk);
- 		goto out_unmap;
- 	}
--	clk_enable(priv->mac_clk);
-+	ret = clk_prepare_enable(priv->mac_clk);
-+	if (ret)
-+		goto out_put_clk;
- 
- 	priv->rx_chan = 0;
- 	priv->tx_chan = 1;
-@@ -2787,7 +2796,7 @@ static int bcm_enetsw_probe(struct platf
- 
- 	ret = register_netdev(dev);
- 	if (ret)
--		goto out_put_clk;
-+		goto out_disable_clk;
- 
- 	netif_carrier_off(dev);
- 	platform_set_drvdata(pdev, dev);
-@@ -2796,6 +2805,9 @@ static int bcm_enetsw_probe(struct platf
- 
- 	return 0;
- 
-+out_disable_clk:
-+	clk_disable_unprepare(priv->mac_clk);
-+
- out_put_clk:
- 	clk_put(priv->mac_clk);
- 
-@@ -2827,6 +2839,9 @@ static int bcm_enetsw_remove(struct plat
- 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- 	release_mem_region(res->start, resource_size(res));
- 
-+	clk_disable_unprepare(priv->mac_clk);
-+	clk_put(priv->mac_clk);
-+
- 	free_netdev(dev);
- 	return 0;
- }
diff --git a/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch b/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
deleted file mode 100644
index 22c6d01873..0000000000
--- a/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 23d94cb855b6f4f0ee1c01679224472104ac6440 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Sat, 30 Sep 2017 14:10:18 +0200
-Subject: [PATCH 2/6] bcm63xx_enet: do not write to random DMA channel on
- BCM6345
-
-The DMA controller regs actually point to DMA channel 0, so the write to
-ENETDMA_CFG_REG will actually modify a random DMA channel.
-
-Since DMA controller registers do not exist on BCM6345, guard the write
-with the usual check for dma_has_sram.
-
-Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
----
- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1063,7 +1063,8 @@ static int bcm_enet_open(struct net_devi
- 	val = enet_readl(priv, ENET_CTL_REG);
- 	val |= ENET_CTL_ENABLE_MASK;
- 	enet_writel(priv, val, ENET_CTL_REG);
--	enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
-+	if (priv->dma_has_sram)
-+		enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
- 	enet_dmac_writel(priv, priv->dma_chan_en_mask,
- 			 ENETDMAC_CHANCFG, priv->rx_chan);
- 
diff --git a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch
index 7bf4fd47d2..172e714c5d 100644
--- a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch
+++ b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch
@@ -45,7 +45,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  	return (struct tcp_sock *)sk;
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -784,10 +784,10 @@ static void tcp_tasklet_func(unsigned lo
+@@ -789,10 +789,10 @@ static void tcp_tasklet_func(unsigned lo
  	}
  }
  
@@ -60,7 +60,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  /**
   * tcp_release_cb - tcp release_sock() callback
   * @sk: socket
-@@ -808,7 +808,7 @@ void tcp_release_cb(struct sock *sk)
+@@ -813,7 +813,7 @@ void tcp_release_cb(struct sock *sk)
  		nflags = flags & ~TCP_DEFERRED_ALL;
  	} while (cmpxchg(&tp->tsq_flags, flags, nflags) != flags);
  
@@ -69,7 +69,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		tcp_tsq_handler(sk);
  
  	/* Here begins the tricky part :
-@@ -822,15 +822,15 @@ void tcp_release_cb(struct sock *sk)
+@@ -827,15 +827,15 @@ void tcp_release_cb(struct sock *sk)
  	 */
  	sock_release_ownership(sk);
  
diff --git a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch
index 914be607e7..af194b2bed 100644
--- a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch
+++ b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch
@@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -860,6 +860,7 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -865,6 +865,7 @@ void tcp_wfree(struct sk_buff *skb)
  {
  	struct sock *sk = skb->sk;
  	struct tcp_sock *tp = tcp_sk(sk);
@@ -25,7 +25,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  	int wmem;
  
  	/* Keep one reference on sk_wmem_alloc.
-@@ -877,11 +878,17 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -882,11 +883,17 @@ void tcp_wfree(struct sk_buff *skb)
  	if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current)
  		goto out;
  
diff --git a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch
index f5004d3ffc..b9b3c55076 100644
--- a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch
+++ b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch
@@ -22,7 +22,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -767,19 +767,19 @@ static void tcp_tasklet_func(unsigned lo
+@@ -772,19 +772,19 @@ static void tcp_tasklet_func(unsigned lo
  	list_for_each_safe(q, n, &list) {
  		tp = list_entry(q, struct tcp_sock, tsq_node);
  		list_del(&tp->tsq_node);
@@ -51,7 +51,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		sk_free(sk);
  	}
  }
-@@ -884,7 +884,7 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -889,7 +889,7 @@ void tcp_wfree(struct sk_buff *skb)
  		if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED))
  			goto out;
  
@@ -60,7 +60,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		nval = cmpxchg(&tp->tsq_flags, oval, nval);
  		if (nval != oval)
  			continue;
-@@ -2210,6 +2210,8 @@ static bool tcp_write_xmit(struct sock *
+@@ -2222,6 +2222,8 @@ static bool tcp_write_xmit(struct sock *
  		    unlikely(tso_fragment(sk, skb, limit, mss_now, gfp)))
  			break;
  
diff --git a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch
index a25cdb5717..87452ac853 100644
--- a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch
+++ b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch
@@ -16,7 +16,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -880,6 +880,7 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -885,6 +885,7 @@ void tcp_wfree(struct sk_buff *skb)
  
  	for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) {
  		struct tsq_tasklet *tsq;
@@ -24,7 +24,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  
  		if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED))
  			goto out;
-@@ -892,8 +893,10 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -897,8 +898,10 @@ void tcp_wfree(struct sk_buff *skb)
  		/* queue this socket to tasklet queue */
  		local_irq_save(flags);
  		tsq = this_cpu_ptr(&tsq_tasklet);
diff --git a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch
index 65013b6aa7..d04e365f98 100644
--- a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch
+++ b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch
@@ -19,7 +19,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -2115,6 +2115,15 @@ static bool tcp_small_queue_check(struct
+@@ -2127,6 +2127,15 @@ static bool tcp_small_queue_check(struct
  	limit <<= factor;
  
  	if (atomic_read(&sk->sk_wmem_alloc) > limit) {
diff --git a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch
index 6f2d196687..2a6cd40c8a 100644
--- a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch
+++ b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch
@@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -1948,26 +1948,26 @@ static bool tcp_can_coalesce_send_queue_
+@@ -1960,26 +1960,26 @@ static bool tcp_can_coalesce_send_queue_
   */
  static int tcp_mtu_probe(struct sock *sk)
  {
diff --git a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch
index 292b381f8d..0a5b9ead9d 100644
--- a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch
+++ b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch
@@ -58,7 +58,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  			goto out;
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -767,14 +767,15 @@ static void tcp_tasklet_func(unsigned lo
+@@ -772,14 +772,15 @@ static void tcp_tasklet_func(unsigned lo
  	list_for_each_safe(q, n, &list) {
  		tp = list_entry(q, struct tcp_sock, tsq_node);
  		list_del(&tp->tsq_node);
@@ -77,7 +77,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  				tcp_tsq_handler(sk);
  			}
  			bh_unlock_sock(sk);
-@@ -797,16 +798,15 @@ static void tcp_tasklet_func(unsigned lo
+@@ -802,16 +803,15 @@ static void tcp_tasklet_func(unsigned lo
   */
  void tcp_release_cb(struct sock *sk)
  {
@@ -96,7 +96,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  
  	if (flags & TCPF_TSQ_DEFERRED)
  		tcp_tsq_handler(sk);
-@@ -878,7 +878,7 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -883,7 +883,7 @@ void tcp_wfree(struct sk_buff *skb)
  	if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current)
  		goto out;
  
@@ -105,7 +105,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		struct tsq_tasklet *tsq;
  		bool empty;
  
-@@ -886,7 +886,7 @@ void tcp_wfree(struct sk_buff *skb)
+@@ -891,7 +891,7 @@ void tcp_wfree(struct sk_buff *skb)
  			goto out;
  
  		nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED;
@@ -114,7 +114,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		if (nval != oval)
  			continue;
  
-@@ -2124,7 +2124,7 @@ static bool tcp_small_queue_check(struct
+@@ -2136,7 +2136,7 @@ static bool tcp_small_queue_check(struct
  		    skb->prev == sk->sk_write_queue.next)
  			return false;
  
@@ -123,7 +123,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		/* It is possible TX completion already happened
  		 * before we set TSQ_THROTTLED, so we must
  		 * test again the condition.
-@@ -2222,8 +2222,8 @@ static bool tcp_write_xmit(struct sock *
+@@ -2234,8 +2234,8 @@ static bool tcp_write_xmit(struct sock *
  		    unlikely(tso_fragment(sk, skb, limit, mss_now, gfp)))
  			break;
  
@@ -134,7 +134,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  		if (tcp_small_queue_check(sk, skb, 0))
  			break;
  
-@@ -3534,8 +3534,6 @@ void tcp_send_ack(struct sock *sk)
+@@ -3546,8 +3546,6 @@ void __tcp_send_ack(struct sock *sk, u32
  	/* We do not want pure acks influencing TCP Small Queues or fq/pacing
  	 * too much.
  	 * SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784
diff --git a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch
index d2b8de6a04..bd74303266 100644
--- a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch
+++ b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch
@@ -30,7 +30,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -769,6 +769,7 @@ static void tcp_tasklet_func(unsigned lo
+@@ -774,6 +774,7 @@ static void tcp_tasklet_func(unsigned lo
  		list_del(&tp->tsq_node);
  
  		sk = (struct sock *)tp;
diff --git a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch
index 33593194d5..be3140bb9c 100644
--- a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch
+++ b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch
@@ -65,7 +65,7 @@ Cc: Kir Kolyshkin <kir at openvz.org>
  	 * Before updating sk_refcnt, we must commit prior changes to memory
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -1581,7 +1581,7 @@ u32 tcp_tso_autosize(const struct sock *
+@@ -1593,7 +1593,7 @@ u32 tcp_tso_autosize(const struct sock *
  {
  	u32 bytes, segs;
  
@@ -74,7 +74,7 @@ Cc: Kir Kolyshkin <kir at openvz.org>
  		    sk->sk_gso_max_size - 1 - MAX_TCP_HEADER);
  
  	/* Goal is to send at least one packet per ms,
-@@ -2111,7 +2111,7 @@ static bool tcp_small_queue_check(struct
+@@ -2123,7 +2123,7 @@ static bool tcp_small_queue_check(struct
  {
  	unsigned int limit;
  
diff --git a/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch b/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch
index 84714ce1e1..7a971169bc 100644
--- a/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch
+++ b/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch
@@ -52,7 +52,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  extern void __free_page_frag(void *addr);
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
-@@ -3946,6 +3946,20 @@ static struct page *__page_frag_refill(s
+@@ -3945,6 +3945,20 @@ static struct page *__page_frag_refill(s
  	return page;
  }
  
diff --git a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch
index 896ba415fe..fbd3316016 100644
--- a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch
+++ b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch
@@ -63,7 +63,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  void *napi_alloc_frag(unsigned int fragsz);
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
-@@ -3960,8 +3960,8 @@ void __page_frag_drain(struct page *page
+@@ -3959,8 +3959,8 @@ void __page_frag_drain(struct page *page
  }
  EXPORT_SYMBOL(__page_frag_drain);
  
@@ -74,7 +74,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  {
  	unsigned int size = PAGE_SIZE;
  	struct page *page;
-@@ -4012,19 +4012,19 @@ refill:
+@@ -4011,19 +4011,19 @@ refill:
  
  	return nc->va + offset;
  }
diff --git a/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch b/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch
index 117b01d504..64fdc7606c 100644
--- a/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch
+++ b/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch
@@ -33,7 +33,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  extern void page_frag_free(void *addr);
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
-@@ -3925,8 +3925,8 @@ EXPORT_SYMBOL(free_pages);
+@@ -3924,8 +3924,8 @@ EXPORT_SYMBOL(free_pages);
   * drivers to provide a backing region of memory for use as either an
   * sk_buff->head, or to be used in the "frags" portion of skb_shared_info.
   */
@@ -44,7 +44,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  {
  	struct page *page = NULL;
  	gfp_t gfp = gfp_mask;
-@@ -3946,19 +3946,20 @@ static struct page *__page_frag_refill(s
+@@ -3945,19 +3945,20 @@ static struct page *__page_frag_refill(s
  	return page;
  }
  
@@ -68,7 +68,7 @@ Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
  
  void *page_frag_alloc(struct page_frag_cache *nc,
  		      unsigned int fragsz, gfp_t gfp_mask)
-@@ -3969,7 +3970,7 @@ void *page_frag_alloc(struct page_frag_c
+@@ -3968,7 +3969,7 @@ void *page_frag_alloc(struct page_frag_c
  
  	if (unlikely(!nc->va)) {
  refill:
diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
index 5c0388ed0f..00f9339abe 100644
--- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
+++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch
@@ -214,14 +214,14 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  				   RCANFD_RFCC_RFIE);
 --- a/drivers/net/can/xilinx_can.c
 +++ b/drivers/net/can/xilinx_can.c
-@@ -726,7 +726,7 @@ static int xcan_rx_poll(struct napi_stru
- 		can_led_event(ndev, CAN_LED_EVENT_RX);
+@@ -838,7 +838,7 @@ static int xcan_rx_poll(struct napi_stru
+ 	}
  
  	if (work_done < quota) {
 -		napi_complete(napi);
 +		napi_complete_done(napi, work_done);
  		ier = priv->read_reg(priv, XCAN_IER_OFFSET);
- 		ier |= (XCAN_IXR_RXOK_MASK | XCAN_IXR_RXNEMP_MASK);
+ 		ier |= XCAN_IXR_RXNEMP_MASK;
  		priv->write_reg(priv, XCAN_IER_OFFSET, ier);
 --- a/drivers/net/ethernet/3com/typhoon.c
 +++ b/drivers/net/ethernet/3com/typhoon.c
@@ -1117,7 +1117,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
  	return work_done;
 --- a/drivers/net/ethernet/sun/sungem.c
 +++ b/drivers/net/ethernet/sun/sungem.c
-@@ -922,7 +922,7 @@ static int gem_poll(struct napi_struct *
+@@ -924,7 +924,7 @@ static int gem_poll(struct napi_struct *
  		gp->status = readl(gp->regs + GREG_STAT);
  	} while (gp->status & GREG_STAT_NAPI);
  
diff --git a/target/linux/generic/hack-4.9/207-disable-modorder.patch b/target/linux/generic/hack-4.9/207-disable-modorder.patch
index f9b3ac4dcf..1a72c91be2 100644
--- a/target/linux/generic/hack-4.9/207-disable-modorder.patch
+++ b/target/linux/generic/hack-4.9/207-disable-modorder.patch
@@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/Makefile
 +++ b/Makefile
-@@ -1211,7 +1211,6 @@ all: modules
+@@ -1212,7 +1212,6 @@ all: modules
  
  PHONY += modules
  modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
@@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	@$(kecho) '  Building modules, stage 2.';
  	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
  	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
-@@ -1241,7 +1240,6 @@ _modinst_:
+@@ -1242,7 +1241,6 @@ _modinst_:
  		rm -f $(MODLIB)/build ; \
  		ln -s $(CURDIR) $(MODLIB)/build ; \
  	fi
diff --git a/target/linux/generic/hack-4.9/211-host_tools_portability.patch b/target/linux/generic/hack-4.9/211-host_tools_portability.patch
index e6fd328431..e4d6851418 100644
--- a/target/linux/generic/hack-4.9/211-host_tools_portability.patch
+++ b/target/linux/generic/hack-4.9/211-host_tools_portability.patch
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/tools/build/Build.include
 +++ b/tools/build/Build.include
-@@ -95,4 +95,4 @@ cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(
+@@ -96,4 +96,4 @@ cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(
  ###
  ## HOSTCC C flags
  
diff --git a/target/linux/generic/hack-4.9/220-gc_sections.patch b/target/linux/generic/hack-4.9/220-gc_sections.patch
index 40e4905db2..a041ff1d03 100644
--- a/target/linux/generic/hack-4.9/220-gc_sections.patch
+++ b/target/linux/generic/hack-4.9/220-gc_sections.patch
@@ -33,9 +33,9 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  # Read KERNELRELEASE from include/config/kernel.release (if it exists)
  KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
  KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
-@@ -636,11 +641,6 @@ KBUILD_CFLAGS	+= $(call cc-disable-warni
- KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
+@@ -637,11 +642,6 @@ KBUILD_CFLAGS	+= $(call cc-disable-warni
  KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
+ KBUILD_CFLAGS	+= $(call cc-disable-warning, attribute-alias)
  
 -ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
 -KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
diff --git a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch
index adae2e049c..5b886b30fd 100644
--- a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch
+++ b/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch
@@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO at vplace.de>
 
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
-@@ -5918,7 +5918,7 @@ static void __ref alloc_node_mem_map(str
+@@ -5932,7 +5932,7 @@ static void __ref alloc_node_mem_map(str
  		mem_map = NODE_DATA(0)->node_mem_map;
  #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
  		if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
diff --git a/target/linux/generic/pending-4.9/201-extra_optimization.patch b/target/linux/generic/pending-4.9/201-extra_optimization.patch
index 2da816e4e0..3e878e96d6 100644
--- a/target/linux/generic/pending-4.9/201-extra_optimization.patch
+++ b/target/linux/generic/pending-4.9/201-extra_optimization.patch
@@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/Makefile
 +++ b/Makefile
-@@ -642,12 +642,12 @@ KBUILD_CFLAGS	+= $(call cc-option,-fdata
+@@ -643,12 +643,12 @@ KBUILD_CFLAGS	+= $(call cc-option,-fdata
  endif
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
diff --git a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch
index 217d20ec5d..d3a6afa804 100644
--- a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch
+++ b/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch
@@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	if (!xt_percpu_counter_alloc(alloc_state, &e->counters))
  		return -ENOMEM;
  
-@@ -829,6 +857,7 @@ copy_entries_to_user(unsigned int total_
+@@ -830,6 +858,7 @@ copy_entries_to_user(unsigned int total_
  	const struct xt_table_info *private = table->private;
  	int ret = 0;
  	const void *loc_cpu_entry;
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	counters = alloc_counters(table);
  	if (IS_ERR(counters))
-@@ -856,6 +885,14 @@ copy_entries_to_user(unsigned int total_
+@@ -857,6 +886,14 @@ copy_entries_to_user(unsigned int total_
  			goto free_counters;
  		}
  
@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  		for (i = sizeof(struct ipt_entry);
  		     i < e->target_offset;
  		     i += m->u.match_size) {
-@@ -1245,12 +1282,15 @@ compat_copy_entry_to_user(struct ipt_ent
+@@ -1246,12 +1283,15 @@ compat_copy_entry_to_user(struct ipt_ent
  	compat_uint_t origsize;
  	const struct xt_entry_match *ematch;
  	int ret = 0;
diff --git a/target/linux/generic/pending-4.9/630-packet_socket_type.patch b/target/linux/generic/pending-4.9/630-packet_socket_type.patch
index 0bf9339d11..08d730ac31 100644
--- a/target/linux/generic/pending-4.9/630-packet_socket_type.patch
+++ b/target/linux/generic/pending-4.9/630-packet_socket_type.patch
@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	if (!net_eq(dev_net(dev), sock_net(sk)))
  		goto drop;
  
-@@ -3262,6 +3264,7 @@ static int packet_create(struct net *net
+@@ -3260,6 +3262,7 @@ static int packet_create(struct net *net
  	mutex_init(&po->pg_vec_lock);
  	po->rollover = NULL;
  	po->prot_hook.func = packet_rcv;
@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	if (sock->type == SOCK_PACKET)
  		po->prot_hook.func = packet_rcv_spkt;
-@@ -3875,6 +3878,16 @@ packet_setsockopt(struct socket *sock, i
+@@ -3873,6 +3876,16 @@ packet_setsockopt(struct socket *sock, i
  		po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
  		return 0;
  	}
@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  	default:
  		return -ENOPROTOOPT;
  	}
-@@ -3927,6 +3940,13 @@ static int packet_getsockopt(struct sock
+@@ -3925,6 +3938,13 @@ static int packet_getsockopt(struct sock
  	case PACKET_VNET_HDR:
  		val = po->has_vnet_hdr;
  		break;
diff --git a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch b/target/linux/generic/pending-4.9/834-ledtrig-libata.patch
index 4b319bd399..b2c0b48980 100644
--- a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch
+++ b/target/linux/generic/pending-4.9/834-ledtrig-libata.patch
@@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  /**
   *	ata_build_rw_tf - Build ATA taskfile for given read/write request
   *	@tf: Target ATA taskfile
-@@ -4991,6 +5004,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
+@@ -4994,6 +5007,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
  		if (tag < 0)
  			return NULL;
  	}
@@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  
  	qc = __ata_qc_from_tag(ap, tag);
  	qc->tag = tag;
-@@ -5892,6 +5908,9 @@ struct ata_port *ata_port_alloc(struct a
+@@ -5895,6 +5911,9 @@ struct ata_port *ata_port_alloc(struct a
  	ap->stats.unhandled_irq = 1;
  	ap->stats.idle_irq = 1;
  #endif
@@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  	ata_sff_port_init(ap);
  
  	return ap;
-@@ -5913,6 +5932,12 @@ static void ata_host_release(struct devi
+@@ -5916,6 +5935,12 @@ static void ata_host_release(struct devi
  
  		kfree(ap->pmp_link);
  		kfree(ap->slave_link);
@@ -98,7 +98,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  		kfree(ap);
  		host->ports[i] = NULL;
  	}
-@@ -6359,7 +6384,23 @@ int ata_host_register(struct ata_host *h
+@@ -6362,7 +6387,23 @@ int ata_host_register(struct ata_host *h
  		host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
  		host->ports[i]->local_port_no = i + 1;
  	}
@@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  
  /*
   * Define if arch has non-standard setup.  This is a _PCI_ standard
-@@ -883,6 +886,12 @@ struct ata_port {
+@@ -884,6 +887,12 @@ struct ata_port {
  #ifdef CONFIG_ATA_ACPI
  	struct ata_acpi_gtm	__acpi_init_gtm; /* use ata_acpi_init_gtm() */
  #endif
diff --git a/target/linux/generic/pending-4.9/900-gen_stats-fix-netlink-stats-padding.patch b/target/linux/generic/pending-4.9/900-gen_stats-fix-netlink-stats-padding.patch
deleted file mode 100644
index f5ceecca93..0000000000
--- a/target/linux/generic/pending-4.9/900-gen_stats-fix-netlink-stats-padding.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-The gen_stats facility will add a header for the toplevel nlattr of type
-TCA_STATS2 that contains all stats added by qdisc callbacks. A reference
-to this header is stored in the gnet_dump struct, and when all the
-per-qdisc callbacks have finished adding their stats, the length of the
-containing header will be adjusted to the right value.
-
-However, on architectures that need padding (i.e., that don't set
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), the padding nlattr is added
-before the stats, which means that the stored pointer will point to the
-padding, and so when the header is fixed up, the result is just a very
-big padding nlattr. Because most qdiscs also supply the legacy TCA_STATS
-struct, this problem has been mostly invisible, but we exposed it with
-the netlink attribute-based statistics in CAKE.
-
-Fix the issue by fixing up the stored pointer if it points to a padding
-nlattr.
-
-Tested-by: Pete Heist <pete at heistp.net>
-Tested-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
-Signed-off-by: Toke Høiland-Jørgensen <toke at toke.dk>
----
- net/core/gen_stats.c |   16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
---- a/net/core/gen_stats.c
-+++ b/net/core/gen_stats.c
-@@ -77,8 +77,20 @@ gnet_stats_start_copy_compat(struct sk_b
- 		d->lock = lock;
- 		spin_lock_bh(lock);
- 	}
--	if (d->tail)
--		return gnet_stats_copy(d, type, NULL, 0, padattr);
-+	if (d->tail) {
-+		int ret = gnet_stats_copy(d, type, NULL, 0, padattr);
-+
-+		/* The initial attribute added in gnet_stats_copy() may be
-+		 * preceded by a padding attribute, in which case d->tail will
-+		 * end up pointing at the padding instead of the real attribute.
-+		 * Fix this so gnet_stats_finish_copy() adjusts the length of
-+		 * the right attribute.
-+		 */
-+		if (ret == 0 && d->tail->nla_type == padattr)
-+			d->tail = (struct nlattr *)((char *)d->tail +
-+						    NLA_ALIGN(d->tail->nla_len));
-+		return ret;
-+	}
- 
- 	return 0;
- }
diff --git a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch
index 80688a4c0a..046ec4e8f3 100644
--- a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch
+++ b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch
@@ -10,7 +10,7 @@
  
  	/* Get the HEAD */
  	skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node);
-@@ -1223,6 +1226,10 @@ int pskb_expand_head(struct sk_buff *skb
+@@ -1224,6 +1227,10 @@ int pskb_expand_head(struct sk_buff *skb
  	if (skb_shared(skb))
  		BUG();
  
diff --git a/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch b/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch
index 7617c14ddb..cfeded1ebc 100644
--- a/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch
+++ b/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch
@@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
  
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
-@@ -200,6 +201,10 @@ static int m25p_probe(struct spi_device
+@@ -201,6 +202,10 @@ static int m25p_probe(struct spi_device
  	enum read_mode mode = SPI_NOR_NORMAL;
  	char *flash_name;
  	int ret;
@@ -33,7 +33,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
  
  	data = dev_get_platdata(&spi->dev);
  
-@@ -229,6 +234,8 @@ static int m25p_probe(struct spi_device
+@@ -230,6 +235,8 @@ static int m25p_probe(struct spi_device
  
  	if (data && data->name)
  		nor->mtd.name = data->name;
diff --git a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
index dd71b826fd..3484fc398e 100644
--- a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch
@@ -384,7 +384,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  void  __kfree_skb(struct sk_buff *skb);
  extern struct kmem_cache *skbuff_head_cache;
  
-@@ -3057,6 +3058,7 @@ static inline void skb_free_datagram_loc
+@@ -3059,6 +3060,7 @@ static inline void skb_free_datagram_loc
  }
  int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
  int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
@@ -477,7 +477,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  /* Make sure a field is enclosed inside headers_start/headers_end section */
  #define CHECK_SKB_FIELD(field) \
  	BUILD_BUG_ON(offsetof(struct sk_buff, field) <		\
-@@ -1074,7 +1100,7 @@ static void skb_headers_offset_update(st
+@@ -1075,7 +1101,7 @@ static void skb_headers_offset_update(st
  	skb->inner_mac_header += off;
  }
  
@@ -486,7 +486,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  {
  	__copy_skb_header(new, old);
  
-@@ -1082,6 +1108,7 @@ static void copy_skb_header(struct sk_bu
+@@ -1083,6 +1109,7 @@ static void copy_skb_header(struct sk_bu
  	skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
  	skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
  }
diff --git a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
index acc75cdc2c..4327a26648 100644
--- a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch
@@ -1724,7 +1724,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  		ret = phydrv->resume(phydev);
  
  	if (ret)
-@@ -1726,7 +1726,7 @@ static int phy_remove(struct device *dev
+@@ -1723,7 +1723,7 @@ static int phy_remove(struct device *dev
  	phydev->state = PHY_DOWN;
  	mutex_unlock(&phydev->lock);
  
diff --git a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch
index 3ec91b4982..9225e93c1a 100644
--- a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch
@@ -87,7 +87,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  			pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK;
  			if (pkt_len < ETH_ZLEN)
  				break;
-@@ -4509,6 +4514,7 @@ static struct usb_device_id rtl8152_tabl
+@@ -4510,6 +4515,7 @@ static struct usb_device_id rtl8152_tabl
  	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x304f)},
  	{REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
  	{REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA,  0x09ff)},
@@ -156,7 +156,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  	int ret;
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
-@@ -4423,6 +4423,14 @@ hub_port_init(struct usb_hub *hub, struc
+@@ -4427,6 +4427,14 @@ hub_port_init(struct usb_hub *hub, struc
  	else
  		speed = usb_speed_string(udev->speed);
  
@@ -1494,7 +1494,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  		while (ep_ring->dequeue != td->last_trb)
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
-@@ -1570,14 +1570,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd
+@@ -1604,14 +1604,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd
  			ret = -ENOMEM;
  			goto done;
  		}
@@ -1542,7 +1542,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  	spin_unlock_irqrestore(&xhci->lock, flags);
 --- a/drivers/usb/host/xhci.h
 +++ b/drivers/usb/host/xhci.h
-@@ -1621,7 +1621,7 @@ struct xhci_hcd {
+@@ -1625,7 +1625,7 @@ struct xhci_hcd {
  #define XHCI_STATE_REMOVING	(1 << 2)
  	/* Statistics */
  	int			error_bitmask;
@@ -1551,7 +1551,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu at nxp.com>
  #define	XHCI_LINK_TRB_QUIRK	(1 << 0)
  #define XHCI_RESET_EP_QUIRK	(1 << 1)
  #define XHCI_NEC_HOST		(1 << 2)
-@@ -1657,6 +1657,9 @@ struct xhci_hcd {
+@@ -1661,6 +1661,9 @@ struct xhci_hcd {
  #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
  #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
  #define XHCI_MISSING_CAS	(1 << 24)
diff --git a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
index 1ed1294694..a1b018186f 100644
--- a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
+++ b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch
@@ -3095,7 +3095,7 @@
  
  	if (priv->hw->mode->set_16kib_bfsize)
  		bfsize = priv->hw->mode->set_16kib_bfsize(dev->mtu);
-@@ -1033,257 +1234,516 @@ static int init_dma_desc_rings(struct ne
+@@ -1033,235 +1234,409 @@ static int init_dma_desc_rings(struct ne
  
  	priv->dma_buf_sz = bfsize;
  
@@ -3351,10 +3351,17 @@
 -						 priv->tx_skbuff_dma[i].buf,
 -						 priv->tx_skbuff_dma[i].len,
 -						 DMA_TO_DEVICE);
+-		}
 +	for (i = 0; i < DMA_TX_SIZE; i++)
 +		stmmac_free_tx_buffer(priv, queue, i);
 +}
-+
+ 
+-		if (priv->tx_skbuff[i]) {
+-			dev_kfree_skb_any(priv->tx_skbuff[i]);
+-			priv->tx_skbuff[i] = NULL;
+-			priv->tx_skbuff_dma[i].buf = 0;
+-			priv->tx_skbuff_dma[i].map_as_page = false;
+-		}
 +/**
 + * free_dma_rx_desc_resources - free RX dma desc resources
 + * @priv: private structure
@@ -3383,10 +3390,11 @@
 +
 +		kfree(rx_q->rx_skbuff_dma);
 +		kfree(rx_q->rx_skbuff);
-+	}
-+}
-+
-+/**
+ 	}
+ }
+ 
+ /**
+- * alloc_dma_desc_resources - alloc TX/RX resources.
 + * free_dma_tx_desc_resources - free TX dma desc resources
 + * @priv: private structure
 + */
@@ -3419,36 +3427,90 @@
 +
 +/**
 + * alloc_dma_rx_desc_resources - alloc RX resources.
-+ * @priv: private structure
-+ * Description: according to which descriptor can be used (extend or basic)
-+ * this function allocates the resources for TX and RX paths. In case of
-+ * reception, for example, it pre-allocated the RX socket buffer in order to
-+ * allow zero-copy mechanism.
-+ */
+  * @priv: private structure
+  * Description: according to which descriptor can be used (extend or basic)
+  * this function allocates the resources for TX and RX paths. In case of
+  * reception, for example, it pre-allocated the RX socket buffer in order to
+  * allow zero-copy mechanism.
+  */
+-static int alloc_dma_desc_resources(struct stmmac_priv *priv)
 +static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
-+{
+ {
 +	u32 rx_count = priv->plat->rx_queues_to_use;
-+	int ret = -ENOMEM;
+ 	int ret = -ENOMEM;
 +	u32 queue;
-+
+ 
+-	priv->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE, sizeof(dma_addr_t),
+-					    GFP_KERNEL);
+-	if (!priv->rx_skbuff_dma)
+-		return -ENOMEM;
 +	/* RX queues buffers and DMA */
 +	for (queue = 0; queue < rx_count; queue++) {
 +		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
-+
+ 
+-	priv->rx_skbuff = kmalloc_array(DMA_RX_SIZE, sizeof(struct sk_buff *),
+-					GFP_KERNEL);
+-	if (!priv->rx_skbuff)
+-		goto err_rx_skbuff;
+-
+-	priv->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE,
+-					    sizeof(*priv->tx_skbuff_dma),
+-					    GFP_KERNEL);
+-	if (!priv->tx_skbuff_dma)
+-		goto err_tx_skbuff_dma;
+-
+-	priv->tx_skbuff = kmalloc_array(DMA_TX_SIZE, sizeof(struct sk_buff *),
+-					GFP_KERNEL);
+-	if (!priv->tx_skbuff)
+-		goto err_tx_skbuff;
+-
+-	if (priv->extend_desc) {
+-		priv->dma_erx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE *
+-						    sizeof(struct
+-							   dma_extended_desc),
+-						    &priv->dma_rx_phy,
+-						    GFP_KERNEL);
+-		if (!priv->dma_erx)
+-			goto err_dma;
 +		rx_q->queue_index = queue;
 +		rx_q->priv_data = priv;
-+
+ 
+-		priv->dma_etx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE *
+-						    sizeof(struct
+-							   dma_extended_desc),
+-						    &priv->dma_tx_phy,
 +		rx_q->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE,
 +						    sizeof(dma_addr_t),
-+						    GFP_KERNEL);
+ 						    GFP_KERNEL);
+-		if (!priv->dma_etx) {
+-			dma_free_coherent(priv->device, DMA_RX_SIZE *
+-					  sizeof(struct dma_extended_desc),
+-					  priv->dma_erx, priv->dma_rx_phy);
+-			goto err_dma;
+-		}
+-	} else {
+-		priv->dma_rx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE *
+-						   sizeof(struct dma_desc),
+-						   &priv->dma_rx_phy,
+-						   GFP_KERNEL);
+-		if (!priv->dma_rx)
+-			goto err_dma;
 +		if (!rx_q->rx_skbuff_dma)
 +			return -ENOMEM;
-+
+ 
+-		priv->dma_tx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE *
+-						   sizeof(struct dma_desc),
+-						   &priv->dma_tx_phy,
+-						   GFP_KERNEL);
+-		if (!priv->dma_tx) {
+-			dma_free_coherent(priv->device, DMA_RX_SIZE *
+-					  sizeof(struct dma_desc),
+-					  priv->dma_rx, priv->dma_rx_phy);
 +		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
 +						sizeof(struct sk_buff *),
 +						GFP_KERNEL);
 +		if (!rx_q->rx_skbuff)
-+			goto err_dma;
+ 			goto err_dma;
 +
 +		if (priv->extend_desc) {
 +			rx_q->dma_erx = dma_zalloc_coherent(priv->device,
@@ -3469,12 +3531,19 @@
 +							   GFP_KERNEL);
 +			if (!rx_q->dma_rx)
 +				goto err_dma;
-+		}
-+	}
-+
-+	return 0;
-+
-+err_dma:
+ 		}
+ 	}
+ 
+ 	return 0;
+ 
+ err_dma:
+-	kfree(priv->tx_skbuff);
+-err_tx_skbuff:
+-	kfree(priv->tx_skbuff_dma);
+-err_tx_skbuff_dma:
+-	kfree(priv->rx_skbuff);
+-err_rx_skbuff:
+-	kfree(priv->rx_skbuff_dma);
 +	free_dma_rx_desc_resources(priv);
 +
 +	return ret;
@@ -3531,7 +3600,7 @@
 +							   GFP_KERNEL);
 +			if (!tx_q->dma_tx)
 +				goto err_dma_buffers;
- 		}
++		}
 +	}
 +
 +	return 0;
@@ -3560,126 +3629,85 @@
 +
 +	ret = alloc_dma_tx_desc_resources(priv);
 +
-+	return ret;
-+}
-+
+ 	return ret;
+ }
+ 
 +/**
 + * free_dma_desc_resources - free dma desc resources
 + * @priv: private structure
 + */
-+static void free_dma_desc_resources(struct stmmac_priv *priv)
-+{
+ static void free_dma_desc_resources(struct stmmac_priv *priv)
+ {
+-	/* Release the DMA TX/RX socket buffers */
+-	dma_free_rx_skbufs(priv);
+-	dma_free_tx_skbufs(priv);
+-
+-	/* Free DMA regions of consistent memory previously allocated */
+-	if (!priv->extend_desc) {
+-		dma_free_coherent(priv->device,
+-				  DMA_TX_SIZE * sizeof(struct dma_desc),
+-				  priv->dma_tx, priv->dma_tx_phy);
+-		dma_free_coherent(priv->device,
+-				  DMA_RX_SIZE * sizeof(struct dma_desc),
+-				  priv->dma_rx, priv->dma_rx_phy);
+-	} else {
+-		dma_free_coherent(priv->device, DMA_TX_SIZE *
+-				  sizeof(struct dma_extended_desc),
+-				  priv->dma_etx, priv->dma_tx_phy);
+-		dma_free_coherent(priv->device, DMA_RX_SIZE *
+-				  sizeof(struct dma_extended_desc),
+-				  priv->dma_erx, priv->dma_rx_phy);
+-	}
+-	kfree(priv->rx_skbuff_dma);
+-	kfree(priv->rx_skbuff);
+-	kfree(priv->tx_skbuff_dma);
+-	kfree(priv->tx_skbuff);
 +	/* Release the DMA RX socket buffers */
 +	free_dma_rx_desc_resources(priv);
 +
 +	/* Release the DMA TX socket buffers */
 +	free_dma_tx_desc_resources(priv);
-+}
-+
-+/**
-+ *  stmmac_mac_enable_rx_queues - Enable MAC rx queues
-+ *  @priv: driver private structure
-+ *  Description: It is used for enabling the rx queues in the MAC
-+ */
-+static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv)
-+{
+ }
+ 
+ /**
+@@ -1271,19 +1646,104 @@ static void free_dma_desc_resources(stru
+  */
+ static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv)
+ {
+-	int rx_count = priv->dma_cap.number_rx_queues;
+-	int queue = 0;
 +	u32 rx_queues_count = priv->plat->rx_queues_to_use;
 +	int queue;
 +	u8 mode;
  
--		if (priv->tx_skbuff[i]) {
--			dev_kfree_skb_any(priv->tx_skbuff[i]);
--			priv->tx_skbuff[i] = NULL;
--			priv->tx_skbuff_dma[i].buf = 0;
--			priv->tx_skbuff_dma[i].map_as_page = false;
--		}
+-	/* If GMAC does not have multiple queues, then this is not necessary*/
+-	if (rx_count == 1)
+-		return;
 +	for (queue = 0; queue < rx_queues_count; queue++) {
 +		mode = priv->plat->rx_queues_cfg[queue].mode_to_use;
 +		priv->hw->mac->rx_queue_enable(priv->hw, mode, queue);
- 	}
- }
++	}
++}
  
- /**
-- * alloc_dma_desc_resources - alloc TX/RX resources.
-- * @priv: private structure
-- * Description: according to which descriptor can be used (extend or basic)
-- * this function allocates the resources for TX and RX paths. In case of
-- * reception, for example, it pre-allocated the RX socket buffer in order to
-- * allow zero-copy mechanism.
+-	/**
+-	 *  If the core is synthesized with multiple rx queues / multiple
+-	 *  dma channels, then rx queues will be disabled by default.
+-	 *  For now only rx queue 0 is enabled.
+-	 */
+-	priv->hw->mac->rx_queue_enable(priv->hw, queue);
++/**
 + * stmmac_start_rx_dma - start RX DMA channel
 + * @priv: driver private structure
 + * @chan: RX channel index
 + * Description:
 + * This starts a RX DMA channel
-  */
--static int alloc_dma_desc_resources(struct stmmac_priv *priv)
++ */
 +static void stmmac_start_rx_dma(struct stmmac_priv *priv, u32 chan)
- {
--	int ret = -ENOMEM;
--
--	priv->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE, sizeof(dma_addr_t),
--					    GFP_KERNEL);
--	if (!priv->rx_skbuff_dma)
--		return -ENOMEM;
--
--	priv->rx_skbuff = kmalloc_array(DMA_RX_SIZE, sizeof(struct sk_buff *),
--					GFP_KERNEL);
--	if (!priv->rx_skbuff)
--		goto err_rx_skbuff;
--
--	priv->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE,
--					    sizeof(*priv->tx_skbuff_dma),
--					    GFP_KERNEL);
--	if (!priv->tx_skbuff_dma)
--		goto err_tx_skbuff_dma;
--
--	priv->tx_skbuff = kmalloc_array(DMA_TX_SIZE, sizeof(struct sk_buff *),
--					GFP_KERNEL);
--	if (!priv->tx_skbuff)
--		goto err_tx_skbuff;
--
--	if (priv->extend_desc) {
--		priv->dma_erx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE *
--						    sizeof(struct
--							   dma_extended_desc),
--						    &priv->dma_rx_phy,
--						    GFP_KERNEL);
--		if (!priv->dma_erx)
--			goto err_dma;
--
--		priv->dma_etx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE *
--						    sizeof(struct
--							   dma_extended_desc),
--						    &priv->dma_tx_phy,
--						    GFP_KERNEL);
--		if (!priv->dma_etx) {
--			dma_free_coherent(priv->device, DMA_RX_SIZE *
--					  sizeof(struct dma_extended_desc),
--					  priv->dma_erx, priv->dma_rx_phy);
--			goto err_dma;
--		}
--	} else {
--		priv->dma_rx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE *
--						   sizeof(struct dma_desc),
--						   &priv->dma_rx_phy,
--						   GFP_KERNEL);
--		if (!priv->dma_rx)
--			goto err_dma;
++{
 +	netdev_dbg(priv->dev, "DMA RX processes started in channel %d\n", chan);
 +	priv->hw->dma->start_rx(priv->ioaddr, chan);
 +}
- 
--		priv->dma_tx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE *
--						   sizeof(struct dma_desc),
--						   &priv->dma_tx_phy,
--						   GFP_KERNEL);
--		if (!priv->dma_tx) {
--			dma_free_coherent(priv->device, DMA_RX_SIZE *
--					  sizeof(struct dma_desc),
--					  priv->dma_rx, priv->dma_rx_phy);
--			goto err_dma;
--		}
--	}
++
 +/**
 + * stmmac_start_tx_dma - start TX DMA channel
 + * @priv: driver private structure
@@ -3692,8 +3720,7 @@
 +	netdev_dbg(priv->dev, "DMA TX processes started in channel %d\n", chan);
 +	priv->hw->dma->start_tx(priv->ioaddr, chan);
 +}
- 
--	return 0;
++
 +/**
 + * stmmac_stop_rx_dma - stop RX DMA channel
 + * @priv: driver private structure
@@ -3706,16 +3733,7 @@
 +	netdev_dbg(priv->dev, "DMA RX processes stopped in channel %d\n", chan);
 +	priv->hw->dma->stop_rx(priv->ioaddr, chan);
 +}
- 
--err_dma:
--	kfree(priv->tx_skbuff);
--err_tx_skbuff:
--	kfree(priv->tx_skbuff_dma);
--err_tx_skbuff_dma:
--	kfree(priv->rx_skbuff);
--err_rx_skbuff:
--	kfree(priv->rx_skbuff_dma);
--	return ret;
++
 +/**
 + * stmmac_stop_tx_dma - stop TX DMA channel
 + * @priv: driver private structure
@@ -3727,9 +3745,8 @@
 +{
 +	netdev_dbg(priv->dev, "DMA TX processes stopped in channel %d\n", chan);
 +	priv->hw->dma->stop_tx(priv->ioaddr, chan);
- }
- 
--static void free_dma_desc_resources(struct stmmac_priv *priv)
++}
++
 +/**
 + * stmmac_start_all_dma - start all RX and TX DMA channels
 + * @priv: driver private structure
@@ -3737,31 +3754,7 @@
 + * This starts all the RX and TX DMA channels
 + */
 +static void stmmac_start_all_dma(struct stmmac_priv *priv)
- {
--	/* Release the DMA TX/RX socket buffers */
--	dma_free_rx_skbufs(priv);
--	dma_free_tx_skbufs(priv);
--
--	/* Free DMA regions of consistent memory previously allocated */
--	if (!priv->extend_desc) {
--		dma_free_coherent(priv->device,
--				  DMA_TX_SIZE * sizeof(struct dma_desc),
--				  priv->dma_tx, priv->dma_tx_phy);
--		dma_free_coherent(priv->device,
--				  DMA_RX_SIZE * sizeof(struct dma_desc),
--				  priv->dma_rx, priv->dma_rx_phy);
--	} else {
--		dma_free_coherent(priv->device, DMA_TX_SIZE *
--				  sizeof(struct dma_extended_desc),
--				  priv->dma_etx, priv->dma_tx_phy);
--		dma_free_coherent(priv->device, DMA_RX_SIZE *
--				  sizeof(struct dma_extended_desc),
--				  priv->dma_erx, priv->dma_rx_phy);
--	}
--	kfree(priv->rx_skbuff_dma);
--	kfree(priv->rx_skbuff);
--	kfree(priv->tx_skbuff_dma);
--	kfree(priv->tx_skbuff);
++{
 +	u32 rx_channels_count = priv->plat->rx_queues_to_use;
 +	u32 tx_channels_count = priv->plat->tx_queues_to_use;
 +	u32 chan = 0;
@@ -3771,38 +3764,23 @@
 +
 +	for (chan = 0; chan < tx_channels_count; chan++)
 +		stmmac_start_tx_dma(priv, chan);
- }
- 
- /**
-- *  stmmac_mac_enable_rx_queues - Enable MAC rx queues
-- *  @priv: driver private structure
-- *  Description: It is used for enabling the rx queues in the MAC
++}
++
++/**
 + * stmmac_stop_all_dma - stop all RX and TX DMA channels
 + * @priv: driver private structure
 + * Description:
 + * This stops the RX and TX DMA channels
-  */
--static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv)
++ */
 +static void stmmac_stop_all_dma(struct stmmac_priv *priv)
- {
--	int rx_count = priv->dma_cap.number_rx_queues;
--	int queue = 0;
++{
 +	u32 rx_channels_count = priv->plat->rx_queues_to_use;
 +	u32 tx_channels_count = priv->plat->tx_queues_to_use;
 +	u32 chan = 0;
- 
--	/* If GMAC does not have multiple queues, then this is not necessary*/
--	if (rx_count == 1)
--		return;
++
 +	for (chan = 0; chan < rx_channels_count; chan++)
 +		stmmac_stop_rx_dma(priv, chan);
- 
--	/**
--	 *  If the core is synthesized with multiple rx queues / multiple
--	 *  dma channels, then rx queues will be disabled by default.
--	 *  For now only rx queue 0 is enabled.
--	 */
--	priv->hw->mac->rx_queue_enable(priv->hw, queue);
++
 +	for (chan = 0; chan < tx_channels_count; chan++)
 +		stmmac_stop_tx_dma(priv, chan);
  }
-- 
2.11.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list