patches for DPDK stable branches
 help / color / 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

* Re: [dpdk-stable] [PATCH 18.11] kni: fix ethtool build for kernel 5.5
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2020-03-18 23:04 UTC (permalink / raw)
  To: stable; +Cc: ferruh.yigit

On 13/03/2020 16:00, Kevin Traynor wrote:
> 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) \
>  }
> 

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com> (over irc)

Applied, thanks.


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

end of thread, back to index

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

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox