net: core: dev: Add call_netdevice_notifiers_extack()
authorPetr Machata <petrm@mellanox.com>
Thu, 6 Dec 2018 17:05:45 +0000 (17:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Dec 2018 21:26:07 +0000 (13:26 -0800)
In order to propagate extack through NETDEV_PRE_UP, add a new function
call_netdevice_notifiers_extack() that primes the extack field of the
notifier info. Convert call_netdevice_notifiers() to a simple wrapper
around the new function that passes NULL for extack.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index b37e320def1311e5815cdde3b7d9a67f28fe7b1c..4b033af8e6cdbd34022b5d41d168d3af48c2e915 100644 (file)
@@ -162,6 +162,9 @@ static struct list_head offload_base __read_mostly;
 static int netif_rx_internal(struct sk_buff *skb);
 static int call_netdevice_notifiers_info(unsigned long val,
                                         struct netdev_notifier_info *info);
+static int call_netdevice_notifiers_extack(unsigned long val,
+                                          struct net_device *dev,
+                                          struct netlink_ext_ack *extack);
 static struct napi_struct *napi_by_id(unsigned int napi_id);
 
 /*
@@ -1734,6 +1737,18 @@ static int call_netdevice_notifiers_info(unsigned long val,
        return raw_notifier_call_chain(&netdev_chain, val, info);
 }
 
+static int call_netdevice_notifiers_extack(unsigned long val,
+                                          struct net_device *dev,
+                                          struct netlink_ext_ack *extack)
+{
+       struct netdev_notifier_info info = {
+               .dev = dev,
+               .extack = extack,
+       };
+
+       return call_netdevice_notifiers_info(val, &info);
+}
+
 /**
  *     call_netdevice_notifiers - call all network notifier blocks
  *      @val: value passed unmodified to notifier function
@@ -1745,11 +1760,7 @@ static int call_netdevice_notifiers_info(unsigned long val,
 
 int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
 {
-       struct netdev_notifier_info info = {
-               .dev = dev,
-       };
-
-       return call_netdevice_notifiers_info(val, &info);
+       return call_netdevice_notifiers_extack(val, dev, NULL);
 }
 EXPORT_SYMBOL(call_netdevice_notifiers);