Skip to content

Commit

Permalink
net/bnxt: fix PAM4 mask setting
Browse files Browse the repository at this point in the history
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: c23f9de ("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>
  • Loading branch information
ajitkhaparde committed Jan 12, 2022
1 parent 54c6aad commit 2ca0727
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion drivers/net/bnxt/bnxt.h
Expand Up @@ -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;
Expand Down
25 changes: 13 additions & 12 deletions drivers/net/bnxt/bnxt_hwrm.c
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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 ||
Expand All @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 2ca0727

Please sign in to comment.