Blame SOURCES/0001-net-bnxt-fix-link-speed-setting-with-autoneg-off.patch

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