[openwrt/openwrt] ramips: 6.6: fix net drivers compatibility
LEDE Commits
lede-commits at lists.infradead.org
Thu Apr 4 22:58:45 PDT 2024
nick pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7753b143cde79a048cdda003b9e2825f50399b2c
commit 7753b143cde79a048cdda003b9e2825f50399b2c
Author: Mieczyslaw Nalewaj <namiltd at yahoo.com>
AuthorDate: Wed Mar 13 02:24:11 2024 +0100
ramips: 6.6: fix net drivers compatibility
Fix compatibility of ralink net drivers with kernel 6.6.
It follows the kernel patch: u64_stats: Streamline the implementation (https://github.com/torvalds/linux/commit/44b0c2957adc62b86fcd51adeaf8e993171b)
Signed-off-by: Mieczyslaw Nalewaj <namiltd at yahoo.com>
---
target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c | 8 ++++++++
.../linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
index 9b028fbbc9..ca3b6fb302 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
@@ -199,12 +199,20 @@ static void fe_get_ethtool_stats(struct net_device *dev,
do {
data_src = &hwstats->tx_bytes;
data_dst = data;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
+ start = u64_stats_fetch_begin(&hwstats->syncp);
+#else
start = u64_stats_fetch_begin_irq(&hwstats->syncp);
+#endif
for (i = 0; i < ARRAY_SIZE(fe_gdma_str); i++)
*data_dst++ = *data_src++;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
+ } while (u64_stats_fetch_retry(&hwstats->syncp, start));
+#else
} while (u64_stats_fetch_retry_irq(&hwstats->syncp, start));
+#endif
}
static struct ethtool_ops fe_ethtool_ops = {
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
index 3748264dad..4365e398d3 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
@@ -487,7 +487,11 @@ static void fe_get_stats64(struct net_device *dev,
}
do {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
+ start = u64_stats_fetch_begin(&hwstats->syncp);
+#else
start = u64_stats_fetch_begin_irq(&hwstats->syncp);
+#endif
storage->rx_packets = hwstats->rx_packets;
storage->tx_packets = hwstats->tx_packets;
storage->rx_bytes = hwstats->rx_bytes;
@@ -499,7 +503,11 @@ static void fe_get_stats64(struct net_device *dev,
storage->rx_crc_errors = hwstats->rx_fcs_errors;
storage->rx_errors = hwstats->rx_checksum_errors;
storage->tx_aborted_errors = hwstats->tx_skip;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
+ } while (u64_stats_fetch_retry(&hwstats->syncp, start));
+#else
} while (u64_stats_fetch_retry_irq(&hwstats->syncp, start));
+#endif
storage->tx_errors = priv->netdev->stats.tx_errors;
storage->rx_dropped = priv->netdev->stats.rx_dropped;
More information about the lede-commits
mailing list