if_bnxt: Set 1G/10G baseT force speed as auto speeds

The firmware lacks support for manually setting 1G and 10G baseT speeds.
However, the driver can enable auto speed masks to achieve automatic configuration
at these speeds.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42960
This commit is contained in:
Chandrakanth Patil 2024-03-06 18:53:04 +05:30 committed by Sumit Saxena
parent c63d67e137
commit 770e7ba3eb
3 changed files with 23 additions and 5 deletions

View file

@ -843,5 +843,6 @@ struct bnxt_softc *bnxt_find_dev(uint32_t domain, uint32_t bus, uint32_t dev_fn,
int bnxt_read_sfp_module_eeprom_info(struct bnxt_softc *bp, uint16_t i2c_addr,
uint16_t page_number, uint8_t bank, bool bank_sel_en, uint16_t start_addr,
uint16_t data_length, uint8_t *buf);
uint8_t get_phy_type(struct bnxt_softc *softc);
#endif /* _BNXT_H */

View file

@ -862,8 +862,20 @@ bnxt_hwrm_set_link_common(struct bnxt_softc *softc,
uint16_t fw_link_speed = softc->link_info.req_link_speed;
if (autoneg & BNXT_AUTONEG_SPEED) {
req->auto_mode |=
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS;
uint8_t phy_type = get_phy_type(softc);
if (phy_type == HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_1G_BASET ||
phy_type == HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET ||
phy_type == HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE) {
req->auto_mode |= htole32(HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK);
if (link_info->advertising) {
req->enables |= htole32(HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK);
req->auto_link_speed_mask = htole16(link_info->advertising);
}
} else {
req->auto_mode |= HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS;
}
req->enables |=
htole32(HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE);

View file

@ -219,7 +219,6 @@ static void bnxt_mark_cpr_invalid(struct bnxt_cp_ring *cpr);
static void bnxt_def_cp_task(void *context);
static void bnxt_handle_async_event(struct bnxt_softc *softc,
struct cmpl_base *cmpl);
static uint8_t get_phy_type(struct bnxt_softc *softc);
static uint64_t bnxt_get_baudrate(struct bnxt_link_info *link);
static void bnxt_get_wol_settings(struct bnxt_softc *softc);
static int bnxt_wol_config(if_ctx_t ctx);
@ -2144,7 +2143,6 @@ bnxt_media_change(if_ctx_t ctx)
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB;
break;
case IFM_1000_KX:
case IFM_1000_T:
case IFM_1000_SGMII:
case IFM_1000_CX:
case IFM_1000_SX:
@ -2163,7 +2161,6 @@ bnxt_media_change(if_ctx_t ctx)
case IFM_10G_KR:
case IFM_10G_LR:
case IFM_10G_SR:
case IFM_10G_T:
softc->link_info.autoneg &= ~BNXT_AUTONEG_SPEED;
softc->link_info.req_link_speed =
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB;
@ -2240,6 +2237,14 @@ bnxt_media_change(if_ctx_t ctx)
softc->link_info.req_signal_mode =
HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_PAM4;
break;
case IFM_1000_T:
softc->link_info.advertising = HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB;
softc->link_info.autoneg |= BNXT_AUTONEG_SPEED;
break;
case IFM_10G_T:
softc->link_info.advertising = HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB;
softc->link_info.autoneg |= BNXT_AUTONEG_SPEED;
break;
default:
device_printf(softc->dev,
"Unsupported media type! Using auto\n");