summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2015-07-14 13:43:19 -0700
committerDavid S. Miller <davem@davemloft.net>2015-07-15 21:39:40 -0700
commitd746d707a8b1421a4ba46b497cb5d59e20161645 (patch)
tree12d68963f6b74053f2d86fe50baef6233791a67f /net/core/dev.c
parent07e6a97da1eba064bb35cfd5c121e90865393a60 (diff)
downloadop-kernel-dev-d746d707a8b1421a4ba46b497cb5d59e20161645.zip
op-kernel-dev-d746d707a8b1421a4ba46b497cb5d59e20161645.tar.gz
net core: Add protodown support.
This patch introduces the proto_down flag that can be used by user space applications to notify switch drivers that errors have been detected on the device. The switch driver can react to protodown notification by doing a phys down on the associated switch port. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 69445a3..8810b6b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6075,6 +6075,26 @@ int dev_get_phys_port_name(struct net_device *dev,
EXPORT_SYMBOL(dev_get_phys_port_name);
/**
+ * dev_change_proto_down - update protocol port state information
+ * @dev: device
+ * @proto_down: new value
+ *
+ * This info can be used by switch drivers to set the phys state of the
+ * port.
+ */
+int dev_change_proto_down(struct net_device *dev, bool proto_down)
+{
+ const struct net_device_ops *ops = dev->netdev_ops;
+
+ if (!ops->ndo_change_proto_down)
+ return -EOPNOTSUPP;
+ if (!netif_device_present(dev))
+ return -ENODEV;
+ return ops->ndo_change_proto_down(dev, proto_down);
+}
+EXPORT_SYMBOL(dev_change_proto_down);
+
+/**
* dev_new_index - allocate an ifindex
* @net: the applicable net namespace
*
OpenPOWER on IntegriCloud