git: a4eee3fa6043 - stable/13 - ix, ixv: Update link status with autonegotiated baudrate value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Nov 2024 02:14:27 UTC
The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=a4eee3fa6043bb619e136f6d4df7feb7027ba1fc commit a4eee3fa6043bb619e136f6d4df7feb7027ba1fc Author: Piotr Pietruszewski <piotr.pietruszewski@intel.com> AuthorDate: 2023-07-11 16:14:26 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> 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; +}