Commit 7b60cf2b authored by Michael Chan's avatar Michael Chan Committed by Jakub Kicinski

bnxt_en: Support force speed using the new HWRM fields

Modify bnxt_force_link_speed() to support the new speeds stored in
link_info->support_speeds2, including the new 400G speed.
Reviewed-by: default avatarAjit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20231201223924.26955-14-michael.chan@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 30c0bb63
......@@ -2128,6 +2128,7 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
struct bnxt *bp = netdev_priv(dev);
struct bnxt_link_info *link_info = &bp->link_info;
u16 support_pam4_spds = link_info->support_pam4_speeds;
u16 support_spds2 = link_info->support_speeds2;
u16 support_spds = link_info->support_speeds;
u8 sig_mode = BNXT_SIG_MODE_NRZ;
u32 lanes_needed = 1;
......@@ -2139,7 +2140,8 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_100MB;
break;
case SPEED_1000:
if (support_spds & BNXT_LINK_SPEED_MSK_1GB)
if ((support_spds & BNXT_LINK_SPEED_MSK_1GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_1GB))
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_1GB;
break;
case SPEED_2500:
......@@ -2147,7 +2149,8 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_2_5GB;
break;
case SPEED_10000:
if (support_spds & BNXT_LINK_SPEED_MSK_10GB)
if ((support_spds & BNXT_LINK_SPEED_MSK_10GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_10GB))
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_10GB;
break;
case SPEED_20000:
......@@ -2157,26 +2160,34 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
}
break;
case SPEED_25000:
if (support_spds & BNXT_LINK_SPEED_MSK_25GB)
if ((support_spds & BNXT_LINK_SPEED_MSK_25GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_25GB))
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_25GB;
break;
case SPEED_40000:
if (support_spds & BNXT_LINK_SPEED_MSK_40GB) {
if ((support_spds & BNXT_LINK_SPEED_MSK_40GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_40GB)) {
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_40GB;
lanes_needed = 4;
}
break;
case SPEED_50000:
if ((support_spds & BNXT_LINK_SPEED_MSK_50GB) && lanes != 1) {
if (((support_spds & BNXT_LINK_SPEED_MSK_50GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_50GB)) &&
lanes != 1) {
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_50GB;
lanes_needed = 2;
} else if (support_pam4_spds & BNXT_LINK_PAM4_SPEED_MSK_50GB) {
fw_speed = PORT_PHY_CFG_REQ_FORCE_PAM4_LINK_SPEED_50GB;
sig_mode = BNXT_SIG_MODE_PAM4;
} else if (support_spds2 & BNXT_LINK_SPEEDS2_MSK_50GB_PAM4) {
fw_speed = BNXT_LINK_SPEED_50GB_PAM4;
sig_mode = BNXT_SIG_MODE_PAM4;
}
break;
case SPEED_100000:
if ((support_spds & BNXT_LINK_SPEED_MSK_100GB) &&
if (((support_spds & BNXT_LINK_SPEED_MSK_100GB) ||
(support_spds2 & BNXT_LINK_SPEEDS2_MSK_100GB)) &&
lanes != 2 && lanes != 1) {
fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_100GB;
lanes_needed = 4;
......@@ -2184,6 +2195,14 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
fw_speed = PORT_PHY_CFG_REQ_FORCE_PAM4_LINK_SPEED_100GB;
sig_mode = BNXT_SIG_MODE_PAM4;
lanes_needed = 2;
} else if ((support_spds2 & BNXT_LINK_SPEEDS2_MSK_100GB_PAM4) &&
lanes != 1) {
fw_speed = BNXT_LINK_SPEED_100GB_PAM4;
sig_mode = BNXT_SIG_MODE_PAM4;
lanes_needed = 2;
} else if (support_spds2 & BNXT_LINK_SPEEDS2_MSK_100GB_PAM4_112) {
fw_speed = BNXT_LINK_SPEED_100GB_PAM4_112;
sig_mode = BNXT_SIG_MODE_PAM4_112;
}
break;
case SPEED_200000:
......@@ -2191,6 +2210,27 @@ bnxt_force_link_speed(struct net_device *dev, u32 ethtool_speed, u32 lanes)
fw_speed = PORT_PHY_CFG_REQ_FORCE_PAM4_LINK_SPEED_200GB;
sig_mode = BNXT_SIG_MODE_PAM4;
lanes_needed = 4;
} else if ((support_spds2 & BNXT_LINK_SPEEDS2_MSK_200GB_PAM4) &&
lanes != 2) {
fw_speed = BNXT_LINK_SPEED_200GB_PAM4;
sig_mode = BNXT_SIG_MODE_PAM4;
lanes_needed = 4;
} else if (support_spds2 & BNXT_LINK_SPEEDS2_MSK_200GB_PAM4_112) {
fw_speed = BNXT_LINK_SPEED_200GB_PAM4_112;
sig_mode = BNXT_SIG_MODE_PAM4_112;
lanes_needed = 2;
}
break;
case SPEED_400000:
if ((support_spds2 & BNXT_LINK_SPEEDS2_MSK_400GB_PAM4) &&
lanes != 4) {
fw_speed = BNXT_LINK_SPEED_400GB_PAM4;
sig_mode = BNXT_SIG_MODE_PAM4;
lanes_needed = 8;
} else if (support_spds2 & BNXT_LINK_SPEEDS2_MSK_400GB_PAM4_112) {
fw_speed = BNXT_LINK_SPEED_400GB_PAM4_112;
sig_mode = BNXT_SIG_MODE_PAM4_112;
lanes_needed = 4;
}
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment