* The net parameter of newlink and the head parameter of dellink were introduced introduced in v2.6.33 * The head parameter of dellink cannot be used if its not present
Fixes: e23775f20e1a ("datapath: Add support for lwtunnel") Signed-off-by: Simon Horman <simon.hor...@netronome.com> --- .travis.yml | 3 +++ datapath/linux/compat/dev-openvswitch.c | 2 +- datapath/linux/compat/geneve.c | 22 ++++++++++++++-------- datapath/linux/compat/ip_gre.c | 4 ++-- datapath/linux/compat/lisp.c | 14 ++++++++++---- datapath/linux/compat/vxlan.c | 23 ++++++++++++++++------- 6 files changed, 46 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea1d7e7ebea4..90df67454a22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,9 @@ env: - KERNEL=3.10.92 - KERNEL=3.4.110 - KERNEL=3.2.72 + - KERNEL=2.6.38.8 + - KERNEL=2.6.37.6 + - KERNEL=2.6.33.20 - KERNEL=2.6.32.68 script: ./.travis/build.sh $OPTS diff --git a/datapath/linux/compat/dev-openvswitch.c b/datapath/linux/compat/dev-openvswitch.c index d7d4224a1cb3..5fe356a1cefd 100644 --- a/datapath/linux/compat/dev-openvswitch.c +++ b/datapath/linux/compat/dev-openvswitch.c @@ -103,7 +103,7 @@ int rpl_rtnl_delete_link(struct net_device *dev) if (!ops || !ops->dellink) return -EOPNOTSUPP; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) ops->dellink(dev); #else { diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c index 297593ce6e1a..38e8abbc0c36 100644 --- a/datapath/linux/compat/geneve.c +++ b/datapath/linux/compat/geneve.c @@ -909,15 +909,15 @@ static int geneve_configure(struct net *net, struct net_device *dev, return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -static int geneve_newlink(struct net_device *dev, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +static int geneve_newlink(struct net *net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { - struct net *net = &init_net; #else -static int geneve_newlink(struct net *net, struct net_device *dev, +static int geneve_newlink(struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { + struct net *net = &init_net; #endif __be16 dst_port = htons(GENEVE_UDP_PORT); __u8 ttl = 0, tos = 0; @@ -947,17 +947,23 @@ static int geneve_newlink(struct net *net, struct net_device *dev, ttl, tos, dst_port, metadata); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -static void geneve_dellink(struct net_device *dev) -#else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static void geneve_dellink(struct net_device *dev, struct list_head *head) -#endif { struct geneve_dev *geneve = netdev_priv(dev); list_del(&geneve->next); unregister_netdevice_queue(dev, head); } +#else +static void geneve_dellink(struct net_device *dev) +{ + struct geneve_dev *geneve = netdev_priv(dev); + + list_del(&geneve->next); + unregister_netdevice(dev); +} +#endif static size_t geneve_get_size(const struct net_device *dev) { diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index c9197e9652fd..3abcf4149d92 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -482,7 +482,7 @@ static void ipgre_tap_setup(struct net_device *dev) ip_tunnel_setup(dev, gre_tap_net_id); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) #else @@ -606,7 +606,7 @@ struct net_device *rpl_gretap_fb_dev_create(struct net *net, const char *name, t = netdev_priv(dev); t->collect_md = true; /* Configure flow based GRE device. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) err = ipgre_newlink(net, dev, tb, NULL); #else err = ipgre_newlink(dev, tb, NULL); diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c index e5a6a7fe00a4..6e8231691db1 100644 --- a/datapath/linux/compat/lisp.c +++ b/datapath/linux/compat/lisp.c @@ -557,7 +557,7 @@ static int lisp_configure(struct net *net, struct net_device *dev, return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int lisp_newlink(struct net *net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { @@ -576,17 +576,23 @@ static int lisp_newlink(struct net_device *dev, return lisp_configure(net, dev, dst_port); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static void lisp_dellink(struct net_device *dev, struct list_head *head) +{ + struct lisp_dev *lisp = netdev_priv(dev); + + list_del(&lisp->next); + unregister_netdevice_queue(dev, head); +} #else static void lisp_dellink(struct net_device *dev) -#endif { struct lisp_dev *lisp = netdev_priv(dev); list_del(&lisp->next); - unregister_netdevice_queue(dev, head); + unregister_netdevice(dev); } +#endif static size_t lisp_get_size(const struct net_device *dev) { diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index dd0015d01c32..c40c914d3e8f 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -2006,7 +2006,7 @@ struct net_device *rpl_vxlan_dev_create(struct net *net, const char *name, } EXPORT_SYMBOL_GPL(rpl_vxlan_dev_create); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int vxlan_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) #else @@ -2017,11 +2017,7 @@ static int vxlan_newlink(struct net_device *dev, return -EINVAL; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) -static void vxlan_dellink(struct net_device *dev, struct list_head *head) -#else -static void vxlan_dellink(struct net_device *dev) -#endif +static void vxlan_dellink__(struct net_device *dev) { struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); @@ -2032,8 +2028,21 @@ static void vxlan_dellink(struct net_device *dev) spin_unlock(&vn->sock_lock); list_del(&vxlan->next); +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +static void vxlan_dellink(struct net_device *dev, struct list_head *head) +{ + vxlan_dellink__(dev); unregister_netdevice_queue(dev, head); } +#else +static void vxlan_dellink(struct net_device *dev) +{ + vxlan_dellink__(dev); + unregister_netdevice(dev); +} +#endif static size_t vxlan_get_size(const struct net_device *dev) { @@ -2116,7 +2125,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, * is 0 here, so no matches. */ if (dst->remote_ifindex == dev->ifindex) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) vxlan_dellink(vxlan->dev, &list_kill); #else vxlan_dellink(vxlan->dev); -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev