kni: fix build for igb_ndo_bridge_setlink in Linux 5.0

Build error seen with Linux kernel 5.0 and
when CONFIG_RTE_KNI_KMOD_ETHTOOL is enabled.

build error:
.../build/build/kernel/linux/kni/igb_main.c:2348:24:
  error: initialization of
  ‘int (*)(struct net_device *, struct nlmsghdr *, u16,
  	struct netlink_ext_ack *)’
  {aka ‘int (*)(struct net_device *, struct nlmsghdr *,
  	short unsigned int,  struct netlink_ext_ack *)’}
  from incompatible pointer type
  ‘int (*)(struct net_device *, struct nlmsghdr *, u16)’
  {aka ‘int (*)(struct net_device *, struct nlmsghdr *,
  	short unsigned int)’}
  [-Werror=incompatible-pointer-types]
  .ndo_bridge_setlink = igb_ndo_bridge_setlink,
                        ^~~~~~~~~~~~~~~~~~~~~~
.../build/build/kernel/linux/kni/igb_main.c:2348:24:
  note: (near initialization for ‘igb_netdev_ops.ndo_bridge_setlink’)

igb_ndo_bridge_setlink() is changed in Linux kernel version 5.0
and now requires a new parameter, 'struct netlink_ext_ack *extack'.
Fixed by adding a new parameter with a kernel version check.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ferruh Yigit 2019-01-22 15:44:29 +00:00 committed by Thomas Monjalon
parent d01c18ff82
commit 18cb8293e3
2 changed files with 6 additions and 0 deletions

View file

@ -2207,7 +2207,12 @@ static int igb_ndo_fdb_dump(struct sk_buff *skb,
#ifdef HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
static int igb_ndo_bridge_setlink(struct net_device *dev,
struct nlmsghdr *nlh,
#ifdef HAVE_NDO_BRIDGE_SETLINK_EXTACK
u16 flags, struct netlink_ext_ack *extack)
#else
u16 flags)
#endif
#else
static int igb_ndo_bridge_setlink(struct net_device *dev,
struct nlmsghdr *nlh)

View file

@ -3942,6 +3942,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) )
#define dev_open(x) dev_open(x, NULL)
#define HAVE_NDO_BRIDGE_SETLINK_EXTACK
#endif /* >= 5.0.0 */
#if defined(timer_setup) && defined(from_timer)