patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11] kni: fix ethtool build for kernel 5.5
@ 2020-03-13 16:00 Kevin Traynor
  2020-03-18 23:04 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Traynor @ 2020-03-13 16:00 UTC (permalink / raw)
  To: stable; +Cc: ferruh.yigit, Kevin Traynor

FIELD_SIZEOF() was removed in kernel 5.5 in commit
1f07dcc459d5 ("kernel.h: Remove unused FIELD_SIZEOF()")

It's replacement, sizeof_field() is not a good replacement
for us as it was only introduced in 4.16.

Create RTE_SIZEOF_FIELD to enable build.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 kernel/linux/kni/ethtool/igb/igb_ethtool.c     | 6 ++++--
 kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
index a35f3da7d..7b406f1da 100644
--- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
+++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
@@ -40,7 +40,9 @@ struct igb_stats {
 };
 
+#define RTE_SIZEOF_FIELD(type, field) (sizeof(((type *)0)->field))
+
 #define IGB_STAT(_name, _stat) { \
 	.stat_string = _name, \
-	.sizeof_stat = FIELD_SIZEOF(struct igb_adapter, _stat), \
+	.sizeof_stat = RTE_SIZEOF_FIELD(struct igb_adapter, _stat), \
 	.stat_offset = offsetof(struct igb_adapter, _stat) \
 }
@@ -97,5 +99,5 @@ static const struct igb_stats igb_gstrings_stats[] = {
 #define IGB_NETDEV_STAT(_net_stat) { \
 	.stat_string = #_net_stat, \
-	.sizeof_stat = FIELD_SIZEOF(struct net_device_stats, _net_stat), \
+	.sizeof_stat = RTE_SIZEOF_FIELD(struct net_device_stats, _net_stat), \
 	.stat_offset = offsetof(struct net_device_stats, _net_stat) \
 }
diff --git a/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.c b/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.c
index a03a77ff2..34a423a63 100644
--- a/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -41,7 +41,9 @@ struct ixgbe_stats {
 };
 
+#define RTE_SIZEOF_FIELD(type, field) (sizeof(((type *)0)->field))
+
 #define IXGBE_NETDEV_STAT(_net_stat) { \
 	.stat_string = #_net_stat, \
-	.sizeof_stat = FIELD_SIZEOF(struct net_device_stats, _net_stat), \
+	.sizeof_stat = RTE_SIZEOF_FIELD(struct net_device_stats, _net_stat), \
 	.stat_offset = offsetof(struct net_device_stats, _net_stat) \
 }
@@ -70,5 +72,5 @@ static const struct ixgbe_stats ixgbe_gstrings_net_stats[] = {
 #define IXGBE_STAT(_name, _stat) { \
 	.stat_string = _name, \
-	.sizeof_stat = FIELD_SIZEOF(struct ixgbe_adapter, _stat), \
+	.sizeof_stat = RTE_SIZEOF_FIELD(struct ixgbe_adapter, _stat), \
 	.stat_offset = offsetof(struct ixgbe_adapter, _stat) \
 }
-- 
2.21.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-18 23:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 16:00 [dpdk-stable] [PATCH 18.11] kni: fix ethtool build for kernel 5.5 Kevin Traynor
2020-03-18 23:04 ` Kevin Traynor

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).