From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0E974410E; Thu, 30 May 2024 13:16:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB44F427E1; Thu, 30 May 2024 13:15:04 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 7AD4B40EDC for ; Thu, 30 May 2024 13:14: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=1717067697; x=1748603697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LXqj1lecBQynbyFGcuN9RQ1OZuHQzV0mtwblDvPYCpE=; b=NBZ4AAewN5Gd+DWllzqFVeclB2w5PBF/W0WrOD9UsrC+S5V4tCJhsbFm BknBWsuLny+PPdeuqSfel502pBN3fK1sRVR88ZyJnKXJ5sbrCtknGLHWU bWpaPvadd9cnATulARLyM8MQr9GNanlDD5lKX06gg01EbRuoo35k4t2Be YQAlzk5UoanaElvTyBatACZb/njfygkxT2vRNE1FXM+8chJDp4eqnSpol 2enGgpdrWsnaiCm9oJ1Ws/HrtafwWklB9JGAVXPEM1O2/gVV+2aCT99Nf 9od6PfeaDaMU9iH1hRHazCduRO2QUjhL7/mv44VEMwRwysZkkKBIfNPhI A==; X-CSE-ConnectionGUID: xPIP3VaXQcSQRazdd1807g== X-CSE-MsgGUID: B3sxVv13R4uOV0cAPvvtxg== X-IronPort-AV: E=McAfee;i="6600,9927,11087"; a="36063874" X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="36063874" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 04:14:56 -0700 X-CSE-ConnectionGUID: Z+JyUmK5RySwxueBPEa8eg== X-CSE-MsgGUID: fDENXRdlRFCkVZSLJLMwXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="36419444" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa007.jf.intel.com with ESMTP; 30 May 2024 04:14:55 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Barbara Skobiej , vladimir.medvedkin@intel.com, bruce.richardson@intel.com Subject: [PATCH v3 17/30] net/ixgbe/base: improve SWFW semaphore acquisition Date: Thu, 30 May 2024 12:13:50 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; -- 2.43.0