From: Petr Machata <pe...@mellanox.com> Upstream commit: commit 567c5e13be5cc74d24f5eb54cf353c2e2277189b Author: Petr Machata <pe...@mellanox.com> Date: Thu Dec 6 17:05:42 2018 +0000
net: core: dev: Add extack argument to dev_change_flags() In order to pass extack together with NETDEV_PRE_UP notifications, it's necessary to route the extack to __dev_open() from diverse (possibly indirect) callers. One prominent API through which the notification is invoked is dev_change_flags(). Therefore extend dev_change_flags() with and extra extack argument and update all users. Most of the calls end up just encoding NULL, but several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available. Since the function declaration line is changed anyway, name the other function arguments to placate checkpatch. Signed-off-by: Petr Machata <pe...@mellanox.com> Acked-by: Jiri Pirko <j...@mellanox.com> Reviewed-by: Ido Schimmel <ido...@mellanox.com> Reviewed-by: David Ahern <dsah...@gmail.com> Signed-off-by: David S. Miller <da...@davemloft.net> This patch backports the above upstream patch and also adds fixes in compat code. Cc: Petr Machata <pe...@mellanox.com> Acked-by: Yi-Hung Wei <yihung....@gmail.com> Signed-off-by: Yifeng Sun <pkusunyif...@gmail.com> --- acinclude.m4 | 3 +++ datapath/linux/compat/include/linux/netdevice.h | 10 ++++++++++ datapath/linux/compat/ip6_gre.c | 4 ++-- datapath/linux/compat/ip_gre.c | 4 ++-- datapath/vport-geneve.c | 2 +- datapath/vport-gre.c | 2 +- datapath/vport-lisp.c | 2 +- datapath/vport-stt.c | 2 +- datapath/vport-vxlan.c | 2 +- 9 files changed, 22 insertions(+), 9 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index eb978e0fae6c..93fbf0ebb84c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -617,6 +617,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [max_mtu]) OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops_extended], [ndo_change_mtu], [OVS_DEFINE([HAVE_RHEL7_MAX_MTU])]) + OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], + [dev_change_flags], [extack], + [OVS_DEFINE([HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK])]) OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state]) OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state], diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index cf68ed5238d4..126ff23cfa27 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -323,4 +323,14 @@ static inline void netif_keep_dst(struct net_device *dev) } #endif +#ifndef HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK +static inline int rpl_dev_change_flags(struct net_device *dev, + unsigned int flags, + struct netlink_ext_ack *extack) +{ + return dev_change_flags(dev, flags); +} +#define dev_change_flags rpl_dev_change_flags +#endif + #endif /* __LINUX_NETDEVICE_WRAPPER_H */ diff --git a/datapath/linux/compat/ip6_gre.c b/datapath/linux/compat/ip6_gre.c index 2ffdda5e1dc3..ca4e66133570 100644 --- a/datapath/linux/compat/ip6_gre.c +++ b/datapath/linux/compat/ip6_gre.c @@ -2647,7 +2647,7 @@ static struct vport *erspan6_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); @@ -2748,7 +2748,7 @@ static struct vport *ip6gre_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 89ef45556dce..cf8803b53075 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -1500,7 +1500,7 @@ static struct vport *erspan_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); @@ -1554,7 +1554,7 @@ static struct vport *ipgre_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/vport-geneve.c b/datapath/vport-geneve.c index 14a54f1997a9..a5b91246f8dd 100644 --- a/datapath/vport-geneve.c +++ b/datapath/vport-geneve.c @@ -93,7 +93,7 @@ static struct vport *geneve_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 1d63734f4141..07a8c19df96e 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -68,7 +68,7 @@ static struct vport *gre_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c index 27f40ab4272f..5e2bcda88ac8 100644 --- a/datapath/vport-lisp.c +++ b/datapath/vport-lisp.c @@ -92,7 +92,7 @@ static struct vport *lisp_tnl_create(const struct vport_parms *parms) ovs_vport_free(vport); return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/vport-stt.c b/datapath/vport-stt.c index 31fa46245503..35c4942c5f51 100644 --- a/datapath/vport-stt.c +++ b/datapath/vport-stt.c @@ -95,7 +95,7 @@ static struct vport *stt_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index c7139abc8919..05764467a687 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -162,7 +162,7 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms) return ERR_CAST(dev); } - err = dev_change_flags(dev, dev->flags | IFF_UP); + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); if (err < 0) { rtnl_delete_link(dev); rtnl_unlock(); -- 2.7.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev