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 B2742A0567 for ; Wed, 10 Mar 2021 10:20:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A90D040687; Wed, 10 Mar 2021 10:20:23 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 35AA340687 for ; Wed, 10 Mar 2021 10:20:21 +0100 (CET) IronPort-SDR: yI9hDsZDM11e2sIfrjDqr7pmgyQJB+pyXA2xKaSpUl+LEoN99ZqdXFk4E66IaZ89+fMY9ppa6w qvpkQH2a1dcA== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="249792939" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="249792939" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 01:20:20 -0800 IronPort-SDR: YupoFcg7jxvzDZoPF8TjaLVR6TyqiqEet09bfPeVW7Cr0Sh/VeDgNmavRrbo7hu16ERvuJxQJj bhOyUsGClYLg== X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="603008574" Received: from unknown (HELO intel-npg-odc-srv02.cd.intel.com) ([10.240.178.186]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 01:20:18 -0800 From: Murphy Yang To: stable@dpdk.org Cc: Murphy Yang , Shougang Wang Date: Wed, 10 Mar 2021 09:13:27 +0000 Message-Id: <20210310091327.86253-1-murphyx.yang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH 19.11] net/ice: fix incorrect EEPROM data X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 01186263c2c79b9a22d3f3b1eeec844c6552fdc7 ] Kernel driver reads EEPROM data from flash but DPDK reads from shadow ram. This patch fixes the issue by changing method to get EEPROM data from flash. Fixes: 68a1ab82ad74 ("net/ice: speed up to retrieve EEPROM") Cc: stable@dpdk.org Signed-off-by: Shougang Wang --- drivers/net/ice/ice_ethdev.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index c2e659303c..efb2d67d54 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3984,8 +3984,7 @@ ice_get_eeprom_length(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - /* Convert word count to byte count */ - return hw->nvm.sr_words << 1; + return hw->nvm.flash_size; } static int @@ -3993,26 +3992,24 @@ ice_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint16_t *data = eeprom->data; - uint16_t first_word, last_word, nwords; enum ice_status status = ICE_SUCCESS; + uint8_t *data = eeprom->data; - first_word = eeprom->offset >> 1; - last_word = (eeprom->offset + eeprom->length - 1) >> 1; - nwords = last_word - first_word + 1; + eeprom->magic = hw->vendor_id | (hw->device_id << 16); - if (first_word >= hw->nvm.sr_words || - last_word >= hw->nvm.sr_words) { - PMD_DRV_LOG(ERR, "Requested EEPROM bytes out of range."); - return -EINVAL; + status = ice_acquire_nvm(hw, ICE_RES_READ); + if (status) { + PMD_DRV_LOG(ERR, "acquire nvm failed."); + return -EIO; } - eeprom->magic = hw->vendor_id | (hw->device_id << 16); + status = ice_read_flat_nvm(hw, eeprom->offset, &eeprom->length, + data, false); + + ice_release_nvm(hw); - status = ice_read_sr_buf(hw, first_word, &nwords, data); if (status) { PMD_DRV_LOG(ERR, "EEPROM read failed."); - eeprom->length = sizeof(uint16_t) * nwords; return -EIO; } -- 2.17.1