DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
@ 2019-03-18  5:50 Leyi Rong
  2019-03-18  5:50 ` Leyi Rong
  2019-03-20  1:53 ` Zhang, Qi Z
  0 siblings, 2 replies; 4+ messages in thread
From: Leyi Rong @ 2019-03-18  5:50 UTC (permalink / raw)
  To: wenzhuo.lu, qiming.yang; +Cc: dev, Leyi Rong

Replace ice_read_sr_word with ice_read_sr_buf in ice_get_eeprom.

Fixes: d0dd1c8e1997 ("net/ice: support EEPROM information getting")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63ae5..cdb5502d1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2814,26 +2814,26 @@ ice_get_eeprom(struct rte_eth_dev *dev,
 {
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t *data = eeprom->data;
-	uint16_t offset, length, i;
-	enum ice_status ret_code = ICE_SUCCESS;
+	uint16_t first_word, last_word, nwords;
+	enum ice_status status = ICE_SUCCESS;
 
-	offset = eeprom->offset >> 1;
-	length = eeprom->length >> 1;
+	first_word = eeprom->offset >> 1;
+	last_word = (eeprom->offset + eeprom->length - 1) >> 1;
+	nwords = last_word - first_word + 1;
 
-	if (offset > hw->nvm.sr_words ||
-	    offset + length > hw->nvm.sr_words) {
+	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;
 	}
 
 	eeprom->magic = hw->vendor_id | (hw->device_id << 16);
 
-	for (i = 0; i < length; i++) {
-		ret_code = ice_read_sr_word(hw, offset + i, &data[i]);
-		if (ret_code != ICE_SUCCESS) {
-			PMD_DRV_LOG(ERR, "EEPROM read failed.");
-			return -EIO;
-		}
+	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;
 	}
 
 	return 0;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
  2019-03-18  5:50 [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM Leyi Rong
@ 2019-03-18  5:50 ` Leyi Rong
  2019-03-20  1:53 ` Zhang, Qi Z
  1 sibling, 0 replies; 4+ messages in thread
From: Leyi Rong @ 2019-03-18  5:50 UTC (permalink / raw)
  To: wenzhuo.lu, qiming.yang; +Cc: dev, Leyi Rong

Replace ice_read_sr_word with ice_read_sr_buf in ice_get_eeprom.

Fixes: d0dd1c8e1997 ("net/ice: support EEPROM information getting")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63ae5..cdb5502d1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2814,26 +2814,26 @@ ice_get_eeprom(struct rte_eth_dev *dev,
 {
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t *data = eeprom->data;
-	uint16_t offset, length, i;
-	enum ice_status ret_code = ICE_SUCCESS;
+	uint16_t first_word, last_word, nwords;
+	enum ice_status status = ICE_SUCCESS;
 
-	offset = eeprom->offset >> 1;
-	length = eeprom->length >> 1;
+	first_word = eeprom->offset >> 1;
+	last_word = (eeprom->offset + eeprom->length - 1) >> 1;
+	nwords = last_word - first_word + 1;
 
-	if (offset > hw->nvm.sr_words ||
-	    offset + length > hw->nvm.sr_words) {
+	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;
 	}
 
 	eeprom->magic = hw->vendor_id | (hw->device_id << 16);
 
-	for (i = 0; i < length; i++) {
-		ret_code = ice_read_sr_word(hw, offset + i, &data[i]);
-		if (ret_code != ICE_SUCCESS) {
-			PMD_DRV_LOG(ERR, "EEPROM read failed.");
-			return -EIO;
-		}
+	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;
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
  2019-03-18  5:50 [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM Leyi Rong
  2019-03-18  5:50 ` Leyi Rong
@ 2019-03-20  1:53 ` Zhang, Qi Z
  2019-03-20  1:53   ` Zhang, Qi Z
  1 sibling, 1 reply; 4+ messages in thread
From: Zhang, Qi Z @ 2019-03-20  1:53 UTC (permalink / raw)
  To: Rong, Leyi, Lu, Wenzhuo, Yang, Qiming; +Cc: dev, Rong, Leyi



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Leyi Rong
> Sent: Monday, March 18, 2019 1:51 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Rong, Leyi <leyi.rong@intel.com>
> Subject: [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
> 
> Replace ice_read_sr_word with ice_read_sr_buf in ice_get_eeprom.
> 
> Fixes: d0dd1c8e1997 ("net/ice: support EEPROM information getting")
> 
> Signed-off-by: Leyi Rong <leyi.rong@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
  2019-03-20  1:53 ` Zhang, Qi Z
@ 2019-03-20  1:53   ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2019-03-20  1:53 UTC (permalink / raw)
  To: Rong, Leyi, Lu, Wenzhuo, Yang, Qiming; +Cc: dev, Rong, Leyi



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Leyi Rong
> Sent: Monday, March 18, 2019 1:51 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Rong, Leyi <leyi.rong@intel.com>
> Subject: [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM
> 
> Replace ice_read_sr_word with ice_read_sr_buf in ice_get_eeprom.
> 
> Fixes: d0dd1c8e1997 ("net/ice: support EEPROM information getting")
> 
> Signed-off-by: Leyi Rong <leyi.rong@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-20  1:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-18  5:50 [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM Leyi Rong
2019-03-18  5:50 ` Leyi Rong
2019-03-20  1:53 ` Zhang, Qi Z
2019-03-20  1:53   ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).