From: Sunil Goutham <sunil.kovvuri@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sunil.Goutham@caviumnetworks.com,
Sunil Goutham <sgoutham@cavium.com>
Subject: [PATCH 5/6] net: thunderx: Switchon carrier only upon interface link up
Date: Tue, 1 Dec 2015 14:43:42 +0530 [thread overview]
Message-ID: <1448961223-41888-6-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <y>
From: Sunil Goutham <sgoutham@cavium.com>
Call netif_carrier_on() only if interface's link is up. Switching this on
upon IFF_UP by default, is causing issues with ethernet channel bonding
in LACP mode. Initial NETDEV_CHANGE notification was being skipped.
Also fixed some issues with link/speed/duplex reporting via ethtool.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
.../net/ethernet/cavium/thunder/nicvf_ethtool.c | 16 +++++++++++++++-
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 +---
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 ++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
index af54c10..a12b2e3 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
@@ -112,6 +112,13 @@ static int nicvf_get_settings(struct net_device *netdev,
cmd->supported = 0;
cmd->transceiver = XCVR_EXTERNAL;
+
+ if (!nic->link_up) {
+ cmd->duplex = DUPLEX_UNKNOWN;
+ ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+ return 0;
+ }
+
if (nic->speed <= 1000) {
cmd->port = PORT_MII;
cmd->autoneg = AUTONEG_ENABLE;
@@ -125,6 +132,13 @@ static int nicvf_get_settings(struct net_device *netdev,
return 0;
}
+static u32 nicvf_get_link(struct net_device *netdev)
+{
+ struct nicvf *nic = netdev_priv(netdev);
+
+ return nic->link_up;
+}
+
static void nicvf_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{
@@ -660,7 +674,7 @@ static int nicvf_set_channels(struct net_device *dev,
static const struct ethtool_ops nicvf_ethtool_ops = {
.get_settings = nicvf_get_settings,
- .get_link = ethtool_op_get_link,
+ .get_link = nicvf_get_link,
.get_drvinfo = nicvf_get_drvinfo,
.get_msglevel = nicvf_get_msglevel,
.set_msglevel = nicvf_set_msglevel,
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 7f709cb..dde8dc7 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1057,6 +1057,7 @@ int nicvf_stop(struct net_device *netdev)
netif_carrier_off(netdev);
netif_tx_stop_all_queues(nic->netdev);
+ nic->link_up = false;
/* Teardown secondary qsets first */
if (!nic->sqs_mode) {
@@ -1211,9 +1212,6 @@ int nicvf_open(struct net_device *netdev)
nic->drv_stats.txq_stop = 0;
nic->drv_stats.txq_wake = 0;
- netif_carrier_on(netdev);
- netif_tx_start_all_queues(netdev);
-
return 0;
cleanup:
nicvf_disable_intr(nic, NICVF_INTR_MBOX, 0);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 2076ac3..d9f27ad 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -612,6 +612,8 @@ static void bgx_poll_for_link(struct work_struct *work)
lmac->last_duplex = 1;
} else {
lmac->link_up = 0;
+ lmac->last_speed = SPEED_UNKNOWN;
+ lmac->last_duplex = DUPLEX_UNKNOWN;
}
if (lmac->last_link != lmac->link_up) {
--
1.7.1
next prev reply other threads:[~2015-12-01 9:13 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <y@samsung.com>
2012-05-22 5:57 ` [PATCH v3 2/2] regulator: Add support for MAX77686 yadi.brar01
2012-05-23 1:40 ` jonghwa3.lee
2012-05-23 4:16 ` Yadwinder Singh Brar
2012-05-23 4:40 ` jonghwa3.lee
2012-05-23 5:23 ` Yadwinder Singh Brar
2012-05-23 5:33 ` jonghwa3.lee
2012-05-23 10:18 ` Mark Brown
2012-05-23 13:02 ` Yadwinder Singh Brar
2012-05-23 6:08 ` Yadwinder Singh Brar
2012-05-23 1:50 ` jonghwa3.lee
2012-05-23 4:17 ` Yadwinder Singh Brar
2014-07-23 1:40 ` [PATCH] extcon: Add missing REGMAP_I2C/REGMAP_IRQ dependency on extcon driver Chanwoo Choi
2014-07-23 8:20 ` Krzysztof Kozlowski
2014-07-25 8:39 ` Charles Keepax
2014-08-12 2:01 ` [PATCHv2 0/5] rtc: s3c: Refactoring s3c-rtc driver and support Exynos3250 RTC y
2014-08-12 2:01 ` [PATCHv2 1/5] rtc: s3c: Define s3c_rtc structure to remove global variables y
2014-08-22 20:42 ` Andrew Morton
2014-08-25 0:57 ` Chanwoo Choi
2014-08-26 21:31 ` Andrew Morton
2014-08-28 4:49 ` Chanwoo Choi
2014-08-12 2:01 ` [PATCHv2 2/5] rtc: s3c: Remove warning message when checking coding style with checkpatch script y
2014-08-12 2:01 ` [PATCHv2 3/5] rtc: s3c: Add s3c_rtc_data structure to use variant data instead of s3c_cpu_type y
2014-08-12 2:01 ` [PATCHv2 4/5] rtc: s3c: Add support for RTC of Exynos3250 SoC y
2014-08-12 2:01 ` [PATCHv2 5/5] ARM: dts: Fix wrong compatible string of Exynos3250 RTC dt node y
2015-12-01 9:13 ` [PATCH 3/6] net: thunderx: Increase transmit queue length Sunil Goutham
2015-12-01 14:40 ` Pavel Fedin
2015-12-01 15:33 ` Eric Dumazet
2015-12-01 16:30 ` Sunil Kovvuri
2015-12-01 19:30 ` David Miller
2015-12-02 5:48 ` Sunil Kovvuri
2015-12-02 13:25 ` Eric Dumazet
2015-12-02 16:50 ` Sunil Kovvuri
2015-12-02 16:59 ` Eric Dumazet
2015-12-02 17:31 ` David Miller
2015-12-02 9:05 ` Pavel Fedin
2015-12-02 10:31 ` Pavel Fedin
2015-12-02 12:29 ` Pavel Fedin
2015-12-02 12:57 ` Sunil Kovvuri
2015-12-02 13:22 ` Pavel Fedin
2015-12-02 8:09 ` Pavel Fedin
2015-12-01 9:13 ` Sunil Goutham [this message]
2015-12-01 15:32 ` [PATCH 5/6] net: thunderx: Switchon carrier only upon interface link up Pavel Fedin
2015-12-01 16:39 ` Sunil Kovvuri
2015-12-07 5:00 ` [PATCH 0/2] net: thunderx: Miscellaneous cleanups Sunil Goutham
2015-12-07 10:33 ` Pavel Fedin
2015-12-07 18:40 ` David Miller
2015-12-09 11:38 ` [PATCH 1/2] net: thunderx: HW TSO support for pass-2 hardware Sunil Goutham
2015-12-09 12:05 ` Pavel Fedin
2015-12-09 12:24 ` Sunil Kovvuri
2015-12-09 20:26 ` David Miller
2015-12-09 11:38 ` [PATCH 2/2] net: thunderx: Enable CQE count threshold interrupt Sunil Goutham
2015-12-09 12:07 ` Pavel Fedin
2015-12-09 12:26 ` Sunil Kovvuri
2015-12-10 7:55 ` [PATCH v2 0/2] net: thunderx: Support for pass-2 hw features Sunil Goutham
2015-12-10 8:52 ` Pavel Fedin
2015-12-12 4:38 ` 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=1448961223-41888-6-git-send-email-sunil.kovvuri@gmail.com \
--to=sunil.kovvuri@gmail.com \
--cc=Sunil.Goutham@caviumnetworks.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sgoutham@cavium.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).