From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 480D7A034D; Mon, 10 Jan 2022 12:36:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 605324118F; Mon, 10 Jan 2022 12:35:42 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2052.outbound.protection.outlook.com [40.107.236.52]) by mails.dpdk.org (Postfix) with ESMTP id 1458341174 for ; Mon, 10 Jan 2022 12:35:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SzVQqW80/OWRxJH+yXekDeVTbSV8ukaLZolrN6vHsr6L+vn3iKrgmXgFFpn9jVXw1iccF0n9UHfaz8+42NIFDoT/WJ/jdipuhIfGyGCFX8aLW13qdEdNJqvJKc+GiY3Dpu8OVD6noQUfOrOsOFYnlhHI8EDDwoCzg6x49vkKcUuFbXOszzK5Ryk5g+dxyk0tctls/zyNy/X7/GqXxj9eM8TrCBbBPfheUgLOgmV3sGrH2+oqpogvkE7yGny3dY8JAiZsThXWYl2ek86/29vypxiijsTW7t9+IoE9zjiULQgUqi5XANv94bhiVWmiUFtloIQ2DLX/7NLieCaN2vV5Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rtlDyAYoc5IUo+7At9rU/YkfZ9g4g7VwtW03zoa7lBA=; b=Ga+VhZhElS9nn7v4UMmPdVqOK6GkHZ+4OLV0yfRYRH0rcC/btc6e3nHswKOBlJp1gy5p7s7QLHQVHwa6TIWaJdLl1WLWkYXugWeo7H76FobMbnAY3qH1gPfUm+XeZtBD0VqJCO6Tpc8wcvgd1u0t/O9BQs5A8oKqeOPL0nPWPqW33GAlCKhHxPY0z5UQFaRfxxUcfmAREewTmTd0xivZCpqlbNJ5aeOI8hBSmL+J+EtIeh7uGRBpYD/uovymuOo6QFPVI/KbFVvOeSnZNPJTM7LBW7EVQVObzUaCagGI4zy0vrbCmNrgm4sKxnERK4RaIR3J2nb/EtWdsex8cxu3bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rtlDyAYoc5IUo+7At9rU/YkfZ9g4g7VwtW03zoa7lBA=; b=xUCHopYB+kzTeFVNveh59XIx4tMpKjXDRwPIWXAnmQ8xGOomNY2JwpT4RF4zpBpZIqqcYR5ieGTy5Wbusz/cMNRCOcwus/1SdBLCtiwfaVGE9mOj3507lXH2wSzm+2hwCojij6xRE+S6/SwqtnXUAA1kAHAYtJruQC2bpWHX/nI= Received: from CO2PR04CA0133.namprd04.prod.outlook.com (2603:10b6:104::11) by DM6PR12MB2793.namprd12.prod.outlook.com (2603:10b6:5:4f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Mon, 10 Jan 2022 11:35:37 +0000 Received: from CO1NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:104:0:cafe::dc) by CO2PR04CA0133.outlook.office365.com (2603:10b6:104::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9 via Frontend Transport; Mon, 10 Jan 2022 11:35:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT021.mail.protection.outlook.com (10.13.175.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 11:35:36 +0000 Received: from cae-Lilac-RMB.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 10 Jan 2022 05:35:35 -0600 From: To: Subject: [PATCH v1 4/6] net/axgbe: reset PHY Rx when mailbox command timeout Date: Mon, 10 Jan 2022 17:05:07 +0530 Message-ID: <20220110113509.553184-5-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220110113509.553184-1-ssebasti@amd.com> References: <20220110113509.553184-1-ssebasti@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 259d0006-2b90-4cdb-05bd-08d9d42d5273 X-MS-TrafficTypeDiagnostic: DM6PR12MB2793:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v7n/3ftlVAz2YRZkF5BdNZZsWtjAKc7pJLo/BfSZ3K0QoNZhiSaAnBv57uP8ZS+4IB3C+V/w7e1l1DuMfaAHz8kXw1++vr2GNg0yxRtN7k/5cgQ9QPSqlRRXmqJXR5LFG808kwYIOmD72DwArj5wORr22z5kSKGA+R0yA5BeK5CmqLiwENZAQtzx+2JBhADCUUIqZPk3edZPcpbZ69a4n9e9YvXAUtNv3hqZ+GLo8gm82TxbqyefmLvqYF2jrEKuVfpI63HBtD9pBKSo/4zXkCnLsC09gTRN+VEf0afWSK6jOtRSKEclRkFhWk5iaiw0qgT4o2GK5J9Tydyyk0PtL41QVL7SZVpGmA7IJNPsLGja8rPgWzN3VXNLiT65ZpUQxtBTohzI3BnSFsNoiqtt0nG0wt/W4gl4n6id9KLR7pA4d1/1YqqRUZmKyI+TE1MC+r3CHxLHCYU+ykO5loRJEAuxBIfJAYlWV59ZjfxPqoc0ezYlrohoBe2/cCfOfPLhpy9eUEfN1IpC/tt0D8C3fO4kzJ9N9bJ8uxjYHQHLGlopY9Vtugzjbjz4lnHMIV16sdLHsI0jrbc/6Kp65zs7I/HToMG9HL8EFWSVD5ExeUmojkYid/mzyR7DHyEJGOzCvIsobHsU8uB93HeB6VdrR3+zwZkJ0Qx6POlPiEGYkYn//77jXFM/HvEjOcj88KX8AqdAm/pgBFrzIUzoLn8lVwE4B1TOcti2MpTCkQfgpKqQobDZfk+r4ynhtXbKRdGFeTMODQA+ywTpz3FE7hSGd4YYxSLLGDUeRtX0nINZchQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(40470700002)(46966006)(1076003)(7696005)(82310400004)(40460700001)(426003)(2616005)(2906002)(508600001)(36756003)(336012)(2876002)(15650500001)(5660300002)(26005)(16526019)(186003)(70586007)(70206006)(316002)(81166007)(6666004)(356005)(83380400001)(8936002)(47076005)(6916009)(8676002)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2022 11:35:36.9960 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 259d0006-2b90-4cdb-05bd-08d9d42d5273 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2793 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Selwin Sebastian Sometimes mailbox commands timeout when the RX data path becomes unresponsive. This prevents the submission of new mailbox commands to DXIO. This patch identifies the timeout and resets the RX data path so that the next message can be submitted properly. Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_common.h | 14 ++++++++++++++ drivers/net/axgbe/axgbe_phy_impl.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h index 5a7ac35b6a..a5431dd998 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -1270,10 +1270,18 @@ #define MDIO_PMA_10GBR_FECCTRL 0x00ab #endif +#ifndef MDIO_PMA_RX_CTRL1 +#define MDIO_PMA_RX_CTRL1 0x8051 +#endif + #ifndef MDIO_PCS_DIG_CTRL #define MDIO_PCS_DIG_CTRL 0x8000 #endif +#ifndef MDIO_PCS_DIGITAL_STAT +#define MDIO_PCS_DIGITAL_STAT 0x8010 +#endif + #ifndef MDIO_AN_XNP #define MDIO_AN_XNP 0x0016 #endif @@ -1354,6 +1362,8 @@ #define AXGBE_KR_TRAINING_ENABLE BIT(1) #define AXGBE_PCS_CL37_BP BIT(12) +#define XGBE_PCS_PSEQ_STATE_MASK 0x1c +#define XGBE_PCS_PSEQ_STATE_POWER_GOOD 0x10 #define AXGBE_AN_CL37_INT_CMPLT BIT(0) #define AXGBE_AN_CL37_INT_MASK 0x01 @@ -1401,6 +1411,10 @@ static inline uint32_t high32_value(uint64_t addr) #define XGBE_PMA_PLL_CTRL_SET BIT(15) #define XGBE_PMA_PLL_CTRL_CLEAR 0x0000 +#define XGBE_PMA_RX_RST_0_MASK BIT(4) +#define XGBE_PMA_RX_RST_0_RESET_ON 0x10 +#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 + /*END*/ /* Bit setting and getting macros diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 0894dbf74b..e52dbb9585 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -1196,6 +1196,28 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_port *pdata) axgbe_phy_put_comm_ownership(pdata); } +static void axgbe_phy_rx_reset(struct axgbe_port *pdata) +{ + int reg; + + reg = XMDIO_READ_BITS(pdata, MDIO_MMD_PCS, MDIO_PCS_DIGITAL_STAT, + XGBE_PCS_PSEQ_STATE_MASK); + if (reg == XGBE_PCS_PSEQ_STATE_POWER_GOOD) { + /* Mailbox command timed out, reset of RX block is required. + * This can be done by asseting the reset bit and wait for + * its compeletion. + */ + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, + XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_ON); + rte_delay_us(20); + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, + XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_OFF); + rte_delay_us(45); + PMD_DRV_LOG(ERR, "firmware mailbox reset performed\n"); + } +} + + static void axgbe_phy_pll_ctrl(struct axgbe_port *pdata, bool enable) { XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, @@ -1216,8 +1238,10 @@ static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, axgbe_phy_pll_ctrl(pdata, false); /* Log if a previous command did not complete */ - if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) + if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n"); + axgbe_phy_rx_reset(pdata); + } /* Construct the command */ XP_SET_BITS(s0, XP_DRIVER_SCRATCH_0, COMMAND, cmd); @@ -1235,6 +1259,9 @@ static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, goto reenable_pll; rte_delay_us(1500); } + PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n"); + /* Reset on error */ + axgbe_phy_rx_reset(pdata); reenable_pll: /* Re-enable the PLL control */ -- 2.25.1