From nobody Wed Nov 27 02:14:27 2024 X-Original-To: dev-commits-src-all@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 4XyjgR5kmmz5fN6S; Wed, 27 Nov 2024 02:14:27 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XyjgR4JH9z4gGH; Wed, 27 Nov 2024 02:14:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732673667; 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=FJilFquY6Ne1SWh6q20m6oj2BZ9sG8vVxb9KPHf+8Pw=; b=t7IkauYH2/FvrBlypbN8Qas27ai0L4Bn4f4C7Dymu3CNRE5PPnNToecPNMnzz1yMBX+Dcr iAbWMjqq+VMEH3BUMVlDiKi6in4pYMK/jzwubp5l1+QZurEp8KFOX7dhCayezmqq4qV4F9 OugXBfsoeeaZ79CYavLyDCcEXNfxJkwniWrO+E+FTznwOTmsXJQ68EqcNunUmtdjGpr4w+ SbQaMPf4vHovdi13xGV0Z07pmsj7YGoCWiHez3nUES+2P43yQXIPUosAq9PkiBD4L1ZtqI pt25tmZy5f2AJof26tveV78eEAKjzAi2hIiCgt/ad4Jr/uiQz7lPvX2F7udpWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732673667; 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=FJilFquY6Ne1SWh6q20m6oj2BZ9sG8vVxb9KPHf+8Pw=; b=KZi2tm3fA4D8z2rofb4glGI8D3tGqOosx5VNyDAAtmt9Jqgt1velXd3uhYb1iqnv8hXfHQ nlJ1lqI6vjeU2waw8Z0i2dk17dvZ17zYlG2Mm8MgHaZfDz+CerPhxNcrY1G1FU6hcuFQ28 aFK+WEdOEQT19WfM2jP5ySwo0zRJBGJkKbNxeQfsyeMWcPY9ovZipNC+yEtFzae0ZSYVPK qRbMNBObHrXCDXAOGFhpx937rJ1pUvF/9oyI5c5v31A1BPXLusvckZAzrGKhLu0Ud75S3i MgcO+YpzqfQayaWdIUYV4whm1zqTMI5QBywZFdiDtnG5GpI/FgtprvTjlfaTmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732673667; a=rsa-sha256; cv=none; b=bbtqs6CjenkJRP+lfOUPJjBrr4dwLkLf6b1+VuKZdsBN9sLNfk86k5T2IlAbr3XstuRAQt ishLXC7DQhCMSfZxB4eHM1KXMjJy5oLERsE16jfBp9lkYRJTHcMC6NKoSpHRSqHRxwBNCf igU+/39zOlpf/Dr0SFoSNvqiiXWIDzx1Uh0UBWI4Vobsg23vQJBJZCpirXS9cAc0seCASW /3iwiIUjSrHpM8Z21aAtMfQ11K+IfIMEI5wxfX73DCvoOtINdhI3/2pAo7D5fEyiG5wXQA u4bkOTppkb9R2ETo1k+OKESplbTsX6D/q85k9IUCl7RHSFDRQWAkDaIsDh1s3w== 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 4XyjgR3YzrzqKw; Wed, 27 Nov 2024 02:14:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AR2ERCJ066894; Wed, 27 Nov 2024 02:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AR2ERUR066891; Wed, 27 Nov 2024 02:14:27 GMT (envelope-from git) Date: Wed, 27 Nov 2024 02:14:27 GMT Message-Id: <202411270214.4AR2ERUR066891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a4eee3fa6043 - stable/13 - ix, ixv: Update link status with autonegotiated baudrate value List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4eee3fa6043bb619e136f6d4df7feb7027ba1fc Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=a4eee3fa6043bb619e136f6d4df7feb7027ba1fc commit a4eee3fa6043bb619e136f6d4df7feb7027ba1fc Author: Piotr Pietruszewski AuthorDate: 2023-07-11 16:14:26 +0000 Commit: Kevin Bowling CommitDate: 2024-11-27 01:14:56 +0000 ix, ixv: Update link status with autonegotiated baudrate value Use autonegotiated link speed value while updating link status to iflib. This patch is part of change made in NetBSD kernel by Masanobu Saitoh, NetBSD maintainer. Differential Revision: https://reviews.freebsd.org/D19176 Approved by: erj (cherry picked from commit a0302c9231502bae8f43edbd5fb8d73132eb8da7) --- sys/dev/ixgbe/if_ix.c | 3 ++- sys/dev/ixgbe/if_ixv.c | 2 +- sys/dev/ixgbe/ixgbe.h | 2 ++ sys/dev/ixgbe/ixgbe_osdep.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 3639adc0feba..0fa66ef2055c 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -3880,7 +3880,8 @@ ixgbe_if_update_admin_status(if_ctx_t ctx) /* Update DMA coalescing config */ ixgbe_config_dmac(sc); /* should actually be negotiated value */ - iflib_link_state_change(ctx, LINK_STATE_UP, IF_Gbps(10)); + iflib_link_state_change(ctx, LINK_STATE_UP, + ixgbe_link_speed_to_baudrate(adapter->link_speed)); if (sc->feat_en & IXGBE_FEATURE_SRIOV) ixgbe_ping_all_vfs(sc); diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 23381dcbe809..6e97e50c1914 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -941,7 +941,7 @@ ixv_if_update_admin_status(if_ctx_t ctx) "Full Duplex"); sc->link_active = true; iflib_link_state_change(ctx, LINK_STATE_UP, - IF_Gbps(10)); + ixgbe_link_speed_to_baudrate(adapter->link_speed)); } } else { /* Link down */ if (sc->link_active == true) { diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 5141e9d27003..341d4ebfcebc 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -533,6 +533,8 @@ ixv_check_ether_addr(u8 *addr) return (status); } +uint64_t ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed); + /* Shared Prototypes */ int ixgbe_allocate_queues(struct ixgbe_softc *); diff --git a/sys/dev/ixgbe/ixgbe_osdep.c b/sys/dev/ixgbe/ixgbe_osdep.c index 57403b0b2f6c..2fa651df8936 100644 --- a/sys/dev/ixgbe/ixgbe_osdep.c +++ b/sys/dev/ixgbe/ixgbe_osdep.c @@ -75,3 +75,36 @@ ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset, u32 val) ((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle, reg + (offset << 2), val); } + +uint64_t +ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed) +{ + uint64_t baudrate; + + switch (speed) { + case IXGBE_LINK_SPEED_10GB_FULL: + baudrate = IF_Gbps(10); + break; + case IXGBE_LINK_SPEED_5GB_FULL: + baudrate = IF_Gbps(5); + break; + case IXGBE_LINK_SPEED_2_5GB_FULL: + baudrate = IF_Mbps(2500); + break; + case IXGBE_LINK_SPEED_1GB_FULL: + baudrate = IF_Gbps(1); + break; + case IXGBE_LINK_SPEED_100_FULL: + baudrate = IF_Mbps(100); + break; + case IXGBE_LINK_SPEED_10_FULL: + baudrate = IF_Mbps(10); + break; + case IXGBE_LINK_SPEED_UNKNOWN: + default: + baudrate = 0; + break; + } + + return baudrate; +}