From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 713E4A00E6 for ; Mon, 18 Mar 2019 06:51:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 63A421DBD; Mon, 18 Mar 2019 06:51:38 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A66C5201 for ; Mon, 18 Mar 2019 06:51:36 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Mar 2019 22:51:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,492,1544515200"; d="scan'208";a="141575935" Received: from lrong-srv-01.sh.intel.com ([10.67.110.227]) by FMSMGA003.fm.intel.com with ESMTP; 17 Mar 2019 22:51:33 -0700 From: Leyi Rong To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Mon, 18 Mar 2019 13:50:39 +0800 Message-Id: <20190318055039.13380-1-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/ice: speed up to retrieve EEPROM 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190318055039.7jbyEdP_jfrVippvAmF4jEffKOnoKmjGARguwMCkjk8@z> 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 --- 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