From nobody Thu Mar 07 19:27:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TrK7W0lh4z5DfYB; Thu, 7 Mar 2024 19:27:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TrK7V6GfQz4b8k; Thu, 7 Mar 2024 19:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709839638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cWznjpacpr2yCAZdJ0wXDn0NXaTJ4asZVXuLynak2wM=; b=gQ2vhQTHhzgl7Vmc0nqH4PLj0KvEr2gV1oNfJaU/wcY1eYArqjymt6DUPqVjVu7OBGi4UX AZP6kRUP0LqBnvNwSUy8gPpsNffvAIjMlkFdT7KHF5RUqz98d5U5IDYAsA1z/8b5u36DU5 2pnQ2cjdnshwshu4DfEGS8QOmYdFEco9gUT7sQx7zIL9Jks+ncb/F6iWxnpXQfkgwtb3ZH zT6yn7WlK1O04Io0002vQnCpIjZ9vGUaWA7MuZ5XglKtN40hFszFqVIE70/JdK1sqHjcwz CEGkZ/E3z5+PynDi5TImBdnkdtSf9uLUVbot1EL48ImEpBTdmcRjm6PzdrWTYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709839638; a=rsa-sha256; cv=none; b=VmHmpNmapigMytdxGkV70hmp53opOGPK9KeoR8lEIBiJ+iNn9tQbPX5rKdP+A4dSijcLJt FgxKkoxLgS2UtUSIjQ+/0XTLxI3znSFhqDCcLCbJ8DmIL3/4QEFsVpH31IDSLwG6yp5ckY dJYU6nu31z8YGB7ZTHVGXktQyamOBxkh46kZZqVotYV017qYbAIUkcjvSHivi5if6TAmN6 1X+6eYZ/XyUzzYsVBv+CR5egVMXK0yHPjV+8oKyrEwX9DZz0X7a+v1P5bJPYA+1kMNabxH wmqYWQRl8vdBn+PvzQV49wqZiY4uK/3nERfZvcEzu3Frifk8EPariU7X0ZwXVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709839638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cWznjpacpr2yCAZdJ0wXDn0NXaTJ4asZVXuLynak2wM=; b=vpSUG8l5pgNfnrVvoFtw2lDIVs50y+Kab7aJsIo5Yu49B3DHhTJb7+oAyiQXrufEqApiil b0DCT674VoEXUfz9HSa+WFAwyqCh1ESkSouivbUhmq4IoBTPsOIKCGzicV3b5UP9QjdJ2G WTaNe9IBSGN1VFFx5SRBtfgSsStTmHtPNsVFyX23oJ6hjhyNeVcyeD0C3oZdJVp0y8ZELM 5oJcyDLlWj56Dj4XUdPry6Ne00Hva/QyXLln8w4sV3qGhqaYgcX34+K+k1CaktdCuuGKZh kvAnvrxe34cTLb7l5omvenxBSdjwT1R87xgY66nDgLAFHvm2d/WVuW9hcl/rDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TrK7V5ttvzn3l; Thu, 7 Mar 2024 19:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 427JRIqN064516; Thu, 7 Mar 2024 19:27:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 427JRIrX064513; Thu, 7 Mar 2024 19:27:18 GMT (envelope-from git) Date: Thu, 7 Mar 2024 19:27:18 GMT Message-Id: <202403071927.427JRIrX064513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sumit Saxena Subject: git: 770e7ba3ebe8 - main - if_bnxt: Set 1G/10G baseT force speed as auto speeds List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ssaxena X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 770e7ba3ebe87ba7ffc872c87de72707757b4e25 Auto-Submitted: auto-generated The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=770e7ba3ebe87ba7ffc872c87de72707757b4e25 commit 770e7ba3ebe87ba7ffc872c87de72707757b4e25 Author: Chandrakanth Patil AuthorDate: 2024-03-06 13:23:04 +0000 Commit: Sumit Saxena CommitDate: 2024-03-07 19:26:34 +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 --- 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 4abd8b425444..9fd76301d6b3 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -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");