From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0AE15A0350; Sun, 28 Jun 2020 05:45:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BBAC01C012; Sun, 28 Jun 2020 05:45:19 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0A30D1BFA1; Sun, 28 Jun 2020 05:45:16 +0200 (CEST) IronPort-SDR: TwYcTM8ug8mVFg56ExaDSaf/ByoKbO6H9/P9ci3CpIgavV/T8FsmFwZG/qLyY8kvgueRObbbMc o0IJgD0pazqA== X-IronPort-AV: E=McAfee;i="6000,8403,9665"; a="143248465" X-IronPort-AV: E=Sophos;i="5.75,290,1589266800"; d="scan'208";a="143248465" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2020 20:45:15 -0700 IronPort-SDR: fkRfMdf600SdoiPTxQ6tZaxEilj4aBQhjz/UDFmegLM6uQpNLp6EITu8bWkL3nhrUKomnui8SJ 6xwtT0KtJn5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,290,1589266800"; d="scan'208";a="294558732" Received: from intel.sh.intel.com ([10.239.255.64]) by orsmga002.jf.intel.com with ESMTP; 27 Jun 2020 20:45:14 -0700 From: Shougang Wang To: dev@dpdk.org Cc: Beilei Xing , Qiming Yang , Shougang Wang , stable@dpdk.org Date: Sun, 28 Jun 2020 03:37:36 +0000 Message-Id: <20200628033736.156247-1-shougangx.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508071340.75836-1-shougangx.wang@intel.com> References: <20200508071340.75836-1-shougangx.wang@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ice: fix incorrect EEPROM data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 5a89a1955..eaffb6578 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3956,8 +3956,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 @@ -3965,26 +3964,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