[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1530685786-26449-1-git-send-email-liuhangbin@gmail.com>
Date: Wed, 4 Jul 2018 14:29:46 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: netdev@...r.kernel.org
Cc: David Miller <davem@...emloft.net>,
Stefano Brivio <sbrivio@...hat.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCH net] net: mv __dev_notify_flags from void to int
As call_netdevice_notifiers() and call_netdevice_notifiers_info() have return
values, we should also return the values in function __dev_notify_flags().
Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
---
include/linux/netdevice.h | 2 +-
net/core/dev.c | 30 ++++++++++++++++++++----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3d0cc0b..b1c145e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3411,7 +3411,7 @@ int dev_ethtool(struct net *net, struct ifreq *);
unsigned int dev_get_flags(const struct net_device *);
int __dev_change_flags(struct net_device *, unsigned int flags);
int dev_change_flags(struct net_device *, unsigned int);
-void __dev_notify_flags(struct net_device *, unsigned int old_flags,
+int __dev_notify_flags(struct net_device *, unsigned int old_flags,
unsigned int gchanges);
int dev_change_name(struct net_device *, const char *);
int dev_set_alias(struct net_device *, const char *, size_t);
diff --git a/net/core/dev.c b/net/core/dev.c
index a5aa1c7..0994533 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6798,8 +6798,10 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc, bool notify)
dev_change_rx_flags(dev, IFF_PROMISC);
}
+
if (notify)
- __dev_notify_flags(dev, old_flags, IFF_PROMISC);
+ return __dev_notify_flags(dev, old_flags, IFF_PROMISC);
+
return 0;
}
@@ -6854,8 +6856,8 @@ static int __dev_set_allmulti(struct net_device *dev, int inc, bool notify)
dev_change_rx_flags(dev, IFF_ALLMULTI);
dev_set_rx_mode(dev);
if (notify)
- __dev_notify_flags(dev, old_flags,
- dev->gflags ^ old_gflags);
+ return __dev_notify_flags(dev, old_flags,
+ dev->gflags ^ old_gflags);
}
return 0;
}
@@ -7016,21 +7018,26 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags)
return ret;
}
-void __dev_notify_flags(struct net_device *dev, unsigned int old_flags,
- unsigned int gchanges)
+int __dev_notify_flags(struct net_device *dev, unsigned int old_flags,
+ unsigned int gchanges)
{
unsigned int changes = dev->flags ^ old_flags;
+ int err = 0;
if (gchanges)
rtmsg_ifinfo(RTM_NEWLINK, dev, gchanges, GFP_ATOMIC);
if (changes & IFF_UP) {
if (dev->flags & IFF_UP)
- call_netdevice_notifiers(NETDEV_UP, dev);
+ err = call_netdevice_notifiers(NETDEV_UP, dev);
else
- call_netdevice_notifiers(NETDEV_DOWN, dev);
+ err = call_netdevice_notifiers(NETDEV_DOWN, dev);
}
+ err = notifier_to_errno(err);
+ if (err)
+ goto out;
+
if (dev->flags & IFF_UP &&
(changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE))) {
struct netdev_notifier_change_info change_info = {
@@ -7040,8 +7047,12 @@ void __dev_notify_flags(struct net_device *dev, unsigned int old_flags,
.flags_changed = changes,
};
- call_netdevice_notifiers_info(NETDEV_CHANGE, &change_info.info);
+ err = call_netdevice_notifiers_info(NETDEV_CHANGE, &change_info.info);
+ err = notifier_to_errno(err);
}
+
+out:
+ return err;
}
/**
@@ -7062,8 +7073,7 @@ int dev_change_flags(struct net_device *dev, unsigned int flags)
return ret;
changes = (old_flags ^ dev->flags) | (old_gflags ^ dev->gflags);
- __dev_notify_flags(dev, old_flags, changes);
- return ret;
+ return __dev_notify_flags(dev, old_flags, changes);
}
EXPORT_SYMBOL(dev_change_flags);
--
2.5.5
Powered by blists - more mailing lists