From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next v2 9/9] bnxt_en: Improve ethtool .get_settings().
Date: Tue, 5 Apr 2016 14:09:03 -0400 [thread overview]
Message-ID: <1459879743-16960-10-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1459879743-16960-1-git-send-email-michael.chan@broadcom.com>
If autoneg is off, we should always report the speed and duplex settings
even if it is link down so the user knows the current settings. The
unknown speed and duplex should only be used for autoneg when link is
down.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 952b5ba..a2e9324 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -698,10 +698,23 @@ static int bnxt_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (link_info->phy_link_status == BNXT_LINK_LINK)
cmd->lp_advertising =
bnxt_fw_to_ethtool_lp_adv(link_info);
+ ethtool_speed = bnxt_fw_to_ethtool_speed(link_info->link_speed);
+ if (!netif_carrier_ok(dev))
+ cmd->duplex = DUPLEX_UNKNOWN;
+ else if (link_info->duplex & BNXT_LINK_DUPLEX_FULL)
+ cmd->duplex = DUPLEX_FULL;
+ else
+ cmd->duplex = DUPLEX_HALF;
} else {
cmd->autoneg = AUTONEG_DISABLE;
cmd->advertising = 0;
+ ethtool_speed =
+ bnxt_fw_to_ethtool_speed(link_info->req_link_speed);
+ cmd->duplex = DUPLEX_HALF;
+ if (link_info->req_duplex == BNXT_LINK_DUPLEX_FULL)
+ cmd->duplex = DUPLEX_FULL;
}
+ ethtool_cmd_speed_set(cmd, ethtool_speed);
cmd->port = PORT_NONE;
if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) {
@@ -719,14 +732,6 @@ static int bnxt_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->port = PORT_FIBRE;
}
- if (link_info->phy_link_status == BNXT_LINK_LINK) {
- if (link_info->duplex & BNXT_LINK_DUPLEX_FULL)
- cmd->duplex = DUPLEX_FULL;
- } else {
- cmd->duplex = DUPLEX_UNKNOWN;
- }
- ethtool_speed = bnxt_fw_to_ethtool_speed(link_info->link_speed);
- ethtool_cmd_speed_set(cmd, ethtool_speed);
if (link_info->transceiver ==
PORT_PHY_QCFG_RESP_XCVR_PKG_TYPE_XCVR_INTERNAL)
cmd->transceiver = XCVR_INTERNAL;
--
1.8.3.1
next prev parent reply other threads:[~2016-04-05 18:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 18:08 [PATCH net-next v2 0/9] bnxt_en: Updates for net-next Michael Chan
2016-04-05 18:08 ` [PATCH net-next v2 1/9] bnxt_en: Update to Firmware 1.2.2 spec Michael Chan
2016-04-05 18:08 ` [PATCH net-next v2 2/9] bnxt_en: Improve flow control autoneg with Firmware 1.2.1 interface Michael Chan
2016-04-05 18:08 ` [PATCH net-next v2 3/9] bnxt_en: Add basic EEE support Michael Chan
2016-04-05 18:08 ` [PATCH net-next v2 4/9] bnxt_en: Add EEE setup code Michael Chan
2016-04-05 18:08 ` [PATCH net-next v2 5/9] bnxt_en: Add get_eee() and set_eee() ethtool support Michael Chan
2016-04-05 18:09 ` [PATCH net-next v2 6/9] bnxt_en: Set async event bits when registering with the firmware Michael Chan
2016-04-05 18:09 ` [PATCH net-next v2 7/9] bnxt_en: Add unsupported SFP+ module warnings Michael Chan
2016-04-05 18:09 ` [PATCH net-next v2 8/9] bnxt_en: Check for valid forced speed during ethtool -s Michael Chan
2016-04-05 18:09 ` Michael Chan [this message]
2016-04-05 20:15 ` [PATCH net-next v2 0/9] bnxt_en: Updates for net-next 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=1459879743-16960-10-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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).