|
|
c7ffa4 |
From 3bdf79031ac9991210af55902aa632adde32d938 Mon Sep 17 00:00:00 2001
|
|
|
c7ffa4 |
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
|
|
c7ffa4 |
Date: Sat, 24 Feb 2018 21:02:16 -0800
|
|
|
c7ffa4 |
Subject: [PATCH] net/bnxt: fix link speed setting with autoneg off
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
[ backported from upstream commit 90cc14d77359bb3f8e48f4ef966ee77a52703949 ]
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
When Autoneg is turned off especially on remote side,
|
|
|
c7ffa4 |
link does not come up. This patch fixes that.
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
|
|
c7ffa4 |
---
|
|
|
c7ffa4 |
drivers/net/bnxt/bnxt.h | 1 +
|
|
|
c7ffa4 |
drivers/net/bnxt/bnxt_hwrm.c | 25 ++++++++++++++++++++++---
|
|
|
c7ffa4 |
2 files changed, 23 insertions(+), 3 deletions(-)
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
|
|
|
c7ffa4 |
index 8ab1c7f85..3bc2b9379 100644
|
|
|
c7ffa4 |
--- a/drivers/net/bnxt/bnxt.h
|
|
|
c7ffa4 |
+++ b/drivers/net/bnxt/bnxt.h
|
|
|
c7ffa4 |
@@ -162,6 +162,7 @@ struct bnxt_link_info {
|
|
|
c7ffa4 |
uint16_t link_speed;
|
|
|
c7ffa4 |
uint16_t support_speeds;
|
|
|
c7ffa4 |
uint16_t auto_link_speed;
|
|
|
c7ffa4 |
+ uint16_t force_link_speed;
|
|
|
c7ffa4 |
uint16_t auto_link_speed_mask;
|
|
|
c7ffa4 |
uint32_t preemphasis;
|
|
|
c7ffa4 |
uint8_t phy_type;
|
|
|
c7ffa4 |
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
|
|
|
c7ffa4 |
index 51b0056cd..ce214d7cb 100644
|
|
|
c7ffa4 |
--- a/drivers/net/bnxt/bnxt_hwrm.c
|
|
|
c7ffa4 |
+++ b/drivers/net/bnxt/bnxt_hwrm.c
|
|
|
c7ffa4 |
@@ -738,7 +738,8 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
|
|
|
c7ffa4 |
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS;
|
|
|
c7ffa4 |
}
|
|
|
c7ffa4 |
/* AutoNeg - Advertise speeds specified. */
|
|
|
c7ffa4 |
- if (conf->auto_link_speed_mask) {
|
|
|
c7ffa4 |
+ if (conf->auto_link_speed_mask &&
|
|
|
c7ffa4 |
+ !(conf->phy_flags & HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE)) {
|
|
|
c7ffa4 |
req.auto_mode =
|
|
|
c7ffa4 |
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
|
|
|
c7ffa4 |
req.auto_link_speed_mask =
|
|
|
c7ffa4 |
@@ -801,12 +802,22 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
|
|
|
c7ffa4 |
link_info->support_speeds = rte_le_to_cpu_16(resp->support_speeds);
|
|
|
c7ffa4 |
link_info->auto_link_speed = rte_le_to_cpu_16(resp->auto_link_speed);
|
|
|
c7ffa4 |
link_info->preemphasis = rte_le_to_cpu_32(resp->preemphasis);
|
|
|
c7ffa4 |
+ link_info->force_link_speed = rte_le_to_cpu_16(resp->force_link_speed);
|
|
|
c7ffa4 |
link_info->phy_ver[0] = resp->phy_maj;
|
|
|
c7ffa4 |
link_info->phy_ver[1] = resp->phy_min;
|
|
|
c7ffa4 |
link_info->phy_ver[2] = resp->phy_bld;
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
HWRM_UNLOCK();
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Link Speed %d\n", link_info->link_speed);
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Auto Mode %d\n", link_info->auto_mode);
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Support Speeds %x\n", link_info->support_speeds);
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Auto Link Speed %x\n", link_info->auto_link_speed);
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Auto Link Speed Mask %x\n",
|
|
|
c7ffa4 |
+ link_info->auto_link_speed_mask);
|
|
|
c7ffa4 |
+ RTE_LOG(DEBUG, PMD, "Forced Link Speed %x\n",
|
|
|
c7ffa4 |
+ link_info->force_link_speed);
|
|
|
c7ffa4 |
+
|
|
|
c7ffa4 |
return rc;
|
|
|
c7ffa4 |
}
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
@@ -2124,7 +2135,9 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
|
|
|
c7ffa4 |
autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
|
|
|
c7ffa4 |
speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds);
|
|
|
c7ffa4 |
link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY;
|
|
|
c7ffa4 |
- if (autoneg == 1) {
|
|
|
c7ffa4 |
+ /* Autoneg can be done only when the FW allows */
|
|
|
c7ffa4 |
+ if (autoneg == 1 && !(bp->link_info.auto_link_speed ||
|
|
|
c7ffa4 |
+ bp->link_info.force_link_speed)) {
|
|
|
c7ffa4 |
link_req.phy_flags |=
|
|
|
c7ffa4 |
HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;
|
|
|
c7ffa4 |
link_req.auto_link_speed_mask =
|
|
|
c7ffa4 |
@@ -2142,7 +2155,13 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
|
|
|
c7ffa4 |
}
|
|
|
c7ffa4 |
|
|
|
c7ffa4 |
link_req.phy_flags |= HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE;
|
|
|
c7ffa4 |
- link_req.link_speed = speed;
|
|
|
c7ffa4 |
+ /* If user wants a particular speed try that first. */
|
|
|
c7ffa4 |
+ if (speed)
|
|
|
c7ffa4 |
+ link_req.link_speed = speed;
|
|
|
c7ffa4 |
+ else if (bp->link_info.force_link_speed)
|
|
|
c7ffa4 |
+ link_req.link_speed = bp->link_info.force_link_speed;
|
|
|
c7ffa4 |
+ else
|
|
|
c7ffa4 |
+ link_req.link_speed = bp->link_info.auto_link_speed;
|
|
|
c7ffa4 |
}
|
|
|
c7ffa4 |
link_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds);
|
|
|
c7ffa4 |
link_req.auto_pause = bp->link_info.auto_pause;
|
|
|
c7ffa4 |
--
|
|
|
c7ffa4 |
2.14.3
|
|
|
c7ffa4 |
|