[openwrt/openwrt] kernel: backport upstream commit that allows leaving out .ndo_get_stats64

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 9 01:45:51 PDT 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/fa6bd065ddad1a3e5d507a4eb9b5fd1fd4b4055a

commit fa6bd065ddad1a3e5d507a4eb9b5fd1fd4b4055a
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Oct 9 10:44:10 2024 +0200

    kernel: backport upstream commit that allows leaving out .ndo_get_stats64
    
    Fixes mac80211 backport device statistics.
    
    Fixes: #16642
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...stats64-if-device-if-driver-is-configured.patch | 29 ++++++++++++++++++++++
 ....11-net-free_netdev-exit-earlier-if-dummy.patch |  2 +-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch
new file mode 100644
index 0000000000..871154ecf8
--- /dev/null
+++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch
@@ -0,0 +1,29 @@
+From: Breno Leitao <leitao at debian.org>
+Date: Wed, 28 Feb 2024 03:31:21 -0800
+Subject: [PATCH] net: get stats64 if device if driver is configured
+
+If the network driver is relying in the net core to do stats allocation,
+then we want to dev_get_tstats64() instead of netdev_stats_to_stats64(),
+since there are per-cpu stats that needs to be taken in consideration.
+
+This will also simplify the drivers in regard to statistics. Once the
+driver sets NETDEV_PCPU_STAT_TSTATS, it doesn't not need to allocate the
+stacks, neither it needs to set `.ndo_get_stats64 = dev_get_tstats64`
+for the generic stats collection function anymore.
+
+Signed-off-by: Breno Leitao <leitao at debian.org>
+Reviewed-by: Simon Horman <horms at kernel.org>
+Signed-off-by: Paolo Abeni <pabeni at redhat.com>
+---
+
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -10658,6 +10658,8 @@ struct rtnl_link_stats64 *dev_get_stats(
+ 		ops->ndo_get_stats64(dev, storage);
+ 	} else if (ops->ndo_get_stats) {
+ 		netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev));
++	} else if (dev->pcpu_stat_type == NETDEV_PCPU_STAT_TSTATS) {
++		dev_get_tstats64(dev, storage);
+ 	} else {
+ 		netdev_stats_to_stats64(storage, &dev->stats);
+ 	}
diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch
index 31beb11d54..53f313044a 100644
--- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch
+++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch
@@ -23,7 +23,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
 
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -10966,7 +10966,8 @@ void free_netdev(struct net_device *dev)
+@@ -10968,7 +10968,8 @@ void free_netdev(struct net_device *dev)
  	dev->xdp_bulkq = NULL;
  
  	/*  Compatibility with error handling in drivers */




More information about the lede-commits mailing list