patches for DPDK stable branches
 help / color / Atom feed
From: "Jiang, YuX" <yux.jiang@intel.com>
To: "Wang, ShougangX" <shougangx.wang@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Xing, Beilei" <beilei.xing@intel.com>,
	"Yang, Qiming" <qiming.yang@intel.com>,
	"Wang, ShougangX" <shougangx.wang@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] net/ice: fix incorrect EEPROM data
Date: Wed, 1 Jul 2020 02:46:53 +0000
Message-ID: <80b49baa5cfe4629a09f2be643bcfdb3@intel.com> (raw)
In-Reply-To: <20200628033736.156247-1-shougangx.wang@intel.com>

Tested-by: Jiang, YuX <yux.jiang@intel.com>

-----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 <beilei.xing@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Wang, ShougangX <shougangx.wang@intel.com>; 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 <shougangx.wang@intel.com>
---
 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


      parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  7:13 [dpdk-stable] [PATCH] " Shougang Wang
2020-05-08  7:20 ` Yang, Qiming
2020-06-28  3:37 ` [dpdk-stable] [PATCH v2] " Shougang Wang
2020-06-30 14:23   ` [dpdk-stable] [dpdk-dev] " Zhang, Qi Z
2020-07-01  2:46   ` Jiang, YuX [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80b49baa5cfe4629a09f2be643bcfdb3@intel.com \
    --to=yux.jiang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=qiming.yang@intel.com \
    --cc=shougangx.wang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox