From patchwork Wed Apr 24 13:21:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 139663 X-Patchwork-Delegate: bruce.richardson@intel.com 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 53A2743EAD; Wed, 24 Apr 2024 15:24:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0786434E9; Wed, 24 Apr 2024 15:22:57 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mails.dpdk.org (Postfix) with ESMTP id C9286434DC for ; Wed, 24 Apr 2024 15:22:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713964975; x=1745500975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LXqj1lecBQynbyFGcuN9RQ1OZuHQzV0mtwblDvPYCpE=; b=IZQUUQ2cOBjLT056ioKe00cVnf+4dbuq/2EXyisG0jn/iTgiYW0GIWCm 175efxMJjtcG0APc5xyXH5K4MvEyZhH42CP/KXchfgYyQFLmsFUvlYYh7 tydfj3C9ANjIEeJTcOcCpMPvDKkT9M/PYhdDnjA4KIyQCQohuQWyox6/8 5/iwtOgkWKoqy8WG8BoULIpUi58mSew+Wc0Vgo8DjKdKXtrncDXb+Kq+A mrPrQSCnVIO7h/wMEan/JaTVtjO6lDrDHAqlBpoIW6eHcW1Ix9MJ1Qin3 pfr4smrpTLNWCevFyLtV2+rCzSPjXk5Z6wga6kGaiM+0O5yHjxq2yyzIm g==; X-CSE-ConnectionGUID: gOZSxNmKQw+Uq5/fNKsD5Q== X-CSE-MsgGUID: pBAgjuLOT/KztAZ82AsKfg== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="20289287" X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="20289287" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 06:22:54 -0700 X-CSE-ConnectionGUID: yHcE0kmJSDG1rOUvysScVQ== X-CSE-MsgGUID: GUgh7SVMQ9y8o7W/xTh+vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="24749492" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa006.fm.intel.com with ESMTP; 24 Apr 2024 06:22:53 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Barbara Skobiej , vladimir.medvedkin@intel.com, bruce.richardson@intel.com Subject: [PATCH v1 18/22] net/ixgbe/base: improve SWFW semaphore acquisition Date: Wed, 24 Apr 2024 14:21:52 +0100 Message-ID: <379365e8c57822439cc77a6937c9ce315f5bc5ff.1713964708.git.anatoly.burakov@intel.com> 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;