@@ -113,4 +113,14 @@ void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s,
int netif_rx_any_context(struct sk_buff *skb);
#endif /* < 5.10 */
+#if LINUX_VERSION_IS_LESS(5,11,0)
+#define dev_get_tstats64 LINUX_BACKPORT(dev_get_tstats64)
+void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s);
+#endif /* < 5.11 */
+
+#if LINUX_VERSION_IS_LESS(4,11,0)
+struct rtnl_link_stats64 *
+bp_dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s);
+#endif /* < 4.11 */
+
#endif /* __BACKPORT_NETDEVICE_H */
@@ -12,11 +12,13 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-4.6.o
compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
+compat-$(CPTCFG_KERNEL_4_11) += backport-4.11.o
compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
compat-$(CPTCFG_KERNEL_5_2) += backport-5.2.o backport-genetlink.o
compat-$(CPTCFG_KERNEL_5_3) += backport-5.3.o
compat-$(CPTCFG_KERNEL_5_5) += backport-5.5.o
compat-$(CPTCFG_KERNEL_5_10) += backport-5.10.o
+compat-$(CPTCFG_KERNEL_5_11) += backport-5.11.o
compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/verify.o
compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/pkcs7.asn1.o
new file mode 100644
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/netdevice.h>
+
+struct rtnl_link_stats64 *
+bp_dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s)
+{
+ dev_get_tstats64(dev, s);
+ return s;
+}
+EXPORT_SYMBOL_GPL(bp_dev_get_tstats64);
new file mode 100644
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/netdevice.h>
+
+/**
+ * dev_get_tstats64 - ndo_get_stats64 implementation
+ * @dev: device to get statistics from
+ * @s: place to store stats
+ *
+ * Populate @s from dev->stats and dev->tstats. Can be used as
+ * ndo_get_stats64() callback.
+ */
+void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s)
+{
+ netdev_stats_to_stats64(s, &dev->stats);
+ dev_fetch_sw_netstats(s, dev->tstats);
+}
+EXPORT_SYMBOL_GPL(dev_get_tstats64);
dev_get_tstats64() was added as a generic function for .ndo_get_stats64. The signature of this callback function changed with kernel 4.11, add the bp_dev_get_tstats64() function on such older kernel version. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- backport/backport-include/linux/netdevice.h | 10 ++++++++++ backport/compat/Makefile | 2 ++ backport/compat/backport-4.11.c | 12 ++++++++++++ backport/compat/backport-5.11.c | 19 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 backport/compat/backport-4.11.c create mode 100644 backport/compat/backport-5.11.c