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 297B0A0523; Wed, 1 Jul 2020 04:47:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 80DFF1BEAC; Wed, 1 Jul 2020 04:47:01 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id EF7251BE91; Wed, 1 Jul 2020 04:46:58 +0200 (CEST) IronPort-SDR: uJLEtW8RJYZ4NyPC4jH0K6Ew+50XHr4EkYRmJ0s8SdVg4LpylwWkOTpyPJmKv9thdv1bPEr/3u 4xgRoFQ72ASA== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="147996949" X-IronPort-AV: E=Sophos;i="5.75,298,1589266800"; d="scan'208";a="147996949" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 19:46:56 -0700 IronPort-SDR: KKFbSPhveeixcqKW7c4zNgB9Pp/5rveNgY/VV4vXLnvS8tHswSoFqNOnVWpr33s1//HT+E82lq JLkym/7HLS3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,298,1589266800"; d="scan'208";a="313619503" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga002.fm.intel.com with ESMTP; 30 Jun 2020 19:46:56 -0700 Received: from shsmsx604.ccr.corp.intel.com (10.109.6.214) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 30 Jun 2020 19:46:55 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX604.ccr.corp.intel.com (10.109.6.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 1 Jul 2020 10:46:53 +0800 Received: from shsmsx605.ccr.corp.intel.com ([10.109.6.215]) by SHSMSX605.ccr.corp.intel.com ([10.109.6.215]) with mapi id 15.01.1713.004; Wed, 1 Jul 2020 10:46:53 +0800 From: "Jiang, YuX" To: "Wang, ShougangX" , "dev@dpdk.org" CC: "Xing, Beilei" , "Yang, Qiming" , "Wang, ShougangX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] net/ice: fix incorrect EEPROM data Thread-Index: AQHWTP6RMQsPumFzPkeUcJT6aMvUCqjyBRyw Date: Wed, 1 Jul 2020 02:46:53 +0000 Message-ID: <80b49baa5cfe4629a09f2be643bcfdb3@intel.com> References: <20200508071340.75836-1-shougangx.wang@intel.com> <20200628033736.156247-1-shougangx.wang@intel.com> In-Reply-To: <20200628033736.156247-1-shougangx.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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" Tested-by: Jiang, YuX -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shougang Wang Sent: Sunday, June 28, 2020 11:38 AM To: dev@dpdk.org Cc: Xing, Beilei ; Yang, Qiming ; Wang, ShougangX ; stable@dpdk.org Subject: [dpdk-dev] [PATCH v2] net/ice: fix incorrect EEPROM data 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 in= dex 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 =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); =20 - /* Convert word count to byte count */ - return hw->nvm.sr_words << 1; + return hw->nvm.flash_size; } =20 static int @@ -3965,26 +3964,24 @@ ice_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom) { struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint16_t *data =3D eeprom->data; - uint16_t first_word, last_word, nwords; enum ice_status status =3D ICE_SUCCESS; + uint8_t *data =3D eeprom->data; =20 - first_word =3D eeprom->offset >> 1; - last_word =3D (eeprom->offset + eeprom->length - 1) >> 1; - nwords =3D last_word - first_word + 1; + eeprom->magic =3D hw->vendor_id | (hw->device_id << 16); =20 - if (first_word >=3D hw->nvm.sr_words || - last_word >=3D hw->nvm.sr_words) { - PMD_DRV_LOG(ERR, "Requested EEPROM bytes out of range."); - return -EINVAL; + status =3D ice_acquire_nvm(hw, ICE_RES_READ); + if (status) { + PMD_DRV_LOG(ERR, "acquire nvm failed."); + return -EIO; } =20 - eeprom->magic =3D hw->vendor_id | (hw->device_id << 16); + status =3D ice_read_flat_nvm(hw, eeprom->offset, &eeprom->length, + data, false); + + ice_release_nvm(hw); =20 - status =3D ice_read_sr_buf(hw, first_word, &nwords, data); if (status) { PMD_DRV_LOG(ERR, "EEPROM read failed."); - eeprom->length =3D sizeof(uint16_t) * nwords; return -EIO; } =20 -- 2.17.1