From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Stephen Hurd <stephen.hurd@broadcom.com>
Subject: [dpdk-dev] [PATCH 6/7] net/bnxt: fix some link related issues
Date: Wed, 28 Jun 2017 21:51:41 -0500 [thread overview]
Message-ID: <20170629025142.19404-7-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170629025142.19404-1-ajit.khaparde@broadcom.com>
This patch fixes some link related issues that can occur because:
bnxt_hwrm_port_phy_cfg() was setting enables inappropriately.
bnxt_hwrm_port_phy_qcfg() was overly complex.
bnxt_get_hwrm_link_config() was basing the speed on the link status.
bnxt_get_hwrm_link_config() was using the incorrect macros for auto_mode
we are not using supported speeds from phy_qcfg for auto mask.
Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 48 ++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 19 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3d2d408..da078f9 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -628,6 +628,8 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
struct hwrm_port_phy_cfg_input req = {0};
struct hwrm_port_phy_cfg_output *resp = bp->hwrm_cmd_resp_addr;
uint32_t enables = 0;
+ uint32_t link_speed_mask =
+ HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
HWRM_PREP(req, PORT_PHY_CFG, -1, resp);
@@ -639,14 +641,20 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
* any auto mode, even "none".
*/
if (!conf->link_speed) {
- req.auto_mode |= conf->auto_mode;
- enables = HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
- req.auto_link_speed_mask = conf->auto_link_speed_mask;
- enables |=
- HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
- req.auto_link_speed = bp->link_info.auto_link_speed;
- enables |=
+ req.auto_mode = conf->auto_mode;
+ enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
+ if (conf->auto_mode ==
+ HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK) {
+ req.auto_link_speed_mask =
+ conf->auto_link_speed_mask;
+ enables |= link_speed_mask;
+ }
+ if (bp->link_info.auto_link_speed) {
+ req.auto_link_speed =
+ bp->link_info.auto_link_speed;
+ enables |=
HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED;
+ }
}
req.auto_duplex = conf->duplex;
enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX;
@@ -686,13 +694,10 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
HWRM_CHECK_RESULT;
link_info->phy_link_status = resp->link;
- if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) {
- link_info->link_up = 1;
- link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
- } else {
- link_info->link_up = 0;
- link_info->link_speed = 0;
- }
+ link_info->link_up =
+ (link_info->phy_link_status ==
+ HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) ? 1 : 0;
+ link_info->link_speed = rte_le_to_cpu_16(resp->link_speed);
link_info->duplex = resp->duplex;
link_info->pause = resp->pause;
link_info->auto_pause = resp->auto_pause;
@@ -1790,12 +1795,16 @@ static int bnxt_valid_link_speed(uint32_t link_speed, uint8_t port_id)
return 0;
}
-static uint16_t bnxt_parse_eth_link_speed_mask(uint32_t link_speed)
+static uint16_t
+bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)
{
uint16_t ret = 0;
- if (link_speed == ETH_LINK_SPEED_AUTONEG)
+ if (link_speed == ETH_LINK_SPEED_AUTONEG) {
+ if (bp->link_info.support_speeds)
+ return bp->link_info.support_speeds;
link_speed = BNXT_SUPPORTED_SPEEDS;
+ }
if (link_speed & ETH_LINK_SPEED_100M)
ret |= HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB;
@@ -1887,7 +1896,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
"Get link config failed with rc %d\n", rc);
goto exit;
}
- if (link_info->link_up)
+ if (link_info->link_speed)
link->link_speed =
bnxt_parse_hw_link_speed(link_info->link_speed);
else
@@ -1896,7 +1905,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
link->link_status = link_info->link_up;
link->link_autoneg = link_info->auto_mode ==
HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE ?
- ETH_LINK_SPEED_FIXED : ETH_LINK_SPEED_AUTONEG;
+ ETH_LINK_FIXED : ETH_LINK_AUTONEG;
exit:
return rc;
}
@@ -1929,7 +1938,8 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
link_req.auto_mode =
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
link_req.auto_link_speed_mask =
- bnxt_parse_eth_link_speed_mask(dev_conf->link_speeds);
+ bnxt_parse_eth_link_speed_mask(bp,
+ dev_conf->link_speeds);
} else {
link_req.phy_flags |= HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE;
link_req.link_speed = speed;
--
2.10.1 (Apple Git-78)
next prev parent reply other threads:[~2017-06-29 2:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 2:51 [dpdk-dev] [PATCH 0/7] bnxt patch series Ajit Khaparde
2017-06-29 2:51 ` [dpdk-dev] [PATCH 1/7] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-29 2:51 ` [dpdk-dev] [PATCH 2/7] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-29 10:55 ` Ferruh Yigit
2017-06-30 2:27 ` Ajit Khaparde
2017-06-29 2:51 ` [dpdk-dev] [PATCH 3/7] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-29 2:51 ` [dpdk-dev] [PATCH 4/7] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-29 2:51 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-29 10:53 ` Ferruh Yigit
2017-06-29 2:51 ` Ajit Khaparde [this message]
2017-06-29 10:55 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix some link related issues Ferruh Yigit
2017-06-30 2:27 ` Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 0/9] bnxt patch series Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 1/9] net/bnxt: add support for Stratus VF device Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 2/9] net/bnxt: fix mtu configuration for the function Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 3/9] net/bnxt: fix calculation of VNICs Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 4/9] net/bnxt: pass func_default flag to VNIC_ALLOC Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 5/9] net/bnxt: fix automatic clearing of VF stats Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 6/9] net/bnxt: fix get link config Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 7/9] net/bnxt: fix autoneg on 10GBase-T links Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 8/9] net/bnxt: fix set link config Ajit Khaparde
2017-06-30 14:20 ` [dpdk-dev] [PATCH v2 9/9] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-07-03 9:40 ` [dpdk-dev] [PATCH v2 0/9] bnxt patch series Ferruh Yigit
2017-06-29 2:51 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix copy/pasted error message Ajit Khaparde
2017-06-29 10:56 ` Ferruh Yigit
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=20170629025142.19404-7-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=stephen.hurd@broadcom.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).