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 7D72BA0352; Tue, 25 Jan 2022 13:19:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F03C429B4; Tue, 25 Jan 2022 13:19:41 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2058.outbound.protection.outlook.com [40.107.100.58]) by mails.dpdk.org (Postfix) with ESMTP id 12FCB429B4 for ; Tue, 25 Jan 2022 13:19:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kzdf2dlKuRfEMJrLteevD2k6UVHh/BcwvN6X5fGjz12oivTvjQljE16lCWwmvrKHwKs8rOVWPecVpxnfdrrhL+NC7qoNQaEomn9+YlYS80bd+1OuicwQtfFWfIAsNDE14czAvkfLxuP8HMQ3Ih8kfs5SM52hnj/XMVrUp6B4kVlW7WAGGrYkuwKLS+VGWVp0ffsFE8dLaGmwRMW3Fp4APUaEt8zEJEHDxNHj1xwRXHU05DJjOQEEjG5cODPkNP7fE96KaxnEC/CKizqJyvWMFjqJuPPP2q7/obPgmEM4p3Y47E+l5tt7rp9NNJpJxf8nhQipn64GpDwSblD7MdiTtA== 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=v1CNl3WLC8XSbjp2mn4nAAmUc8ocLJNe3euxZieVINE=; b=gnPHiydcXt3lenhJGrYIjOsPUiTjgFfaUwPwoqleS56LWHsAZzIskQQ9nc/FvLcAKVqDrcDxzW8zpKgHSTn9NnedNla60OG9ImvX5exC01MMFVefmRJCLX5kLaGy0qPv3N1jHdD8Wj+1KuDniJyfGk+Dlq+7k23m3trLp3ZvnNyD+XLssKBeXp9fwCDXAf3nPxAb5ZVjXoTxfjM1gLv2VTFFWlVwSA7kh4BxQGJJfFvntdXF3O6AsRFPr1VnwXfJr9d3bf9s5LNuWjbgJXNC/jljE9l6T0iRe3R99mlr5ae7zJKRMlsRTxn/JlhxoCpHuBSzavmwA3kDumWnednH+g== 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=v1CNl3WLC8XSbjp2mn4nAAmUc8ocLJNe3euxZieVINE=; b=CmY5vNEsMZ2VOIScLXIgpOaZAn3GbVqQ068TIUvTCd4soYVybx64C65W4kr51Vdfs2d+jVdiWsWUOtJUjOHClLGC6xyJ+LvazMSKl6EIdY3H7SMaLLyvfWQJz5KrcGiMo6d+aVO/PaxrRUyiq1KZ7I1UYm1Ii0rn/2tEEOGhiLs= Received: from BN6PR21CA0013.namprd21.prod.outlook.com (2603:10b6:404:8e::23) by DM5PR1201MB0011.namprd12.prod.outlook.com (2603:10b6:3:e4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 12:19:37 +0000 Received: from BN8NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:404:8e:cafe::f7) by BN6PR21CA0013.outlook.office365.com (2603:10b6:404:8e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.4 via Frontend Transport; Tue, 25 Jan 2022 12:19:36 +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 BN8NAM11FT028.mail.protection.outlook.com (10.13.176.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.7 via Frontend Transport; Tue, 25 Jan 2022 12:19: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.18; Tue, 25 Jan 2022 06:19:35 -0600 From: To: Subject: [PATCH v2 4/6] net/axgbe: reset PHY Rx when mailbox command timeout Date: Tue, 25 Jan 2022 17:47:45 +0530 Message-ID: <20220125121747.344631-5-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220125121747.344631-1-ssebasti@amd.com> References: <20220125121747.344631-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: 41792b91-b65f-4c00-bef1-08d9dffcf3f3 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0011: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: n2fKDfL6De8Geouh44Wx0SpDswgNNqJGSDz4COhplyV3cRlgg/07oj3DJ6ZDJBqLc2JE+KJjEDLQFlPmpLkIsPZ6uysoUriUmijTuJjBPrUzMORIkDSfOITjJTIzBLxoBMFfRdA5wflCW8mXLjrzSGHPvR939foiiiyWHn0MGbbTbf7Q3FShOYJm2TVbzus1Sa9avBc7vnQW2MIIdSVAEyOq2JrGV86O9Z0BGML9w192bNL0aqmREQ5by3J7nasyFdZpZEMxF0I2NDVgNZAXyVIVAybNEwRcALpowSB0GdIlXNfdEtj8SPmjsD85T3ypaZTYt5cQ+ghM3h2RCZSH/cLTEkj8Tl+4qBTSdBPn+FTvLI4LMoNGknZqLNqgXi9vV6495lCARER4O5Es0aHDHL67pHizu4+VpdMY2CFeAhDRlGMkFM6GcsMtmQLNi4UKhcaM7yocLOBn7tS7WVcbTjcLXXRwD/QE/oBknVJWwLjX72zjDDp6uw6sE2FZq/M4Ir0iAjZLMaTO+0+j7mg8Oqmhv3hH5j/+9uuvOYmVv+BdWM34AlE8xmk1numwjetRwxLvQI3WHGLvKXsiWKV48pqVhRhcnkGeMeHepBwqdyZZk1HvjI0cuE17Vlcy3D2s3NPn2HnxRuSnQO99raEIkcrsX/uQgiu94iIvfizF8Mf7oCeeU1rTwEAKBj28J/LdrudbNlRD8UlQxRoJ6YNheEkEmG9yhBlNgkjPiGL6LrSRu24/m2e8q3pTjl2dIOYRGjnPelj7zXSRLtWSc2Iajg49kEK0EjicWDvKqFj1sKQ= 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)(46966006)(36840700001)(40470700004)(81166007)(316002)(426003)(2906002)(26005)(5660300002)(508600001)(36756003)(83380400001)(186003)(82310400004)(2876002)(70586007)(7696005)(16526019)(47076005)(336012)(36860700001)(6666004)(8676002)(40460700003)(2616005)(15650500001)(6916009)(70206006)(1076003)(356005)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 12:19:36.6913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41792b91-b65f-4c00-bef1-08d9dffcf3f3 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: BN8NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0011 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 2ed94868b8..eefb03e94e 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