From 240697408303e9b0b8e32797e75ce7713e55581e Mon Sep 17 00:00:00 2001
From: "Srivatsa S. Bhat (VMware)" <srivatsa@csail.mit.edu>
Date: Thu, 12 Jan 2023 15:26:04 -0800
Subject: [PATCH] linux-rt, ice: Fix build errors on kernel 6.0.y
Commit 4d213ee396a6 ("u64_stat: Remove the obsolete fetch_irq()
variants") in upstream PREEMPT_RT kernel deprecated
u64_stats_fetch_begin_irq() and u64_stats_fetch_retry_irq() and
converted all call-sites to use u64_stats_fetch_begin() and
u64_stats_fetch_retry() instead. Do the same in the ice driver.
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
---
src/ice_main.c | 11 ++++++++---
src/kcompat_std_defs.h | 6 ++++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/ice_main.c b/src/ice_main.c
index 6aaddd0..1221d57 100644
--- a/src/ice_main.c
+++ b/src/ice_main.c
@@ -7294,7 +7294,6 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
return err;
}
-#ifdef HAVE_NDO_FDB_ADD_VID
/**
* ice_fdb_del - delete an entry from the hardware database
* @ndm: the input from the stack
@@ -7303,6 +7302,12 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
* @addr: the MAC address entry being added
* @vid: VLAN ID
*/
+#ifdef HAVE_NDO_FDB_DEL_EXTACK
+static int
+ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
+ struct net_device *dev, const unsigned char *addr,
+ __always_unused u16 vid, struct netlink_ext_ack *extack)
+#elif defined(HAVE_NDO_FDB_ADD_VID)
static int
ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
struct net_device *dev, const unsigned char *addr,
@@ -8263,10 +8268,10 @@ ice_fetch_u64_stats_per_ring(struct ice_ring *ring, u64 *pkts, u64 *bytes)
if (!ring)
return;
do {
- start = u64_stats_fetch_begin_irq(&ring->syncp);
+ start = u64_stats_fetch_begin(&ring->syncp);
*pkts = ring->stats.pkts;
*bytes = ring->stats.bytes;
- } while (u64_stats_fetch_retry_irq(&ring->syncp, start));
+ } while (u64_stats_fetch_retry(&ring->syncp, start));
}
/**
diff --git a/src/kcompat_std_defs.h b/src/kcompat_std_defs.h
index 59356b8..be000af 100644
--- a/src/kcompat_std_defs.h
+++ b/src/kcompat_std_defs.h
@@ -288,4 +288,10 @@
#else /* >=5.18.0*/
#endif /* 5.18.0 */
+/*****************************************************************************/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0))
+#else /* >=5.19.0 */
+#define HAVE_NDO_FDB_DEL_EXTACK
+#endif /* 5.19.0 */
+
#endif /* _KCOMPAT_STD_DEFS_H_ */
--
2.25.1