aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2012-12-27 18:49:37 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-28 18:24:18 -0500
commit4bf84c35c65f36a344fb7a6cde6274df4120efb8 (patch)
tree09f7e45f4db6dc8fefd2910286aa3b0fcc5d50c2 /net
parentb5a05550b76fe5b934b6f3b7f4b36ae9513745f6 (diff)
net: add change_carrier netdev op
This allows a driver to register change_carrier callback which will be called whenever user will like to change carrier state. This is useful for devices like dummy, gre, team and so on. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 515473ee52cb..21c5b976dcf3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5027,6 +5027,25 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
5027} 5027}
5028EXPORT_SYMBOL(dev_set_mac_address); 5028EXPORT_SYMBOL(dev_set_mac_address);
5029 5029
5030/**
5031 * dev_change_carrier - Change device carrier
5032 * @dev: device
5033 * @new_carries: new value
5034 *
5035 * Change device carrier
5036 */
5037int dev_change_carrier(struct net_device *dev, bool new_carrier)
5038{
5039 const struct net_device_ops *ops = dev->netdev_ops;
5040
5041 if (!ops->ndo_change_carrier)
5042 return -EOPNOTSUPP;
5043 if (!netif_device_present(dev))
5044 return -ENODEV;
5045 return ops->ndo_change_carrier(dev, new_carrier);
5046}
5047EXPORT_SYMBOL(dev_change_carrier);
5048
5030/* 5049/*
5031 * Perform the SIOCxIFxxx calls, inside rcu_read_lock() 5050 * Perform the SIOCxIFxxx calls, inside rcu_read_lock()
5032 */ 5051 */