Skip to contentSkip to conversation

kni: fix build for 5.0 for dev_open()

PATCH In review Ferruh Yigit 2 participants 5 messages Jan 22, 2019 – Jan 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kni: fix build for 5.0 for dev_open()

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

build error:
.../build/build/kernel/linux/kni/ixgbe_ethtool.c:1746:4:
error: too few arguments to function ‘dev_open’

    dev_open(netdev);
    ^~~~~~~~
In file included from .../build/kernel/linux/kni/ixgbe_ethtool.c:18:
.../linux/linux/include/linux/netdevice.h:2620:5: note: declared here
 int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
     ^~~~~~~~

.../build/build/kernel/linux/kni/igb_ethtool.c:1812:4:
error: too few arguments to function ‘dev_open’

    dev_open(netdev);
    ^~~~~~~~
In file included from .../build/build/kernel/linux/kni/igb_ethtool.c:15:
.../linux/linux/include/linux/netdevice.h:2620:5: note: declared here
 int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
     ^~~~~~~~

dev_open() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by defining dev_open as macro when kernel version >= 5.0

---
 kernel/linux/kni/ethtool/igb/kcompat.h   | 4 ++++
 kernel/linux/kni/ethtool/ixgbe/kcompat.h | 4 ++++
 2 files changed, 8 insertions(+)
kernel/linux/kni/ethtool/igb/kcompat.h +4 -0
index 430aabafe..068cfeb52 100644
@@ -3940,6 +3940,10 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define HAVE_PCI_ENABLE_MSIX
 #endif
 
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) )
+#define dev_open(x) dev_open(x, NULL)
+#endif /* >= 5.0.0 */
+
 #if defined(timer_setup) && defined(from_timer)
 #define HAVE_TIMER_SETUP
 #endif
kernel/linux/kni/ethtool/ixgbe/kcompat.h +4 -0
index 7c7d6c317..419fd1f13 100644
@@ -3125,6 +3125,10 @@ static inline int __kc_pci_vfs_assigned(struct pci_dev *dev)
 #define SET_ETHTOOL_OPS(netdev, ops) ((netdev)->ethtool_ops = (ops))
 #endif /* >= 3.16.0 */
 
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) )
+#define dev_open(x) dev_open(x, NULL)
+#endif /* >= 5.0.0 */
+
 /*
  * vlan_tx_tag_* macros renamed to skb_vlan_tag_* (Linux commit: df8a39defad4)
  * For older kernels backported this commit, need to use renamed functions.
Signature · 1 line
2.17.2
#1 lore raw

PATCH 2/2 kni: fix build for 5.0 for igb_ndo_bridge_setlink()

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.

---
 kernel/linux/kni/ethtool/igb/igb_main.c | 5 +++++
 kernel/linux/kni/ethtool/igb/kcompat.h  | 1 +
 2 files changed, 6 insertions(+)
kernel/linux/kni/ethtool/igb/igb_main.c +5 -0
index af378d2f2..0b4faeae5 100644
@@ -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)
kernel/linux/kni/ethtool/igb/kcompat.h +1 -0
index 068cfeb52..11b15f3a9 100644
@@ -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)
Signature · 1 line
2.17.2
#2 lore raw
In reply to Ferruh Yigit
Quoted 22 lines · Ferruh Yigit

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

build error:
.../build/build/kernel/linux/kni/ixgbe_ethtool.c:1746:4:
error: too few arguments to function ‘dev_open’

    dev_open(netdev);
    ^~~~~~~~
In file included from .../build/kernel/linux/kni/ixgbe_ethtool.c:18:
.../linux/linux/include/linux/netdevice.h:2620:5: note: declared here
 int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
     ^~~~~~~~

.../build/build/kernel/linux/kni/igb_ethtool.c:1812:4:
error: too few arguments to function ‘dev_open’

    dev_open(netdev);
    ^~~~~~~~
In file included from .../build/build/kernel/linux/kni/igb_ethtool.c:15:
.../linux/linux/include/linux/netdevice.h:2620:5: note: declared here
 int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
     ^~~~~~~~
Quoted 5 lines

dev_open() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by defining dev_open as macro when kernel version >= 5.0

Off the topic.

This is the patch 50000 in patchwork! This is a big number. Thanks everyone contributed!

https://patches.dpdk.org/patch/50000/

The historical numbers from DPDK patchwork:
50000 - Jan. 22, 2019 (253 days) [ 8 months, 8 days / 36 weeks and 1 day ] 40000 - May. 14, 2018 (217 days)
30000 - Oct. 9, 2017 (258 days)
20000 - Jan. 25, 2017 (372 days)
10000 - Jan. 20, 2016 (645 days)
00001 - April 16, 2014

This is the first time DPDK patch pace slowed down (slightly), I guess this is because of the holidays in the middle and small 19.02, but I think next milestone which includes 19.05 will clarify this.

#3 lore raw
In reply to Ferruh Yigit

22/01/2019 16:44, Ferruh Yigit:

Quoted 5 lines

dev_open() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by defining dev_open as macro when kernel version >= 5.0

Series applied, thanks
and congratulations for the patch 50000.
I suspect you were waiting for posting it at the right time :)

#4 lore raw
Quoted 10 lines · Thomas Monjalon

22/01/2019 16:44, Ferruh Yigit:

Quoted 5 lines

dev_open() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by defining dev_open as macro when kernel version >= 5.0

Series applied, thanks
and congratulations for the patch 50000.
I suspect you were waiting for posting it at the right time :)

just coincidence ;)