aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogesh Bhosale <Yogesh.Bhosale@intel.com>2025-09-09 17:01:04 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2025-09-09 17:39:10 +0000
commit46347b3619757e3d683a87ca03efaf2ae242335f (patch)
treedb4c7e26e9bd186672f6c78b7aef2ee12154610a
parent101a35e84da311000b9ee12341bbd80bc4c7a721 (diff)
ixgbe: Fix incomplete speed coverage in link status logging
Originally ixgbe_if_update_admin_status() only handled 1G and 10G speeds, causing any other speeds to display as "1 Gbps" in link status logs. This issue is fixed by adding link speed to string conversion logic through the introduction of a helper function, ixgbe_link_speed_to_str(), which corrects the misleading logs to reflect accurate link speeds. Signed-off-by: Yogesh Bhosale yogesh.bhosale@intel.com PR: 288960 Reported by: Mike Belanger - QNX MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52442
-rw-r--r--sys/dev/ixgbe/if_ix.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 73c0fd1ab16f..e1e05e008e8d 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -184,6 +184,7 @@ static int ixgbe_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int,
int);
static void ixgbe_if_queues_free(if_ctx_t);
static void ixgbe_if_timer(if_ctx_t, uint16_t);
+static const char *ixgbe_link_speed_to_str(u32 link_speed);
static void ixgbe_if_update_admin_status(if_ctx_t);
static void ixgbe_if_vlan_register(if_ctx_t, u16);
static void ixgbe_if_vlan_unregister(if_ctx_t, u16);
@@ -4027,6 +4028,33 @@ ixgbe_if_stop(if_ctx_t ctx)
} /* ixgbe_if_stop */
/************************************************************************
+ * ixgbe_link_speed_to_str - Convert link speed to string
+ *
+ * Helper function to convert link speed constants to human-readable
+ * string representations in Gbps.
+ ************************************************************************/
+static const char *
+ixgbe_link_speed_to_str(u32 link_speed)
+{
+ switch (link_speed) {
+ case IXGBE_LINK_SPEED_10GB_FULL:
+ return "10 Gbps";
+ case IXGBE_LINK_SPEED_5GB_FULL:
+ return "5 Gbps";
+ case IXGBE_LINK_SPEED_2_5GB_FULL:
+ return "2.5 Gbps";
+ case IXGBE_LINK_SPEED_1GB_FULL:
+ return "1 Gbps";
+ case IXGBE_LINK_SPEED_100_FULL:
+ return "100 Mbps";
+ case IXGBE_LINK_SPEED_10_FULL:
+ return "10 Mbps";
+ default:
+ return "Unknown";
+ }
+} /* ixgbe_link_speed_to_str */
+
+/************************************************************************
* ixgbe_update_link_status - Update OS on link state
*
* Note: Only updates the OS on the cached link state.
@@ -4042,9 +4070,9 @@ ixgbe_if_update_admin_status(if_ctx_t ctx)
if (sc->link_up) {
if (sc->link_active == false) {
if (bootverbose)
- device_printf(dev, "Link is up %d Gbps %s \n",
- ((sc->link_speed == 128) ? 10 : 1),
- "Full Duplex");
+ device_printf(dev,
+ "Link is up %s Full Duplex\n",
+ ixgbe_link_speed_to_str(sc->link_speed));
sc->link_active = true;
/* Update any Flow Control changes */
ixgbe_fc_enable(&sc->hw);