[dpdk-stable] [PATCH 18.11] kni: fix ethtool build for kernel 5.5
Kevin Traynor
ktraynor at redhat.com
Thu Mar 19 00:04:45 CET 2020
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 at 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 at intel.com> (over irc)
Applied, thanks.
More information about the stable
mailing list