From 2445fd08732e9380afb7008d37ab566be187c6b4 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
Date: Mon, 27 Sep 2021 12:43:06 +0200
Subject: [PATCH] update patches for Ubuntu-5.13.0-17.17

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 ...de-unregister_netdevice-refcount-lea.patch |  8 +--
 ...c-fdb-to-new-unicast-filtering-ports.patch | 68 -------------------
 ...sce-host-bridge-contiguous-apertures.patch | 32 ++++-----
 3 files changed, 20 insertions(+), 88 deletions(-)
 delete mode 100644 patches/kernel/0006-net-bridge-sync-fdb-to-new-unicast-filtering-ports.patch

diff --git a/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch b/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch
index 6d8dd3e..580c8ac 100644
--- a/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch
+++ b/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch
@@ -13,10 +13,10 @@ diff --git a/net/core/dev.c b/net/core/dev.c
 index b91b76890cbc..cb7ffc3e848b 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -10365,7 +10365,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
- 		refcnt = netdev_refcnt_read(dev);
- 
- 		if (refcnt && time_after(jiffies, warning_time + 10 * HZ)) {
+@@ -10517,7 +10517,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
+ 		if (refcnt != 1 &&
+ 		    time_after(jiffies, warning_time +
+ 			       netdev_unregister_timeout_secs * HZ)) {
 -			pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n",
 +			pr_err("unregister_netdevice: waiting for %s to become free. Usage count = %d\n",
  				 dev->name, refcnt);
diff --git a/patches/kernel/0006-net-bridge-sync-fdb-to-new-unicast-filtering-ports.patch b/patches/kernel/0006-net-bridge-sync-fdb-to-new-unicast-filtering-ports.patch
deleted file mode 100644
index 043287e..0000000
--- a/patches/kernel/0006-net-bridge-sync-fdb-to-new-unicast-filtering-ports.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller@proxmox.com>
-Date: Fri, 2 Jul 2021 14:07:36 +0200
-Subject: [PATCH] net: bridge: sync fdb to new unicast-filtering ports
-
-Since commit 2796d0c648c9 ("bridge: Automatically manage
-port promiscuous mode.")
-bridges with `vlan_filtering 1` and only 1 auto-port don't
-set IFF_PROMISC for unicast-filtering-capable ports.
-
-Normally on port changes `br_manage_promisc` is called to
-update the promisc flags and unicast filters if necessary,
-but it cannot distinguish between *new* ports and ones
-losing their promisc flag, and new ports end up not
-receiving the MAC address list.
-
-Fix this by calling `br_fdb_sync_static` in `br_add_if`
-after the port promisc flags are updated and the unicast
-filter was supposed to have been filled.
-
-Fixes: 2796d0c648c9 ("bridge: Automatically manage port promiscuous mode.")
-Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
----
- net/bridge/br_if.c | 17 ++++++++++++++++-
- 1 file changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
-index f7d2f472ae24..6e4a32354a13 100644
---- a/net/bridge/br_if.c
-+++ b/net/bridge/br_if.c
-@@ -562,7 +562,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
- 	struct net_bridge_port *p;
- 	int err = 0;
- 	unsigned br_hr, dev_hr;
--	bool changed_addr;
-+	bool changed_addr, fdb_synced = false;
- 
- 	/* Don't allow bridging non-ethernet like devices. */
- 	if ((dev->flags & IFF_LOOPBACK) ||
-@@ -652,6 +652,19 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
- 	list_add_rcu(&p->list, &br->port_list);
- 
- 	nbp_update_port_count(br);
-+	if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) {
-+		/* When updating the port count we also update all ports'
-+		 * promiscuous mode.
-+		 * A port leaving promiscuous mode normally gets the bridge's
-+		 * fdb synced to the unicast filter (if supported), however,
-+		 * `br_port_clear_promisc` does not distinguish between
-+		 * non-promiscuous ports and *new* ports, so we need to
-+		 * sync explicitly here.
-+		 */
-+		fdb_synced = br_fdb_sync_static(br, p) == 0;
-+		if (!fdb_synced)
-+			netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n");
-+	}
- 
- 	netdev_update_features(br->dev);
- 
-@@ -701,6 +714,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
- 	return 0;
- 
- err7:
-+	if (fdb_synced)
-+		br_fdb_unsync_static(br, p);
- 	list_del_rcu(&p->list);
- 	br_fdb_delete_by_port(br, p, 0, 1);
- 	nbp_update_port_count(br);
diff --git a/patches/kernel/0008-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch b/patches/kernel/0008-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch
index a3eb9a7..1cd38d8 100644
--- a/patches/kernel/0008-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch
+++ b/patches/kernel/0008-Revert-PCI-Coalesce-host-bridge-contiguous-apertures.patch
@@ -1,24 +1,22 @@
 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
-Date: Mon, 2 Aug 2021 10:22:30 +0200
+From: Thomas Lamprecht <t.lamprecht@proxmox.com>
+Date: Mon, 27 Sep 2021 11:28:39 +0200
 Subject: [PATCH] Revert "PCI: Coalesce host bridge contiguous apertures"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
 
-This reverts commit c2ff8072deba40887560dc73dd2e558ec539ea09.
+This reverts commit ab20e43b20b60f5cc8e2ea3763ffa388158469ac.
 
 was reverted upstream because of reports similar to
 
 Link: https://bugzilla.proxmox.com/show_bug.cgi?id=3552
 Link: https://lore.kernel.org/r/20210709231529.GA3270116@roeck-us.net
 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
+Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 ---
- drivers/pci/probe.c | 49 ++++-----------------------------------------
- 1 file changed, 4 insertions(+), 45 deletions(-)
+ drivers/pci/probe.c | 52 +++++----------------------------------------
+ 1 file changed, 5 insertions(+), 47 deletions(-)
 
 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
-index 04664d4fe4be..be51670572fa 100644
+index f6046a16dac1..275204646c68 100644
 --- a/drivers/pci/probe.c
 +++ b/drivers/pci/probe.c
 @@ -19,7 +19,6 @@
@@ -29,11 +27,12 @@ index 04664d4fe4be..be51670572fa 100644
  #include "pci.h"
  
  #define CARDBUS_LATENCY_TIMER	176	/* secondary latency timer */
-@@ -875,30 +874,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
+@@ -875,31 +874,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
  	dev_set_msi_domain(&bus->dev, d);
  }
  
--static int res_cmp(void *priv, struct list_head *a, struct list_head *b)
+-static int res_cmp(void *priv, const struct list_head *a,
+-		   const struct list_head *b)
 -{
 -	struct resource_entry *entry1, *entry2;
 -
@@ -63,7 +62,7 @@ index 04664d4fe4be..be51670572fa 100644
  	char addr[64], *fmt;
  	const char *name;
  	int err;
-@@ -976,35 +959,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
+@@ -979,35 +961,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
  	if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE)
  		dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n");
  
@@ -90,13 +89,14 @@ index 04664d4fe4be..be51670572fa 100644
 -
  	/* Add initial resources to the bus */
  	resource_list_for_each_entry_safe(window, n, &resources) {
-+		list_move_tail(&window->node, &bridge->windows);
- 		offset = window->offset;
- 		res = window->res;
+-		offset = window->offset;
+-		res = window->res;
 -		if (!res->end)
 -			continue;
 -
--		list_move_tail(&window->node, &bridge->windows);
+ 		list_move_tail(&window->node, &bridge->windows);
++		offset = window->offset;
++		res = window->res;
  
  		if (res->flags & IORESOURCE_BUS)
  			pci_bus_insert_busn_res(bus, bus->number, res->end);