From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1D8C39AA2 for ; Thu, 12 Feb 2015 13:01:39 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 12 Feb 2015 03:57:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,565,1418112000"; d="scan'208";a="684723862" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 12 Feb 2015 04:01:38 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1CC1Zho006908; Thu, 12 Feb 2015 20:01:35 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1CC1VLn030508; Thu, 12 Feb 2015 20:01:33 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1CC1VSo030504; Thu, 12 Feb 2015 20:01:31 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Thu, 12 Feb 2015 20:00:42 +0800 Message-Id: <1423742468-30404-11-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1423742468-30404-1-git-send-email-changchun.ouyang@intel.com> References: <1423742468-30404-1-git-send-email-changchun.ouyang@intel.com> Subject: [dpdk-dev] [PATCH 10/36] ixgbe base codes: Get host interface command status X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 12:01:40 -0000 Add new function ixgbe_get_hi_status to get host interface command status. Signed-off-by: Changchun Ouyang --- lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c | 30 ++++++++++++++++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h | 1 + 2 files changed, 31 insertions(+) diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c index f0e35f4..d8d2ea3 100644 --- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c +++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c @@ -4341,6 +4341,36 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32 length) } /** + * ixgbe_get_hi_status - Get host interface command status + * @hw: pointer to the HW structure + * @return_code: reads and returns code + * + * Check if command returned with success. On success return IXGBE_SUCCESS + * else return IXGBE_ERR_HOST_INTERFACE_COMMAND. + **/ +s32 ixgbe_get_hi_status(struct ixgbe_hw *hw, u8 *ret_status) +{ + struct ixgbe_hic_hdr response; + u32 *response_val = (u32 *)&response; + + DEBUGFUNC("ixgbe_get_host_interface_status"); + + /* Read the command response */ + *response_val = IXGBE_CPU_TO_LE32(IXGBE_READ_REG(hw, IXGBE_FLEX_MNG)); + + if (ret_status) + *ret_status = response.cmd_or_resp.ret_status; + + if (response.cmd_or_resp.ret_status != FW_CEM_RESP_STATUS_SUCCESS) { + DEBUGOUT1("Host interface error=%x.\n", + response.cmd_or_resp.ret_status); + return IXGBE_ERR_HOST_INTERFACE_COMMAND; + } + + return IXGBE_SUCCESS; +} + +/** * ixgbe_host_interface_command - Issue command to manageability block * @hw: pointer to the HW structure * @buffer: contains the command to write and where the return status will diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h index f2418f3..c2e28f2 100644 --- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h +++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h @@ -155,6 +155,7 @@ void ixgbe_enable_relaxed_ordering_gen2(struct ixgbe_hw *hw); s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build, u8 ver); u8 ixgbe_calculate_checksum(u8 *buffer, u32 length); +s32 ixgbe_get_hi_status(struct ixgbe_hw *hw, u8 *ret_status); s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, u32 length, bool return_data); -- 1.8.4.2