diff mbox series

[15/18] net/bnxt: fix PAM4 mask setting

Message ID 20220104083824.23001-16-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series bnxt PMD fixes | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Kalesh A P Jan. 4, 2022, 8:38 a.m. UTC
From: Ajit Khaparde <ajit.khaparde@broadcom.com>

Set the PAM4 mask setting only when PAM4 signaling is enabled.
Setting it otherwise seems to result in link negotiation.
Also auto_pam4_link_speeds has been renamed to
auto_pam4_link_speed_mask to reflect its real usage.

Fixes: c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c | 25 +++++++++++++------------
 2 files changed, 14 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9c0dbc6..433f1c8 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -297,7 +297,7 @@  struct bnxt_link_info {
 	uint8_t			link_signal_mode;
 	uint16_t		force_pam4_link_speed;
 	uint16_t		support_pam4_speeds;
-	uint16_t		auto_pam4_link_speeds;
+	uint16_t		auto_pam4_link_speed_mask;
 	uint16_t		support_pam4_auto_speeds;
 	uint8_t			req_signal_mode;
 	uint8_t			module_status;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 86997f5..a59e436 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1436,16 +1436,17 @@  static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 		    !(conf->phy_flags & HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE)) {
 			req.auto_mode =
 				HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
-			req.auto_link_speed_mask =
-				conf->auto_link_speed_mask;
-			if (conf->auto_pam4_link_speeds) {
+			if (conf->auto_pam4_link_speed_mask &&
+			    bp->link_info->link_signal_mode) {
 				enables |=
 				HWRM_PORT_PHY_CFG_IN_EN_AUTO_PAM4_LINK_SPD_MASK;
 				req.auto_link_pam4_speed_mask =
-					conf->auto_pam4_link_speeds;
+				rte_cpu_to_le_16(conf->auto_pam4_link_speed_mask);
 			} else {
 				enables |=
 				HWRM_PORT_PHY_CFG_IN_EN_AUTO_LINK_SPEED_MASK;
+				req.auto_link_speed_mask =
+				rte_cpu_to_le_16(conf->auto_link_speed_mask);
 			}
 		}
 		if (conf->auto_link_speed &&
@@ -1518,7 +1519,7 @@  static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
 			rte_le_to_cpu_16(resp->force_pam4_link_speed);
 	link_info->support_pam4_speeds =
 			rte_le_to_cpu_16(resp->support_pam4_speeds);
-	link_info->auto_pam4_link_speeds =
+	link_info->auto_pam4_link_speed_mask =
 			rte_le_to_cpu_16(resp->auto_pam4_link_speed_mask);
 	link_info->module_status = resp->module_status;
 	HWRM_UNLOCK();
@@ -1529,7 +1530,7 @@  static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
 		    link_info->support_speeds, link_info->force_link_speed);
 	PMD_DRV_LOG(DEBUG, "Link Signal:%d,PAM::Auto:%x,Support:%x,Force:%x\n",
 		    link_info->link_signal_mode,
-		    link_info->auto_pam4_link_speeds,
+		    link_info->auto_pam4_link_speed_mask,
 		    link_info->support_pam4_speeds,
 		    link_info->force_pam4_link_speed);
 	return rc;
@@ -3245,7 +3246,7 @@  int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 	/* No auto speeds and no auto_pam4_link. Disable autoneg */
 	if (bp->link_info->auto_link_speed == 0 &&
 	    bp->link_info->link_signal_mode &&
-	    bp->link_info->auto_pam4_link_speeds == 0)
+	    bp->link_info->auto_pam4_link_speed_mask == 0)
 		autoneg = 0;
 
 	speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds,
@@ -3258,8 +3259,8 @@  int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		link_req.auto_link_speed_mask =
 			bnxt_parse_eth_link_speed_mask(bp,
 						       dev_conf->link_speeds);
-		link_req.auto_pam4_link_speeds =
-			bp->link_info->auto_pam4_link_speeds;
+		link_req.auto_pam4_link_speed_mask =
+			bp->link_info->auto_pam4_link_speed_mask;
 	} else {
 		if (bp->link_info->phy_type ==
 		    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET ||
@@ -3278,9 +3279,9 @@  int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		else if (bp->link_info->force_pam4_link_speed)
 			link_req.link_speed =
 				bp->link_info->force_pam4_link_speed;
-		else if (bp->link_info->auto_pam4_link_speeds)
+		else if (bp->link_info->auto_pam4_link_speed_mask)
 			link_req.link_speed =
-				bp->link_info->auto_pam4_link_speeds;
+				bp->link_info->auto_pam4_link_speed_mask;
 		else if (bp->link_info->support_pam4_speeds)
 			link_req.link_speed =
 				bp->link_info->support_pam4_speeds;
@@ -3292,7 +3293,7 @@  int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		 * zero. Use the auto_link_speed.
 		 */
 		if (bp->link_info->auto_link_speed != 0 &&
-		    bp->link_info->auto_pam4_link_speeds == 0)
+		    bp->link_info->auto_pam4_link_speed_mask == 0)
 			link_req.link_speed = bp->link_info->auto_link_speed;
 	}
 	link_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds);