summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorAndy Roulin <aroulin@cumulusnetworks.com>2019-02-22 18:06:36 +0000
committerDavid S. Miller <davem@davemloft.net>2019-02-24 13:01:04 -0800
commitb58996795dc4921123ada213f9f10b8317d3f34f (patch)
tree92d774fa39380da66ce4d88f93ec9dfb36c361ff /net/core
parent45c0e7b25ab21b8217ae63d1d31850a40e415f57 (diff)
downloadlinux-b58996795dc4921123ada213f9f10b8317d3f34f.tar.bz2
net: dev: add generic protodown handler
Introduce dev_change_proto_down_generic, a generic ndo_change_proto_down implementation, which sets the netdev carrier state according to proto_down. This adds the ability to set protodown on vxlan and macvlan devices in a generic way for use by control protocols like VRRPD. Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-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 8a0da95ff4cc..2b67f2aa59dd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7954,6 +7954,25 @@ int dev_change_proto_down(struct net_device *dev, bool proto_down)
}
EXPORT_SYMBOL(dev_change_proto_down);
+/**
+ * dev_change_proto_down_generic - generic implementation for
+ * ndo_change_proto_down that sets carrier according to
+ * proto_down.
+ *
+ * @dev: device
+ * @proto_down: new value
+ */
+int dev_change_proto_down_generic(struct net_device *dev, bool proto_down)
+{
+ if (proto_down)
+ netif_carrier_off(dev);
+ else
+ netif_carrier_on(dev);
+ dev->proto_down = proto_down;
+ return 0;
+}
+EXPORT_SYMBOL(dev_change_proto_down_generic);
+
u32 __dev_xdp_query(struct net_device *dev, bpf_op_t bpf_op,
enum bpf_netdev_command cmd)
{