git: e7b0af020cbc - stable/14 - if_bnxt: Set 1G/10G baseT force speed as auto speeds
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Jun 2024 19:24:59 UTC
The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7b0af020cbc13d1cbede5c7c82edeae64548137 commit e7b0af020cbc13d1cbede5c7c82edeae64548137 Author: Chandrakanth Patil <chandrakanth.patil@broadcom.com> AuthorDate: 2024-03-06 13:23:04 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-06-03 19:23:14 +0000 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 (cherry picked from commit 770e7ba3ebe87ba7ffc872c87de72707757b4e25) --- sys/dev/bnxt/bnxt.h | 1 + sys/dev/bnxt/bnxt_hwrm.c | 16 ++++++++++++++-- sys/dev/bnxt/if_bnxt.c | 11 ++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h index 204284d45428..0547bae91e09 100644 --- a/sys/dev/bnxt/bnxt.h +++ b/sys/dev/bnxt/bnxt.h @@ -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 */ diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c index 481d45350488..37238b857ef5 100644 --- a/sys/dev/bnxt/bnxt_hwrm.c +++ b/sys/dev/bnxt/bnxt_hwrm.c @@ -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); diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 87e0d6cd9354..d9273718873b 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -220,7 +220,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); @@ -2145,7 +2144,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: @@ -2164,7 +2162,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; @@ -2241,6 +2238,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");