From: anuradhak@cumulusnetworks.com
To: davem@davemloft.net, sfeldma@gmail.com
Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com,
gospo@cumulusnetworks.com, wkok@cumulusnetworks.com,
anuradhak@cumulusnetworks.com
Subject: [PATCH net-next v5 3/4] rocker: Handle protodown notifications.
Date: Thu, 9 Jul 2015 15:35:29 -0700 [thread overview]
Message-ID: <1436481330-4599-4-git-send-email-anuradhak@cumulusnetworks.com> (raw)
From: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
protodown can be set by user space applications like MLAG on detecting
errors on a switch port. This patch provides sample switch driver changes
for handling protodown. Rocker PHYS disables the port in response to
protodown.
To test this unctionality I used the qemu-rocker patch that Scott sent out
in response to the v3 posting (needed to set link up/down when phy is
nabled/disabled).
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>
---
drivers/net/ethernet/rocker/rocker.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index 2d8578cade..10051fa 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -3983,7 +3983,8 @@ static int rocker_port_open(struct net_device *dev)
napi_enable(&rocker_port->napi_tx);
napi_enable(&rocker_port->napi_rx);
- rocker_port_set_enable(rocker_port, true);
+ if (!(dev->proto_flags & IF_PROTOF_DOWN))
+ rocker_port_set_enable(rocker_port, true);
netif_start_queue(dev);
return 0;
@@ -4167,6 +4168,21 @@ static int rocker_port_get_phys_port_name(struct net_device *dev,
return err ? -EOPNOTSUPP : 0;
}
+static int rocker_port_change_proto_flags(struct net_device *dev,
+ unsigned int flags)
+{
+ struct rocker_port *rocker_port = netdev_priv(dev);
+
+ if (rocker_port->dev->flags & IFF_UP) {
+ if (flags & IF_PROTOF_DOWN)
+ rocker_port_set_enable(rocker_port, false);
+ else
+ rocker_port_set_enable(rocker_port, true);
+ }
+ rocker_port->dev->proto_flags = flags;
+ return 0;
+}
+
static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_open = rocker_port_open,
.ndo_stop = rocker_port_stop,
@@ -4179,6 +4195,7 @@ static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_fdb_del = switchdev_port_fdb_del,
.ndo_fdb_dump = switchdev_port_fdb_dump,
.ndo_get_phys_port_name = rocker_port_get_phys_port_name,
+ .ndo_change_proto_flags = rocker_port_change_proto_flags,
};
/********************
--
1.7.10.4
reply other threads:[~2015-07-09 22:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436481330-4599-4-git-send-email-anuradhak@cumulusnetworks.com \
--to=anuradhak@cumulusnetworks.com \
--cc=davem@davemloft.net \
--cc=gospo@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=sfeldma@gmail.com \
--cc=wkok@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).