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 12778A09E9; Tue, 15 Dec 2020 07:05:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BD4ECA2C; Tue, 15 Dec 2020 07:01:50 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 43F5CC9FA for ; Tue, 15 Dec 2020 07:01:45 +0100 (CET) IronPort-SDR: SYKEcWFFgACX7QbMbz9jA8NpS/wxJvj3FOn2AUZDHMu6LhMkUbwvuNboYPQmZAOW2omoXTetpL fYE3zDuYZUPQ== X-IronPort-AV: E=McAfee;i="6000,8403,9835"; a="193200261" X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="193200261" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 22:01:44 -0800 IronPort-SDR: +eH4u8uVqYUZElFzxGlyZ9SzQvAYS9Mu6DeyxHfe6t4PAh5ZvHvwXMo+HC/0RQfobF8tL0kDhJ JfzZNTDE/0Qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="351723508" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by orsmga002.jf.intel.com with ESMTP; 14 Dec 2020 22:01:43 -0800 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, Qi Zhang , Milena Olech Date: Tue, 15 Dec 2020 14:05:04 +0800 Message-Id: <20201215060519.302145-13-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215060519.302145-1-qi.z.zhang@intel.com> References: <20201215060519.302145-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 12/27] net/ice/base: add function for NVM checksum verification 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" AQ 0x0706 lets user to verify and recalculate NVM checksum. The usage depends on command flags. Signed-off-by: Milena Olech Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_nvm.c | 28 ++++++++++++++++++++++++++++ drivers/net/ice/base/ice_nvm.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c index c807ce9ebc..45310bfc6b 100644 --- a/drivers/net/ice/base/ice_nvm.c +++ b/drivers/net/ice/base/ice_nvm.c @@ -1077,6 +1077,34 @@ enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw) return status; } +/** + * ice_nvm_recalculate_checksum + * @hw: pointer to the HW struct + * + * Recalculate NVM PFA checksum (0x0706) + */ +enum ice_status ice_nvm_recalculate_checksum(struct ice_hw *hw) +{ + struct ice_aqc_nvm_checksum *cmd; + struct ice_aq_desc desc; + enum ice_status status; + + status = ice_acquire_nvm(hw, ICE_RES_READ); + if (status) + return status; + + cmd = &desc.params.nvm_checksum; + + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_checksum); + cmd->flags = ICE_AQC_NVM_CHECKSUM_RECALC; + + status = ice_aq_send_cmd(hw, &desc, NULL, 0, NULL); + + ice_release_nvm(hw); + + return status; +} + /** * ice_nvm_access_get_features - Return the NVM access features structure * @cmd: NVM access command to process diff --git a/drivers/net/ice/base/ice_nvm.h b/drivers/net/ice/base/ice_nvm.h index 52f79ca5c9..48b71950e9 100644 --- a/drivers/net/ice/base/ice_nvm.h +++ b/drivers/net/ice/base/ice_nvm.h @@ -119,4 +119,5 @@ enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data); enum ice_status ice_read_sr_buf(struct ice_hw *hw, u16 offset, u16 *words, u16 *data); enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw); +enum ice_status ice_nvm_recalculate_checksum(struct ice_hw *hw); #endif /* _ICE_NVM_H_ */ -- 2.26.2