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 6DE5DA04C3; Sat, 12 Sep 2020 05:20:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D37E91C1E3; Sat, 12 Sep 2020 05:19:49 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 73C011C1D2 for ; Sat, 12 Sep 2020 05:19:37 +0200 (CEST) IronPort-SDR: eq9HT+xLNR4dG/l6mCabCmnlXb44Xrjkcn3SzxPZoSu66l0wX8XWtrbfPirlbeuLZD5sXrNzxo wcW/4Rg/u6vw== X-IronPort-AV: E=McAfee;i="6000,8403,9741"; a="158924691" X-IronPort-AV: E=Sophos;i="5.76,418,1592895600"; d="scan'208";a="158924691" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 20:19:37 -0700 IronPort-SDR: bsLLIz8mt4tvmzlO5CEqY/kyNBLnLu9zBxc8zWLAUcFSXY0cBe4YnPuXStVvH3QBAwFG7ESXGL KkP/blMhDoRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,418,1592895600"; d="scan'208";a="318465395" Received: from dpdk57.sh.intel.com (HELO localhost.localdomain) ([10.239.255.57]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2020 20:19:35 -0700 From: Guinan Sun To: dev@dpdk.org Cc: Jeff Guo , Beilei Xing , Guinan Sun , Dawid Lukwinski Date: Sat, 12 Sep 2020 03:00:37 +0000 Message-Id: <20200912030039.55273-6-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200912030039.55273-1-guinanx.sun@intel.com> References: <20200905024938.14609-1-guinanx.sun@intel.com> <20200912030039.55273-1-guinanx.sun@intel.com> Subject: [dpdk-dev] [PATCH v2 5/7] net/i40e/base: add EEE LPI status check for X722 adapters 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" Add reading LPI (low power idle) status for supported X722 devices. If adapter's PHY supports EEE in current mode (device ID + link speed), LPI status is read from PHY Clause 45 PCS status register. Signed-off-by: Dawid Lukwinski Signed-off-by: Guinan Sun --- drivers/net/i40e/base/i40e_common.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index cd8b27e40..3be944e84 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -7098,15 +7098,23 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw, struct i40e_hw_port_stats *stat) { enum i40e_status_code ret = I40E_SUCCESS; + bool eee_mrvl_phy; + bool eee_bcm_phy; u32 val; stat->rx_lpi_status = 0; stat->tx_lpi_status = 0; - if ((hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || - hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && - (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || - hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) { + eee_bcm_phy = + (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || + hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || + hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB); + eee_mrvl_phy = + hw->device_id == I40E_DEV_ID_1G_BASE_T_X722; + + if (eee_bcm_phy || eee_mrvl_phy) { + /* read Clause 45 PCS Status 1 register */ ret = i40e_aq_get_phy_register(hw, I40E_AQ_PHY_REG_ACCESS_EXTERNAL, I40E_BCM_PHY_PCS_STATUS1_PAGE, -- 2.17.1