From nobody Mon Jun 3 19:24:59 2024 X-Original-To: dev-commits-src-branches@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 4VtNwD2cCDz5JsDP; Mon, 03 Jun 2024 19:25:00 +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 4VtNwD0v5Pz4VMx; Mon, 3 Jun 2024 19:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717442700; 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=hwWZmFbN2ot4HFZ2uMIBrKiewDQl+55j9EGg/ffRLy8=; b=TJN5FCNGKaDyqHOdOA/2NJ2I5DHBYlqSRPV/S84wS9YDzSECk48ZC+2p0Y3diplXYGdOUs +gfgK801zN9wsQ7wBpXG+BKk7S+yvCl50fuktUEyqqHGA4QaA8M9dUHyPhOvcQ17A0WXZ4 xw232YjiHCPqos/n+RJZBnQiE55YIvdtragtezRIFNBqGxVa+duH1dHGdr3sKoOfjGvvIv gge2pAPXwtMcDuNx022rIdjXKQ2/rY3ocDKz4Jv/VV3LVpczfXna7WOojvagCd0o9xcTcW gdG4UWfIUk33uNNbHOgHnKzUB+eqVxEJJoH+uzvnJOu2yT3x/LB+4sRgnU73Sw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717442700; a=rsa-sha256; cv=none; b=kMFpnafdeVexW/arf36b+NyMA0DUK5JFJ2RR5wTc9ANZHPSToABO1meobLjICC8sNwi10M YOw3WLTENw9WUxzDnkuZ/4hjxem8180g+vr4j2lciypyRr4Jh7iwRQkf7oPt4z4l+xsq0U hGlfxOzO02SxHdR/pycHifxMJg2zooWYVaor2qKSH85XRfdc4t7YyOWN7c5dgB1E2hrN/3 LJGi9cV3N4i5kIUEUuJjvm55xHfnzee1ayllSt2uXUthKDJTs6c3blam2f8PogFkxTZPKe vmSPc2xFL0XMH5LH6BczsEt0ZhtAIJJHeq9dZjZN5eIUmpECsNvIWteFjeos4g== 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=1717442700; 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=hwWZmFbN2ot4HFZ2uMIBrKiewDQl+55j9EGg/ffRLy8=; b=lqmXxmUDvtJSPr0vhzEjGHo2cTr/wrGoY5L95MNdbJHKtEWmSAx8zhqH0VNJG7rXNAXRti aTMtgJJpC6s0ldOw2JP8OXGYzBbtePwFm5tE726c7yxiOU7svvDFNKamCQ2CBEAqEGLUYR NiENpxagf7idkx30m71kqDAsgBBsO0kt9VELZsHFUSAXg44QHSJu/rYUTtN3vhMPNo9aDX ClUKvHcwHVIy0qXVx4+YgtNW5Me5oKyaHU23UZg3TXLqV/FDZwi9T/HNPI+PUjqMaI8GdQ IM2MvSoNT71WG+NwgOs0bKDCJ7rxLHTpk9bnK9ck1BRanwgZMPDHedJSwd4Lzw== 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 4VtNwD0CSvznn2; Mon, 3 Jun 2024 19:25:00 +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 453JOxJe067838; Mon, 3 Jun 2024 19:24:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453JOx7W067835; Mon, 3 Jun 2024 19:24:59 GMT (envelope-from git) Date: Mon, 3 Jun 2024 19:24:59 GMT Message-Id: <202406031924.453JOx7W067835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e7b0af020cbc - stable/14 - if_bnxt: Set 1G/10G baseT force speed as auto speeds List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e7b0af020cbc13d1cbede5c7c82edeae64548137 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7b0af020cbc13d1cbede5c7c82edeae64548137 commit e7b0af020cbc13d1cbede5c7c82edeae64548137 Author: Chandrakanth Patil AuthorDate: 2024-03-06 13:23:04 +0000 Commit: Warner Losh 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");