error:initialization of 'int (*)(struct net_get_coalesce)' (以rhel8.6为例)

问题描述

error:initialization of 'int (*)(struct net_get_coalesce)'

解决方案

首先去Linux内核代码里查询造成冲突的接口。

对比内核中该接口和源码中该接口的异同,如图1所示。

图1 编译

当定义REDHAT8_6时,选择对hinic3_get_coalesce进行正确定义。

#if defined(HAVE_ETHTOOL_COALESCE_EXTACK) || defined(REDHAT8_6)
static int hinic3_get_coalesce(struct net_device *netdev,
			       struct ethtool_coalesce *coal,
			       struct kernel_ethtool_coalesce *kernel_coal,
			       struct netlink_ext_ack *extack)
#else
static int hinic3_get_coalesce(struct net_device *netdev,
			       struct ethtool_coalesce *coal)
#endif