From patchwork Mon Dec 2 07:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 63469 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C92AEA04B5; Mon, 2 Dec 2019 09:04:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 578541C07F; Mon, 2 Dec 2019 08:59:00 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 622F31C02A for ; Mon, 2 Dec 2019 08:58:48 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2019 23:58:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,268,1571727600"; d="scan'208";a="207993579" Received: from dpdk_yexl_af_xdp.sh.intel.com ([10.67.119.186]) by fmsmga008.fm.intel.com with ESMTP; 01 Dec 2019 23:58:47 -0800 From: Xiaolong Ye To: Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Xiaolong Ye , Jeff Kirsher Date: Mon, 2 Dec 2019 15:49:07 +0800 Message-Id: <20191202074935.97629-42-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191202074935.97629-1-xiaolong.ye@intel.com> References: <20191202074935.97629-1-xiaolong.ye@intel.com> Subject: [dpdk-dev] [PATCH 41/69] net/i40e/base: changeed code wrapping for CARLSVILLE_HW 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" As pointed out by Arkadiusz, the code is not wrapped properly and if CARLSVILLE_HW is not defined the code will not compile. In addition, noticed that the we were taking the if condition majority of the time so flip the condition to only test for the device that requires the workaround when updating stats. Signed-off-by: Jeff Kirsher Reviewed-by: Paul M Stillwell Jr Reviewed-by: Aleksandr Loktionov Reviewed-by: Michael Alice Signed-off-by: Xiaolong Ye --- drivers/net/i40e/base/i40e_common.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 337d62b5f..cedec4dce 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -7173,27 +7173,30 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw, enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw, u32 *tx_counter, u32 *rx_counter) { - enum i40e_status_code retval; - u32 cmd_status; - +#ifdef CARLSVILLE_HW /* only X710-T*L requires special handling of counters * for other devices we just read the MAC registers */ - if (hw->device_id != I40E_DEV_ID_10G_BASE_T_BC) { - *tx_counter = rd32(hw, I40E_PRTPM_TLPIC); - *rx_counter = rd32(hw, I40E_PRTPM_RLPIC); - return I40E_SUCCESS; - } + if (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC) { + enum i40e_status_code retval; + u32 cmd_status; - retval = i40e_aq_run_phy_activity(hw, + retval = i40e_aq_run_phy_activity(hw, I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED, I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS, &cmd_status, tx_counter, rx_counter, NULL); - if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS) - retval = I40E_ERR_ADMIN_QUEUE_ERROR; + if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS) + retval = I40E_ERR_ADMIN_QUEUE_ERROR; - return retval; + return retval; + } + +#endif /* CARLSVILLE_HW */ + *tx_counter = rd32(hw, I40E_PRTPM_TLPIC); + *rx_counter = rd32(hw, I40E_PRTPM_RLPIC); + + return I40E_SUCCESS; } /**