From patchwork Fri May 3 13:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 139846 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7815A43F76; Fri, 3 May 2024 16:00:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4902C40E8A; Fri, 3 May 2024 15:58:58 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by mails.dpdk.org (Postfix) with ESMTP id 9FCE440E36 for ; Fri, 3 May 2024 15:58:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714744736; x=1746280736; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LXqj1lecBQynbyFGcuN9RQ1OZuHQzV0mtwblDvPYCpE=; b=O2khbIdqi3lCjNrGuF+s4u5h6f2mgmP4IpdcctDqvSjcK1AUFRGqPZs6 oXOCHhKjvych0OyCMBRUelDhdQ65Gqp3dBQBktnjTwQ6yZ/twachMyz6k FW7enJUXYjnIgQWuSeA01s5XRxveyKg+JE21YhlR0i8fgb4sz0hujT1+T d/h9C0eboqsgfTdOns6l5Gpw0+ngeSwLaqWe8toAMymxQ7VkvFjHghsqy BO5bZIAoSMyFKsdsWIrfqYAxjOHsud89AE/ASniwXRcYU6tN6H2grf74l s+m2q/VoVTkeM76HjQr+82k843/4RuGWTUjTWoMDCWsW2TdlcQmUlorkC w==; X-CSE-ConnectionGUID: 0c5wTlYlSmKQ7WsuQHb+QQ== X-CSE-MsgGUID: zacCMXW0THC6JgJL9oJYZA== X-IronPort-AV: E=McAfee;i="6600,9927,11063"; a="10714961" X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="10714961" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 06:58:56 -0700 X-CSE-ConnectionGUID: 1l9q6+thTSy1F/dfDJO0FQ== X-CSE-MsgGUID: gKOnfA4ETny3NVTu+k4vhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="50642037" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa002.fm.intel.com with ESMTP; 03 May 2024 06:58:55 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Barbara Skobiej , bruce.richardson@intel.com, vladimir.medvedkin@intel.com Subject: [PATCH v2 18/27] net/ixgbe/base: improve SWFW semaphore acquisition Date: Fri, 3 May 2024 14:57:49 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Barbara Skobiej HWSW semaphore acquisition in Atom C3000 NIC is a two stage process. Each time two semaphore acquisitions are required. Each second semaphore failure require re-acquisition of first semaphore. This patch decouples the two acquisitions preventing potentially hundreds of thousands of unnecessary loop iterations. Signed-off-by: Barbara Skobiej --- drivers/net/ixgbe/base/ixgbe_x550.c | 41 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index 29055a818a..74c2563dd5 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -4211,36 +4211,39 @@ STATIC s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask) DEBUGFUNC("ixgbe_acquire_swfw_sync_X550a"); + status = IXGBE_SUCCESS; + if (hmask) + status = ixgbe_acquire_swfw_sync_X540(hw, hmask); + + if (status) { + DEBUGOUT1("Could not acquire SWFW semaphore, Status = %d\n", status); + return status; + } + + if (!(mask & IXGBE_GSSR_TOKEN_SM)) + return IXGBE_SUCCESS; + while (--retries) { - status = IXGBE_SUCCESS; - if (hmask) - status = ixgbe_acquire_swfw_sync_X540(hw, hmask); - if (status) { - DEBUGOUT1("Could not acquire SWFW semaphore, Status = %d\n", - status); - return status; - } - if (!(mask & IXGBE_GSSR_TOKEN_SM)) - return IXGBE_SUCCESS; - status = ixgbe_get_phy_token(hw); - if (status == IXGBE_ERR_TOKEN_RETRY) - DEBUGOUT1("Could not acquire PHY token, Status = %d\n", - status); if (status == IXGBE_SUCCESS) return IXGBE_SUCCESS; - if (hmask) - ixgbe_release_swfw_sync_X540(hw, hmask); - if (status != IXGBE_ERR_TOKEN_RETRY) { - DEBUGOUT1("Unable to retry acquiring the PHY token, Status = %d\n", - status); + DEBUGOUT1("Retry acquiring the PHY token failed, Status = %d\n", status); + if (hmask) + ixgbe_release_swfw_sync_X540(hw, hmask); return status; } + + if (status == IXGBE_ERR_TOKEN_RETRY) + DEBUGOUT1("Could not acquire PHY token, Status = %d\n", + status); } + if (hmask) + ixgbe_release_swfw_sync_X540(hw, hmask); + DEBUGOUT1("Semaphore acquisition retries failed!: PHY ID = 0x%08X\n", hw->phy.id); return status;