From nobody Fri Apr 17 17:12:58 2026 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 4fy1fg1tSfz67BCK for ; Fri, 17 Apr 2026 17:12:59 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fy1fg0SR5z3ky8 for ; Fri, 17 Apr 2026 17:12:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776445979; 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=DM5z1kATx2A0qLftZxlvoXEGK8C11coz9e0955iF6m0=; b=luiFectjgaPKe54QeOKNW1d41leRYM4cDTIfU+O4z4Fjp4Qmi0TwGCPkshADsuaMORh+Z3 s01xb3u52B1un5RoOmbfUGhxznok0J/j2Xj61BrDEDA27zfxNl/X09ufsJ3cvg2f83ZrYX vbQHuXegEvWpdraXlpAJdJfnobfwd4gxZvxfqtIEGWnZKx7ASWyPoYd17VFAtBjbW+rlSq uz+kIBrODIHAibBSpUZwTDlENqZwp3Gn0cHZaE+sfM/E+kqOmObnvobL6H0YPzxN8gNx/N Xez3ZSf9HiSwn0iX+aSONIM5MA07H9ZrHohyj8TvicbXVKxNYbYExzDrSAq3Tg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776445979; a=rsa-sha256; cv=none; b=knRWkxrru0IhfhEHKQNmA9m9z51vLPMfC9GkexBV0FWvxMAddIsqIMeRXeZHWUgdpUyviY 3f7ef0YftBiUlTsSo1LuINDBdRM/bl9PjHuZMycu9S54FxRlOul+MhwChrukqnPQIVlD7U aIT+r7RS0OFsfpcd4V8GMhG1yPPP+vH/3iGIXy0yBYzQRKYLz/xk4OrSGVl257GlpOYWmS SoKzD5Q5X2YeJVNmWd2sSLNHKBiLPaY/5JelXjZ15JS6NonXrpADl6cIJNTovawJIlBFKU XpOH9/ahYA+9hdJhRovghfMxemKZS0lC4xhblp7+PjhgEnFTTY4/O9lUmYtlig== 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=1776445979; 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=DM5z1kATx2A0qLftZxlvoXEGK8C11coz9e0955iF6m0=; b=eSS2rkPmmg2jB7KZNX7l5iOY/NKlNI78Qwmi+7NhfQ3r2BbJ+8tl9Qb1iZP6X8/T5CcJhY r2tEwuSp2gl2dhRkN2/Gu9ga+A7PsGOYNJUyW2eO/gnKZZJmCe3qs4oZwY21dlIUtaH68c li9wYBtrZwgCPgk/THNl4eou7lcKGVo6R46v2J+Y3MAu2WQaQEnximsZYLcv5ET71CZUcz 5bdCgj5ugw5I1K9wlFmMUZo7kK4PXzSPJdqjwMLFsu7BIxdNojfAblLVvT8E2UXIA6Qnez DlJByvvxTYUix/viYm8zNB0lpm25+3IJ/POYPt5x20z6GY8FCZ/+la/ZYFeKJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fy1fg00nSz1331 for ; Fri, 17 Apr 2026 17:12:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33e01 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 17 Apr 2026 17:12:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: f46d75c90f5f - main - ixgbe: improve MDIO performance by reducing semaphore/IPC delays 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f46d75c90f5feb87259635134dde4da328282842 Auto-Submitted: auto-generated Date: Fri, 17 Apr 2026 17:12:58 +0000 Message-Id: <69e26a1a.33e01.49fe138@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=f46d75c90f5feb87259635134dde4da328282842 commit f46d75c90f5feb87259635134dde4da328282842 Author: Adrian Chadd AuthorDate: 2026-04-17 17:11:53 +0000 Commit: Adrian Chadd CommitDate: 2026-04-17 17:11:53 +0000 ixgbe: improve MDIO performance by reducing semaphore/IPC delays Each MDIO transfer takes 8ms, and all of that is spent in a set of DELAY() calls, which is consuming a LOT of CPU. * Change the timeout in ixgbe_hic_unlocked() - doing IPC to the on-chip firmware - to a 1uS delay and bump timeout appropriately. This seems to finish in a couple of microseconds on my local test devices. * Change the 2ms sleep in ixgbe_release_swfw_sync_X540() to 2ms for EEPROM/flash, and 10uS otherwise. 10uS seems to work fine on my local testing, but the config EEPROM doesn't read right without this extra delay. The first change shouldn't change the driver behaviour, but the latter change is more intrusive and needs some wider testing. (My guess here is that there SHOULD have been some completion check somewhere in the EEPROM/flash IO path, and these sleeps are masking them.) Locally tested: * C3558 (Denverton) w/ X553 backplane Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D50295 --- sys/dev/ixgbe/ixgbe_common.c | 4 ++-- sys/dev/ixgbe/ixgbe_x540.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index bff022585a03..9e827d2e5473 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4631,11 +4631,11 @@ s32 ixgbe_hic_unlocked(struct ixgbe_hw *hw, u32 *buffer, u32 length, /* Setting this bit tells the ARC that a new command is pending. */ IXGBE_WRITE_REG(hw, IXGBE_HICR, hicr | IXGBE_HICR_C); - for (i = 0; i < timeout; i++) { + for (i = 0; i < timeout * 1000; i++) { hicr = IXGBE_READ_REG(hw, IXGBE_HICR); if (!(hicr & IXGBE_HICR_C)) break; - msec_delay(1); + usec_delay(1); } /* For each command except "Apply Update" perform diff --git a/sys/dev/ixgbe/ixgbe_x540.c b/sys/dev/ixgbe/ixgbe_x540.c index 57cec5b52e18..561fe6f0f78a 100644 --- a/sys/dev/ixgbe/ixgbe_x540.c +++ b/sys/dev/ixgbe/ixgbe_x540.c @@ -878,7 +878,21 @@ void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask) IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw), swfw_sync); ixgbe_release_swfw_sync_semaphore(hw); - msec_delay(2); + + /* + * EEPROM / flash access requires a 2ms sleep or interacting with + * them isn't stable. However, a 2ms delay for all sync operations + * is very expensive for MDIO access. + * + * So use a 10us delay for PHY0/PHY1 MDIO and management access and + * 2ms for everything else. This keep MDIO access (eg from a switch + * driver) fast. + */ + if (mask & + (IXGBE_GSSR_PHY0_SM | IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_SW_MNG_SM)) + usec_delay(10); + else + usec_delay(2000); } /**