backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 02/47] backports: Add dev_get_tstats64() and bp_dev_get_tstats64()
Date: Tue, 19 Oct 2021 23:42:35 +0200	[thread overview]
Message-ID: <20211019214320.2035704-3-hauke@hauke-m.de> (raw)
In-Reply-To: <20211019214320.2035704-1-hauke@hauke-m.de>

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

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index e9c07a91..d854faef 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -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 */
diff --git a/backport/compat/Makefile b/backport/compat/Makefile
index bbedd49c..e927a0c8 100644
--- a/backport/compat/Makefile
+++ b/backport/compat/Makefile
@@ -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
diff --git a/backport/compat/backport-4.11.c b/backport/compat/backport-4.11.c
new file mode 100644
index 00000000..83445856
--- /dev/null
+++ b/backport/compat/backport-4.11.c
@@ -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);
diff --git a/backport/compat/backport-5.11.c b/backport/compat/backport-5.11.c
new file mode 100644
index 00000000..e60f35cf
--- /dev/null
+++ b/backport/compat/backport-5.11.c
@@ -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);
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2021-10-19 21:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 21:42 [PATCH 00/47] backports: Update to kernel 5.15-rc6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 01/47] patches: Refresh on kernel 5.11.22 Hauke Mehrtens
2021-10-19 21:42 ` Hauke Mehrtens [this message]
2021-10-19 21:42 ` [PATCH 03/47] backports: Add empty implementation for skb_get_kcov_handle() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 04/47] backports: Add linux/math.h Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 05/47] backports: Add dev_sw_netstats_rx_add() and dev_sw_netstats_tx_add() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 06/47] headers: Add linux/kcov.h Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 07/47] patches: Do not use rx_list in mt76 on older kernel versions Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 08/47] dependencies: Build mt7915 only on kernel >= 4.6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 09/47] patches: Remove const from struct rchan_callbacks Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 10/47] patches: Refresh patches on top of kernel 5.12.19 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 11/47] patches: include linux/modules.h in mt76/mt76_connac_mcu.c Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 12/47] patches: Do not use rx_list in mt76/mt7921 driver on older kernel versions Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 13/47] patches: Do not use rx_list in mt7601u " Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 14/47] dependencies: Build mt7921 only on kernel >= 4.6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 15/47] dependencies: Build NL80211_TESTMODE only on kernel >= 4.18 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 16/47] headers: Add DECLARE_STATIC_KEY_FALSE Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 17/47] headers: Add ETH_P_MAP Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 18/47] patches: Refresh on top of kernel 5.13.19 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 19/47] headers: Add tasklet_disable_in_atomic() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 20/47] headers: Add lockdep_assert_not_held() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 21/47] headers: Adapt signature of of_get_mac_address() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 22/47] headers: Add rfkill_set_hw_state_reason() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 23/47] patches: Remove usage of threaded NAPI from mt76 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 24/47] headers: Adapt signature of thermal_zone_device_update() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 25/47] headers: Add time_after32() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 26/47] patches: Refresh on top of kernel 5.14.13 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 27/47] headers: Add FW_ACTION_NOUEVENT and FW_ACTION_UEVENT Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 28/47] headers: Add linux/wwan.h file Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 29/47] headers: Add DEVICE_ATTR_ADMIN_RW Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 30/47] headers: Add get_unaligned_be24 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 31/47] headers: Add rbtree cached Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 32/47] headers: Adapt signature of hrtimer_forward_now() Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 33/47] dependencies: Build RTL8723BS only on kernel >= 5.4 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 34/47] backports: Remove rtl8188eu driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 35/47] backports: Remove prism54 driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 36/47] patches: Refresh on top of kernel 5.15-rc6 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 37/47] backports: Remove old CISCO airo driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 38/47] backports: Remove intersil hostap driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 39/47] patches: Adapt signature of bus_type->remove callback Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 40/47] patches: Adapt signature of ethtool_ops->set_coalesce callback Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 41/47] patches: Do not set mhi_controller->reg_len on older kernel versions Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 42/47] backports: Update wifi defconfig Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 43/47] backports: Add new r8188eu driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 44/47] headers: Add new include/linux/bits.h Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 45/47] headers: Add function devm_clk_get_optional() Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 46/47] patches: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 47/47] headers: Check for NULL in dev_put() and dev_hold() Hauke Mehrtens
2021-10-20 12:22 ` [PATCH 00/47] backports: Update to kernel 5.15-rc6 Janusz Dziedzic
2021-10-20 18:27   ` Hauke Mehrtens
2021-10-20 20:09     ` Robert Marko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019214320.2035704-3-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).