From nobody Tue Jul 11 16:19:34 2023 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 4R0mKg0599z4gvbW; Tue, 11 Jul 2023 16:19:35 +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 4R0mKf6nCVz3hsK; Tue, 11 Jul 2023 16:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689092375; 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=BTdRhud7sIlz76OgXcXimZQSYWly8v29ECuog0+hJ20=; b=trm7wx9alon0pLHiOF6hBJMozzVScMA3ZcrgH2nyfGsTt9L8fGw68mBKnSBGadKs/1/RGH 6d3IvYceKVvKQb9ftmUo+GBxeKps2i9RJPcRDemaoZNZ1twJfg7urWV+RJUbhcj2r6mGx7 Cd43GmxA+B+0Qc74zqK3VLB1LHGjyc66vy0FrjkR+N7eCC7CsjcuDJl1ez4noRygrsLNAm QNG8ElJ1aP+ekh6hv0TLyKy2AJorbI7j1UwEDiL6hUhqquJh1WhYlyLp2zS5QYMtnJNJfp v7H4kguZJw1TufE0jpf1n7DVypUD+wd68APZ/I3MlsgJM1dO2apaDGVougYdpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689092374; 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=BTdRhud7sIlz76OgXcXimZQSYWly8v29ECuog0+hJ20=; b=aA45LhoA+rcgAYDMu3va11wppTCgGh0OvFDmcP9U8HocB65f63T1YKfaJyITGLpFkNFHM/ RC60HJM9eJ8RjIfXC89ZafsnXGenP3j9s+GaObVs1ObobdhA6S1pjZIdiNThHRsotsQyKJ kDhmcVi2swDTyrCpi1n8BTTZ5WqSp8yw5mKT13Z0Ixmcpgui8gPpAclq/CPM8Xipz/bYuD l2sTd+2lHn/qfyL1bq/88on+ZUezblrDOtwIYfhjFsIQ9KD92Q1LJnMiR9ga30f9ricDag HSfjYTOkOWBfRBs2L8Os3QRdJR9hitbSgJvX/UW/zBkzNvlLFl5qC4BhDGrBzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689092374; a=rsa-sha256; cv=none; b=JMKwXEx4bfxz+L/QPJbmgVqN8SJ6EqC/NhnKpA8LqrhFhw1W9UquSu7fg4dFfGmhRHaShz CqhaobxVWHSJt/qFOYne21cbKbjPuVNIHPi8HDuU09UEg3E2Cjt4isU66RuZcASIAOErVh S2Oe6v1dZUcCbjh0wvdkS6HenJmoe3warI9Sm4ixi7aiPqNNJkIbuZAN54zrNpyDGtvJIW nOuXYD1sowhNCWgECKCqcX25I6FyOiJi7Kr2bI2LntClXvnjx+zlu77m0+9+HJ7ezqEfj1 5Poek7e3hgIGrdkAe0Z2o+88rj6d35NXY3Z1JJxfTjRxQXaS0cx3FlsepsPKcw== 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 4R0mKf5lZwzY24; Tue, 11 Jul 2023 16:19:34 +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 36BGJYYo023722; Tue, 11 Jul 2023 16:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36BGJYdv023721; Tue, 11 Jul 2023 16:19:34 GMT (envelope-from git) Date: Tue, 11 Jul 2023 16:19:34 GMT Message-Id: <202307111619.36BGJYdv023721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: a0302c923150 - main - 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0302c9231502bae8f43edbd5fb8d73132eb8da7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=a0302c9231502bae8f43edbd5fb8d73132eb8da7 commit a0302c9231502bae8f43edbd5fb8d73132eb8da7 Author: Piotr Pietruszewski AuthorDate: 2023-07-11 16:14:26 +0000 Commit: Piotr Kubaj CommitDate: 2023-07-11 16:14:26 +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 --- 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 0179c6456de8..09c0a82279ed 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -3679,7 +3679,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 848c15fe3b99..13f48a6fd3ec 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -937,7 +937,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 83a51b4d15e7..a704a6ebbc8c 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -530,6 +530,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 49ae5e27f46e..a35ff0ef7889 100644 --- a/sys/dev/ixgbe/ixgbe_osdep.c +++ b/sys/dev/ixgbe/ixgbe_osdep.c @@ -76,3 +76,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; +}