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 D71DA4568D; Tue, 23 Jul 2024 08:14:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FFFE402D3; Tue, 23 Jul 2024 08:14:28 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTP id 2BEDB40289 for ; Tue, 23 Jul 2024 08:05: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=1721714755; x=1753250755; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=1O4/o/xSJ1Yrr3FS7SIx6jmgVsRxoorfJrjRrFm4+dw=; b=FHJp3SDskAR5030o9cOh63y3Z5Ed1aFZ08c1ms5w50R0NxLF0NxSigDG RoB1vkaD82/eGJKTUu59ZpauHCqjttGzp9KdG9vM/7xQmJ3GkCkmknQ4z 3/uGnPZ30UUcT282EQrBUVOPF5BpnydrjfEUYZ/asEQa/4cXE5jVB32Wm CTpIZUSqxlSoChdYZLqO98b6n+G1RlBS7AzO6OWVwxOLpBd1kXCSts88x cHe8AnT6SYCShO9WAph6du04V3dEjIc+hEigTSHRHN9iH7Nj4p6ARij3Z RGOthlTeRg6ROvMjP0vkydIiXg7L5PFE3NZDm0viHcu69tjchcv4Z2DiL g==; X-CSE-ConnectionGUID: Di1Doxl7Swe26vrn8/QhBQ== X-CSE-MsgGUID: VMjxrdx3SWGgAKeCkqRvaw== X-IronPort-AV: E=McAfee;i="6700,10204,11141"; a="12660875" X-IronPort-AV: E=Sophos;i="6.09,230,1716274800"; d="scan'208";a="12660875" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 23:05:53 -0700 X-CSE-ConnectionGUID: ORH/1GTFQLKOyS/gpZjVIQ== X-CSE-MsgGUID: vpGbIkEKSkegJYxT5Np1WQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,230,1716274800"; d="scan'208";a="56950549" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 23:05:51 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: Zhichao Zeng Subject: [PATCH] net/ice/base: add retries for reading NVM Date: Tue, 23 Jul 2024 14:19:15 +0800 Message-Id: <20240723061915.249540-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 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 Reading NVM fails in some scenarios, so synchronize with the share code in the kernel driver to add retries for reading NVM. Signed-off-by: Zhichao Zeng --- drivers/net/ice/base/ice_nvm.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c index 528489929e..2bfc608a8e 100644 --- a/drivers/net/ice/base/ice_nvm.c +++ b/drivers/net/ice/base/ice_nvm.c @@ -71,6 +71,7 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, { u32 inlen = *length; u32 bytes_read = 0; + int retry_cnt = 0; bool last_cmd; int status; @@ -106,11 +107,24 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, offset, (u16)read_size, data + bytes_read, last_cmd, read_shadow_ram, NULL); - if (status) - break; - - bytes_read += read_size; - offset += read_size; + if (status) { + if (hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY || + retry_cnt > ICE_SQ_SEND_MAX_EXECUTE) + break; + ice_debug(hw, ICE_DBG_NVM, + "NVM read EBUSY error, retry %d\n", + retry_cnt + 1); + ice_release_nvm(hw); + msleep(ICE_SQ_SEND_DELAY_TIME_MS); + status = ice_acquire_nvm(hw, ICE_RES_READ); + if (status) + break; + retry_cnt++; + } else { + bytes_read += read_size; + offset += read_size; + retry_cnt = 0; + } } while (!last_cmd); *length = bytes_read; -- 2.34.1