From: Ganesh Goudar <ganeshgr@chelsio.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: leedom@chelsio.com, nirranjan@chelsio.com, indranil@chelsio.com,
venkatesh@chelsio.com, Arjun Vynipadath <arjun@chelsio.com>,
Ganesh Goudar <ganeshgr@chelsio.com>
Subject: [PATCH net-next] cxgb4vf: Forcefully link up virtual interfaces
Date: Fri, 23 Feb 2018 20:36:53 +0530 [thread overview]
Message-ID: <1519398413-10461-1-git-send-email-ganeshgr@chelsio.com> (raw)
From: Arjun Vynipadath <arjun@chelsio.com>
The Virtual Interfaces are connected to an internal switch on the chip
which allows VIs attached to the same port to talk to each other even
when the port link is down. As a result, we generally want to always
report a VI's link as being "up".
Based on the original work by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
.../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 26 ++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index b7e79e6..7fe8763 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -92,6 +92,18 @@ module_param(msi, int, 0644);
MODULE_PARM_DESC(msi, "whether to use MSI-X or MSI");
/*
+ * Logic controls.
+ * ===============
+ */
+
+/* The Virtual Interfaces are connected to an internal switch on the chip
+ * which allows VIs attached to the same port to talk to each other even when
+ * the port link is down. As a result, we generally want to always report a
+ * VI's link as being "up".
+ */
+#define force_link_up 1
+
+/*
* Fundamental constants.
* ======================
*/
@@ -155,7 +167,8 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
const char *fc;
const struct port_info *pi = netdev_priv(dev);
- netif_carrier_on(dev);
+ if (!force_link_up)
+ netif_carrier_on(dev);
switch (pi->link_cfg.speed) {
case 100:
@@ -202,7 +215,9 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
netdev_info(dev, "link up, %s, full-duplex, %s PAUSE\n", s, fc);
} else {
- netif_carrier_off(dev);
+ if (!force_link_up)
+ netif_carrier_off(dev);
+
netdev_info(dev, "link down\n");
}
}
@@ -278,6 +293,13 @@ static int link_start(struct net_device *dev)
*/
if (ret == 0)
ret = t4vf_enable_vi(pi->adapter, pi->viid, true, true);
+
+ /* If we didn't experience any error and we're always reporting the
+ * link as being "up", tell the OS that the link is up.
+ */
+ if (ret == 0 && force_link_up)
+ netif_carrier_on(dev);
+
return ret;
}
--
2.1.0
next reply other threads:[~2018-02-23 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 15:06 Ganesh Goudar [this message]
2018-02-23 17:45 ` [PATCH net-next] cxgb4vf: Forcefully link up virtual interfaces David Miller
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=1519398413-10461-1-git-send-email-ganeshgr@chelsio.com \
--to=ganeshgr@chelsio.com \
--cc=arjun@chelsio.com \
--cc=davem@davemloft.net \
--cc=indranil@chelsio.com \
--cc=leedom@chelsio.com \
--cc=netdev@vger.kernel.org \
--cc=nirranjan@chelsio.com \
--cc=venkatesh@chelsio.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).