From patchwork Fri Feb 12 18:00:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 12085851 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6E31C433E6 for ; Fri, 12 Feb 2021 18:02:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 745CB64DA5 for ; Fri, 12 Feb 2021 18:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbhBLSC0 (ORCPT ); Fri, 12 Feb 2021 13:02:26 -0500 Received: from mail-co1nam11on2068.outbound.protection.outlook.com ([40.107.220.68]:1697 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231590AbhBLSCS (ORCPT ); Fri, 12 Feb 2021 13:02:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UJEWvJLcrDi4fmb2I+zeoDTWeuBM7BLS+CQGQHqL/0HRoqSMB0EVGrjYDUZnt+gaoQ0Q0bKti0EIRfcJPLVyaEu2jsCpZtbfaGCzs8GoEPnhVXC87lJ22zLaitpWMaYBrQ2nhq9WknaEtu2Od+o410rLD8q3baBhU2BjlspPVfi7Bt+UbJo0YS1976Hr5MOAZt8xnt99KXPWvHX4lWm/I7tHJuw1EN92XPtMThZ2/9l6uuQ66Iky+zOb2wAxtDnV0nl+v2VJJ6/P6h0qdXO5hnJJQCaTRBbPEIFvNbz6NUa+lyzo88HflXeLvvZgNhCiNcGTRUvc/MjEsQg9Wyvf3Q== 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-SenderADCheck; bh=vdcj9sjByJulyGiDN0AdJ4wKQMhaXHMtTM6QLGMpsVg=; b=XceoEDIR59liZuFvU3wI8g53wiIhbfHnr+c8wuDAFjYyeYOGdKBf/Tr2iwCRvq7HowubO+zWF4BBK1hWbzNh3MYzdlh8ay/IXVt+GKI9ey6uOFcYvKcG11QE0gfFLlSRkj272Cu+kQpo5HdgZva2ZyIgjFXEffd35Z4wmqJNlhRNmLnYtEeyaG3PKZm3t9bsTw6M8f1V1SEyRvN55OQ2lfoN+WaiG3S69M/OAogNmcXSRqpT98GVYzVPuWgznmgy/1lhDU/yeOait6VQSd8benKIUhAQ/22hE5bnZark134donjhpRQjnKD/lOx4FdNqVMgPTVrmBBybckvIGCnbtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=vdcj9sjByJulyGiDN0AdJ4wKQMhaXHMtTM6QLGMpsVg=; b=Au3emJT9H7GU8dz4M230V0tBxAmRwl//w7khJrecccpzfFVZQ5A07qe6H1lwpIJ1z5ZjZ8WYBNCSNVyjHL7ZeLpjQ4Au6TswyJM4Ofy/6XNmKrOQOwRXEkLvhIjvfW8ADleTIVkbEoi+S/he3CDHg2oIE6o1dwMLdF7WlvWkrUs= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) by SN1PR12MB2399.namprd12.prod.outlook.com (2603:10b6:802:2b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Fri, 12 Feb 2021 18:00:47 +0000 Received: from SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451]) by SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451%3]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 18:00:47 +0000 From: Shyam Sundar S K To: Tom Lendacky , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Sudheesh.Mavila@amd.com, Shyam Sundar S K , Sudheesh Mavila Subject: [PATCH 1/4] amd-xgbe: Reset the PHY rx data path when mailbox command timeout Date: Fri, 12 Feb 2021 23:30:07 +0530 Message-Id: <20210212180010.221129-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> References: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) To SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 18:00:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: afefe9b9-511a-40a4-7d5c-08d8cf802008 X-MS-TrafficTypeDiagnostic: SN1PR12MB2399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2ahhaJVsypYDPv6Dc4d9NXLX5VaIrbYMSmTL5xYcFywahNBVGIW9i6lXj2WfB3zWmnhN7uUsxTQSruBrzLYzc4A704bvqqpt8lbFc416M0vyCAyDxM8ScZ+dpoZ5ch10e6w4zBrStjZDcyvFTwSlD1s1YvtJejix1ch1/JtLneRe3aiUupH01iP6ZcpoGZ19xF6wmQLvKhSOU2jTgiHThY9AwI4pTqkJiiaLK/ti+lX9Pz6gu+Xu34G2prTVqeiP35aNCdgB9fRLMDQWnpMUAOAmR4X11flwdmuaxcPBpfmcU83E+wAn9zN+5g8wvxrOnAWJYfLbpdpG/8ze/PTfsHu1CGwG8uOZiUpiFwM13elE2qpYGKGVlOBtwD8a6LBUlWP5mc9zZKaxt0sh9kW4c9wBQONONeCkbn8+iX4kxhQcytw1n3a+WXxNuSNXTqhpTZnlbomrxWTKa50V8sZpBgVtYxpuEiQAJsnQ3HSIzGPLCpwSwEe4dGbtDzpJmNxGkkUmRjmj5vouUiXAZTrFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2495.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(66476007)(66556008)(66946007)(956004)(2906002)(6486002)(36756003)(54906003)(52116002)(4326008)(2616005)(186003)(316002)(16526019)(110136005)(6666004)(26005)(86362001)(83380400001)(15650500001)(7696005)(5660300002)(1076003)(8936002)(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tAOl9a+Ou/EATokedIc7bYBCYWwDtYk34HWhYVW8FVc0LrY9nHBRiV45D2jducJiyYe4Ijg1CDpcWYHYNqFLXWkkii/3IYlIVJw7ThCh0iI57+PFPxac/jl4rYm5h7DkZbF6DNiJa1Jilv5vneFG9z2x8R5L9fIa5yJVBfa/q212wUDLxdwHinRm8tg7PJM1pte4DF3RYFU6LNFF76ekchzVfpJCg6TNWZAujYhWILyMtQmSWTbl3E9mt/rKMIciFk1whbOdmlRiFPMVA1F/PnAfrt5BdnPe7Dh0QlxE8JAnZM5Z2iv/jvMQurOyfeb+cCnaCxdt9IA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: afefe9b9-511a-40a4-7d5c-08d8cf802008 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2495.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 18:00:47.4535 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0WpI3zISBF7W7SiFDsmnnwSpBp9B0yhmNufVLXEO7Mo+QxRE7NUbcdA0njUV4l520MHLXVWU2aD0BjkzAZahWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2399 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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: Sudheesh Mavila Signed-off-by: Shyam Sundar S K --- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 13 +++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 25 ++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h index b40d4377cc71..318817450fbd 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h @@ -1279,10 +1279,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 @@ -1358,6 +1366,7 @@ #define XGBE_KR_TRAINING_ENABLE BIT(1) #define XGBE_PCS_CL37_BP BIT(12) +#define XGBE_PCS_PSEQ_STATE_BIT 0x10 #define XGBE_AN_CL37_INT_CMPLT BIT(0) #define XGBE_AN_CL37_INT_MASK 0x01 @@ -1375,6 +1384,10 @@ #define XGBE_PMA_CDR_TRACK_EN_OFF 0x00 #define XGBE_PMA_CDR_TRACK_EN_ON 0x01 +#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 + /* Bit setting and getting macros * The get macro will extract the current bit field value from within * the variable diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 859ded0c06b0..489f1f86df99 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -1953,6 +1953,24 @@ static void xgbe_phy_set_redrv_mode(struct xgbe_prv_data *pdata) xgbe_phy_put_comm_ownership(pdata); } +static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) +{ + int reg; + + reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_PCS_DIGITAL_STAT); + if (reg & XGBE_PCS_PSEQ_STATE_BIT) { + /* mailbox command timed out, reset Rx block */ + /* Assert reset bit for 8ns and wait for 40us */ + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, + XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_ON); + ndelay(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); + usleep_range(40, 50); + netif_err(pdata, link, pdata->netdev, "firmware mailbox reset performed\n"); + } +} + static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, unsigned int cmd, unsigned int sub_cmd) { @@ -1960,9 +1978,11 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, unsigned int wait; /* 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)) { netif_dbg(pdata, link, pdata->netdev, "firmware mailbox not ready for command\n"); + xgbe_phy_rx_reset(pdata); + } /* Construct the command */ XP_SET_BITS(s0, XP_DRIVER_SCRATCH_0, COMMAND, cmd); @@ -1984,6 +2004,9 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, netif_dbg(pdata, link, pdata->netdev, "firmware mailbox command did not complete\n"); + + /* Reset on error */ + xgbe_phy_rx_reset(pdata); } static void xgbe_phy_rrc(struct xgbe_prv_data *pdata) From patchwork Fri Feb 12 18:00:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 12085849 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91511C433E0 for ; Fri, 12 Feb 2021 18:02:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A64E64DBA for ; Fri, 12 Feb 2021 18:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbhBLSCQ (ORCPT ); Fri, 12 Feb 2021 13:02:16 -0500 Received: from mail-co1nam11on2056.outbound.protection.outlook.com ([40.107.220.56]:30048 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231426AbhBLSB5 (ORCPT ); Fri, 12 Feb 2021 13:01:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gh2WM+oBzZs8UX5y1yTUCOy67JvjHkGwxyXCn75I18LWSEQrPz+NDMix6Ow51BQNTDUNJvOvCOIAVfWjHx6v2F3L5sT2607I6k2Ts1FavGfWLSaZB1/ZLL88Up38zAbZIn5rPpdw1MhIJNEIO9qYYmHUPMpCXxuUAS4RpYgnPOlO+BBTjYcqudCyDumakS2bnoFdT0O1qYUoc+8B5VZOP0ja9t43JE35BIAGhmvQSkaQ3AA6fe1WTW8eMyEZcPXDI7MJPn2zMO6NN4LLt9MgHkJJztwFTJlYQIOMrlwT+nu4fl1fHG6E2MtdJvcw68isajRXVvKDOYuhtvQ34kcRGg== 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-SenderADCheck; bh=L46BZZxPmuYL0WFZfhKTvLKYZ4PAM1AK28xpONHR+3M=; b=oZydRQ41e/DnjDRi4Ia4QT/n6CPNyIuPKYDMV7gqAsC8GY5FDHHl1oeVqZlTPJIkVYY/NpLwoPMYzW7qgdqMOygWXX2L+Q4RtO6ipQeOqD/7ikBSzH00BGK1NtfCZTaPKw0h2lrXeaLp8XfUzOU+OefsosYJ5xZNhcpmwvxXaxEABS0C5os8XFOZEjogyIw03xYffPkJ3er/5nAgS4cHTxz1MJNCfmGDdAk3C6925Lmo3BEOXpqZV/HQ6OwDh/3WWQat0TNBoz2qUqvO1AjN3f2GJGYQ22m7HSqtx5f+FJgf+YzO+8jbCIFp1l2Mpy5cEQxVvk4PlBZYwlyKlnQcKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=L46BZZxPmuYL0WFZfhKTvLKYZ4PAM1AK28xpONHR+3M=; b=lZRmkEkHe6Ud7MxGcdpdi3kwO69G/blsR2heuckQQiOn7ILoQ2Kg9Z5PXp0UlFQXBuw8zEDFsierZ0rTn/quRJHzhARmq3c7snTANzpVn5INyKpDjepfrvELbqfvmXFVzr4V9EfkYwlptelFLtyYoUapD9t85cra4Zh8/Lgrk3o= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) by SN1PR12MB2399.namprd12.prod.outlook.com (2603:10b6:802:2b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Fri, 12 Feb 2021 18:00:52 +0000 Received: from SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451]) by SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451%3]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 18:00:51 +0000 From: Shyam Sundar S K To: Tom Lendacky , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Sudheesh.Mavila@amd.com, Shyam Sundar S K , Sudheesh Mavila Subject: [PATCH 2/4] amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Date: Fri, 12 Feb 2021 23:30:08 +0530 Message-Id: <20210212180010.221129-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> References: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) To SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 18:00:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 89f88554-7dfa-477f-73f3-08d8cf8022ab X-MS-TrafficTypeDiagnostic: SN1PR12MB2399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MPhfdlC845Kp+qwC7lxPP7TFR1aOdRHupBAsq0u4eO6pSs410FcSQWc5IPSvY66wWTds9IqVNy18I2t3GlN2oEKjgjzTxEr8vReBSXvhSOHxT+aviBxyD1qbUO/IC8s0wl5LCv9tMLE0qllTG7iJfYJLa/Po5GNhubF5rkp0QtzPo+FwJ87C7CHXrhSw6QIeUtY5tJys5VASZwZwMJw6Mmk/zuGIqKdv1ARMpTXf7KBzHMnIWJ4+DMvrbM1ZC139QKNGw+DtCXq0bkRKB+CtkOHWvJp+nmXQEZ1bqw/NWiIm9oWFYHdIGjHuhbM86IOPqi+O5BOLmfQgIC+CF01EWE+XF7SJpaL78+wln7G8EBlsFsdtZSwbht3K0wnJs0SMykF/FFNL4YV4vQDBbw+AxUkCVpLmiSyY75JgLr1UsReAHABoAQvQqko/y57rvlmA+uTsmsTiMqIGlrtgeHHGD+uXT2LGiWv9RNF131PmFFVt/c73kI+NxKGP+RmtZXV5GlfESV7iwaxP5l1WWHHuFA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2495.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(66476007)(66556008)(66946007)(956004)(2906002)(45080400002)(6486002)(36756003)(54906003)(52116002)(4326008)(2616005)(186003)(316002)(16526019)(110136005)(6666004)(26005)(86362001)(83380400001)(7696005)(5660300002)(1076003)(8936002)(8676002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rERYYpmyU+P9mitv39hHDRPdh1mNvKF5s2H7mn11s94I0I7kiP8sANbwRMDQ/X7dhvOJHOyltvxY7aeuPHcacq85R9RNTIg3Xrq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8ocAlBkMHNsH5fPtGE66s1mh6yYzGrldNmqvMKHdladsuT7p6Y86gt/fiqPknb8k+1xiKkFRs07aHH9rwj1fmKXQJORn9CX0oLbidN6IWkHmL+EnGh9mtQWGzprBkEf21YVv6yhk0UDTSiTGAiTvZcMMLltYYsbTmQfqX9vBhEmE8DUAbC2yUHd3uvRmCxveQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89f88554-7dfa-477f-73f3-08d8cf8022ab X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2495.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 18:00:51.8849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aytCE2JIqEtQ+eslXJrTqls5iycybytERmcp8UEQFjy+faz68SjORbLd/n+ZBZotX/Onk3snhhGW1nN6WY/EqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2399 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Current driver calls the netif_carrier_off() during the later point in time to tear down the link which causes the netdev watchdog to timeout. Calling netif_carrier_off() immediately after netif_tx_stop_all_queues() would avoids the warning. ------------[ cut here ]------------ NETDEV WATCHDOG: enp3s0f2 (amd-xgbe): transmit queue 0 timed out WARNING: CPU: 3 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0x20d/0x220 Modules linked in: amd_xgbe(E) amd-xgbe 0000:03:00.2 enp3s0f2: Link is Down CPU: 3 PID: 0 Comm: swapper/3 Tainted: G E Hardware name: AMD Bilby-RV2/Bilby-RV2, BIOS RBB1202A 10/18/2019 RIP: 0010:dev_watchdog+0x20d/0x220 Code: 00 49 63 4e e0 eb 92 4c 89 e7 c6 05 c6 e2 c1 00 01 e8 e7 ce fc ff 89 d9 48 RSP: 0018:ffff90cfc28c3e88 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006 RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff90cfc28d63c0 RBP: ffff90cfb977845c R08: 0000000000000050 R09: 0000000000196018 R10: ffff90cfc28c3ef8 R11: 0000000000000000 R12: ffff90cfb9778000 R13: 0000000000000003 R14: ffff90cfb9778480 R15: 0000000000000010 FS: 0000000000000000(0000) GS:ffff90cfc28c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f240ff2d9d0 CR3: 00000001e3e0a000 CR4: 00000000003406e0 Call Trace: ? pfifo_fast_reset+0x100/0x100 call_timer_fn+0x2b/0x130 run_timer_softirq+0x3e8/0x440 ? enqueue_hrtimer+0x39/0x90 Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 1 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 2709a2db5657..395eb0b52680 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -1368,6 +1368,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) return; netif_tx_stop_all_queues(netdev); + netif_carrier_off(pdata->netdev); xgbe_stop_timers(pdata); flush_workqueue(pdata->dev_workqueue); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c index 93ef5a30cb8d..19ee4db0156d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -1396,7 +1396,6 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata) pdata->phy_if.phy_impl.stop(pdata); pdata->phy.link = 0; - netif_carrier_off(pdata->netdev); xgbe_phy_adjust_link(pdata); } From patchwork Fri Feb 12 18:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 12085841 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C98CC433DB for ; Fri, 12 Feb 2021 18:01:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03FD764DA5 for ; Fri, 12 Feb 2021 18:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbhBLSBs (ORCPT ); Fri, 12 Feb 2021 13:01:48 -0500 Received: from mail-bn7nam10on2062.outbound.protection.outlook.com ([40.107.92.62]:11551 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231131AbhBLSBr (ORCPT ); Fri, 12 Feb 2021 13:01:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sj7TpSQ6Taix+Y7B0fMDQRi65PHDB3BX4pIEAVVlYHQlAPjQV1d4weIpRQXY/WpZnbfbxeJSen7Y1DClkH3q32cymhfBsaH+lyvs4x4FNsSO0gyGTGoMxNopvxj95Hmi4rb1kD3hRqusrSz8X6BdkJRAe/hJW8q5ZehovkuC3fGcLkDBhXlXfGnP32G4kTiJP0/WIjKrfl9886D/JCVIRDGnYxhAEXgyrtBLIPcDFCjAqmBLJf9Va0kl8eAUYe3uYhwDMknMrIMmZDj6PfeN0K27PLaStkr47z9IpPoPFcM2O2qnXHgAN3i6F5MQ33oxwDCrlgPfcDF0Ef+1pk21KA== 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-SenderADCheck; bh=694KkMnDLUt+nK1+dtlW4XX9QpxyY6noJ+ZVhnpJWjQ=; b=gMCIG/rX8eNGhuA4pcnk3YDDhXEjcbIE1SnAuC/guKk4kdueEGq7CKyHS2Z+QGWDf8mgqfoXhL+ZLCen5mPpaQSB6b6k7cq+hlDjz28aPieFibBDoKGhOEfAc4KjeA7iIBOg00IZd0AY7dwp0VMdKtMHRGKUFqenI6nZnt0ImojuI8HbHuCtE6UAMyXRx25Fyk2/NPwRTMU20Uqp2VF/fp6RGHK+3C23DivAerIasViPeQDw149ZPY1bLBv4JX3MnUVo5wSMd4YWTk3FyqwSjl9Pu50FJW0KHYs0hTwDWtPClraKZ3IBPfdrM2bzlz2chu3JDfexDFE8vDK/LhUJ2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=694KkMnDLUt+nK1+dtlW4XX9QpxyY6noJ+ZVhnpJWjQ=; b=IxiTbJ8BszRju0WEUWVRIJFAc8vUfnA3YY0Ong2Mi8omgOl1AAN1bEbAgC71T8TMq8yGqlvZPmtmZsCYBlt6QZsIXIat3bzqHvEGXswZNTBFRxypG1R6/LNaG3upkn7T+sVqWHIfR2aQTmjNroShAsIgWCLtfbaz0E3ai2ZUju4= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) by SN6PR12MB4624.namprd12.prod.outlook.com (2603:10b6:805:e7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Fri, 12 Feb 2021 18:00:56 +0000 Received: from SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451]) by SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451%3]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 18:00:56 +0000 From: Shyam Sundar S K To: Tom Lendacky , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Sudheesh.Mavila@amd.com, Shyam Sundar S K , Sudheesh Mavila Subject: [PATCH 3/4] amd-xgbe: Reset link when the link never comes back Date: Fri, 12 Feb 2021 23:30:09 +0530 Message-Id: <20210212180010.221129-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> References: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) To SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 18:00:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 76090f9f-d28d-4d90-0b34-08d8cf802510 X-MS-TrafficTypeDiagnostic: SN6PR12MB4624: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zKrNG38NqX728PaCCg9j0Zk6NVjdiNwOOyN90ZD+QEuMxmDKDAIVkvvAmO9q02CV4zsSylLV7iesjDYBaSt7c1NtRAw9fKMsEUzLCHJsU1SX7EJXBVSDKQT/iT19qDWiOqqSXw5KXoFB+2Fl2C8h/TXs2mL3RjOYMOmKu0IYBh4wOs6ZSr1sQgLg4XZzMgtj5DpuyPj+kzFJ58p4h343XmhjiXiz2kApCTOM5vF7+MZ383uZJaAtjBnjj6R74BRq5AUEhZ5dlP9tMeh/iypQ47QB8Nhw7NvtWnSo3UVhayY6VG2zYujxilL74BR5qIDGzLukjVEeLG/X2ArfvJmkfd38r/9nm/3G+1OchaxlUomkdubPWqsqizAhTxxl0LYqw0QVUWpozodUyy6Gi8sqvR5YPibareTigGygCTr0pBvea5vz90RUZ0yBB0glw7+Qid7o8wybQglxJdJUK4eZzPcQcrGRCn6cyaQ2X5hmfEXl92JmHQKRBfRSAkcpp2hrLLrZzEa4sOjv9Vvg+Kq92w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2495.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(136003)(346002)(39860400002)(366004)(36756003)(316002)(1076003)(110136005)(6486002)(54906003)(5660300002)(66946007)(66556008)(66476007)(52116002)(86362001)(186003)(956004)(8936002)(2906002)(2616005)(83380400001)(4326008)(6666004)(7696005)(16526019)(26005)(8676002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: C2qkjXGpckhbShmZaKNfm2gSZ+LeBW+DodZhTWWdjldwx4bTfjSTUBxoxEuYhBD6qVcpeeFwBCxnEP4ddOosSVFidxUn0Pwm1d3YUSYdQujgonCM8TEi5FFXWUgycW93jgP9upYKKt4cwrOZfEybebjx4YQaMHWSKdvWBA77RvW2qPgfSa3kGqMazVxDxPUAbEt1ZiKpAXC+xJ8nHToELNA6d6ffp4A0w2Of72QOB9dBcQqmMYzes6YKa+HoDae3YWrdKo9YNK9IP0YsD9zROh+K95qOanxt34m5L0klhc15B1YgyYYs+jKit6CtsMo7TRjlKeXf7fjd6QygSidosHaOgie6zf2TidYy1igbXgH9SkRBAIZGowc7IZ8dxSmjVFdrE9CUCqZ3ptgVWWv9GD1icuYppjTrcxyEV1bHh41KRKUiu+gQKs577407qIFFCglDLZGTnfEtVc+djkrPzxsysvp909mIMjjvCI799VF/SZnF0WiAbbV1i754yvWj4IZL6EiXIYL0it+mGA5p7TpiVa+KkLbUusmU4KOyJVfMrnM5l4SlikYZPn1UZXw9O/hgawZ6NIrmACAUYjVeLD18gfCn35K7t0LVZmFNXmeReEeWHgRJJIGG2hJsc7F297aV6CSw4SSmXi7qZH20BbHem+omisZ8ddrbkvLAZQFdzkueBXEkh476/g/qETSTdlcERguVNTkycKKEYlHKI3V5Wuop4HCjd+IH2sCILiSg0j0wR3dgNKrTjU+OlNanOMkCxi1u0dwg5CK8PIeByMep7qULnKbeqedG2QViC7/hKlw4pFvGHbVYvAxI2stYi/FzIkkpuGkMAGjPq91NyqiKcvYHJhiUQ92WPyh7V27/rasP6s8jtW8pwfNcYOjYMrKyZoAUdYiKXwTNpjRTrKJYZUj95sQehjuJtitMOmhQXFH6LWFdgqFRbcrWbPk2kgsB7zmuyA9yCp3x/ZxO8xGVBEneq/ruk0kelgWRRoLnnu2/8LOtsrD+CRrPtzh7cnQyu+kXqvljGlWvjw5v4YpFKDYQwzjl+B4+mlHAbFZBxQTTFN7vMwY3utFrawZdG5hTrcc5ebOv0ymcfFbbSl7Nw6m2kMKs9eYrJt0SCSqL/PzneQCOb+Xi+hdF0Jcrg8ICk0OVQML59spnhHedM/ARdJnL/yEVJvlBJ4Uoh+DY2cyU0QLsESImD1aDz4+4sIm2WM/Nii6m3Q3dAHTaCHtyUY2dxK8umsUj/inAAPSUjdUbl0dw8FonsKh8Pvw1CF1EU2PCUDEKko8F7zdoKddU+hjDIYJhKQiilyprMkDjpmkTSYKizyPaX4fD1R79 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76090f9f-d28d-4d90-0b34-08d8cf802510 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2495.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 18:00:55.9136 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nAtYKMF6w/5oZ760Rpq5vSmO7hghBjhn+h3k2sGKmQqVCPjjSJRpwrcTLxyoqUX7f85mdefNKGkj/vaafFUC5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4624 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Normally, auto negotiation and reconnect should be automatically done by the hardware. But there seems to be an issue where auto negotiation has to be restarted manually. This happens because of link training and so even though still connected to the partner the link never "comes back". This would need a reset to recover. Also, a change in xgbe-mdio is needed to get ethtool to recognize the link down and get the link change message. Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c index 19ee4db0156d..4e97b4869522 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -1345,7 +1345,7 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata) &an_restart); if (an_restart) { xgbe_phy_config_aneg(pdata); - return; + goto adjust_link; } if (pdata->phy.link) { diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 489f1f86df99..1bb468ac9635 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -2607,6 +2607,14 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) if (reg & MDIO_STAT1_LSTATUS) return 1; + if (pdata->phy.autoneg == AUTONEG_ENABLE && + phy_data->port_mode == XGBE_PORT_MODE_BACKPLANE) { + if (!test_bit(XGBE_LINK_INIT, &pdata->dev_state)) { + netif_carrier_off(pdata->netdev); + *an_restart = 1; + } + } + /* No link, attempt a receiver reset cycle */ if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) { phy_data->rrc_count = 0; From patchwork Fri Feb 12 18:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 12085843 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B9DAC433DB for ; Fri, 12 Feb 2021 18:01:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9D0264E3D for ; Fri, 12 Feb 2021 18:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbhBLSBx (ORCPT ); Fri, 12 Feb 2021 13:01:53 -0500 Received: from mail-mw2nam10on2073.outbound.protection.outlook.com ([40.107.94.73]:11840 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231131AbhBLSBv (ORCPT ); Fri, 12 Feb 2021 13:01:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WWQZi3QUa2xeKKVAnd+LFwv6d8Rhv5rZ7q1sdhMkioIMpO9O3TuItxFgpvGRk39Z9EeG9OlkK/wp8iy+3VJexDT/7Rc9yWqnc9WmEaGDUyAvUDax4gcFV6tCuShjOSUzftG7ZNkEB2qKgiqW+aRocyzsE5NfSv4vEiVONSzIOPQ1YsLliu1XkxE/zkxQLFY+7Uo6Zcz2uYILtISwT5VRKOKv+DJUyWVmSpCvFrmXBCK8+4lNlUa6svK442dGj4cHfDR9B8rquyvGarUIKilwYEEKeI2W/Hks2Kq0iapGIuHFtFNx5UyxajBhopIbImttUxSQiw6oPhkXcWAOv9WWIQ== 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-SenderADCheck; bh=XqwXqrKLzKGS9LSaWbxj3tjzZqGxcvqKh2pjXHS9cJ0=; b=HwjnkQojSDitSw4Ix9pOdFPyiuMOx++IdSaFa4CBwYTAifoBH+FeCi268WxbNFy0aEOp63O9jmulVKByvcZOr3QeRb08J0ASPw2rEHvIY4ROqdptaM2Ns/nV9khw3XOSfAgiJc9MSolIkk6dufh4UMakQExe5ASGpyReuKjOFnQg3cWyitgLdYFgRAW9jcQZwyMhdztaXPpRwdfx/D9TSwfRjHYVutBAmxdJ/r9iIrETON1e1j1Vg4kv7lKCrkEppZ6IJPtGRlZFEJ7a9jTZR6jo7A+OuphVRgyhNI/4W6Lgj+W8uwz+QurwBdUj/wDepIbmut1eebHIHoBrIyiOHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=XqwXqrKLzKGS9LSaWbxj3tjzZqGxcvqKh2pjXHS9cJ0=; b=v+hZ6tvg1d8U7qDDx+R4jU4t6mD+5aMhTMCoiRZDrTeFavpNkSeieHss3NMSOyri2ins5GM+vQxHkcHdEviqtfTvdZBBux9tX80yJpx1zKSjBA3wZV4iX63gUjq0ypEky3WZsnRp3/jlyiY5mnp8X/rd6jOwA0H5fjHU00ZUQN8= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) by SA0PR12MB4397.namprd12.prod.outlook.com (2603:10b6:806:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Fri, 12 Feb 2021 18:01:00 +0000 Received: from SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451]) by SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451%3]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 18:01:00 +0000 From: Shyam Sundar S K To: Tom Lendacky , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Sudheesh.Mavila@amd.com, Shyam Sundar S K , Sudheesh Mavila Subject: [PATCH 4/4] amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Date: Fri, 12 Feb 2021 23:30:10 +0530 Message-Id: <20210212180010.221129-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> References: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) To SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 18:00:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6d378727-f3c1-4b58-7ea2-08d8cf802784 X-MS-TrafficTypeDiagnostic: SA0PR12MB4397: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T3J6JpR81Qxy5rkGEZ7DvMBqQDz2MakSsAZ3a3vndiTWtyNr7Uc69jEO16/hBCRhkS6isvkKGXf0EmWfpDALxHaTTL04RP0gpGsdUNmoT67HmnlQ7B3ExpXEH3FEo9PFRjB6GzISMErv/YOHdeJXYEbxQ4RSOJw1CLOhybwFtRsApXI3+d0wvk0SQ5zlTxariM/Dybqkd8NHNu8TIf4uq5+Qi0T8igEfl2ytNlplxVg1WPMaEwnt6sAaBO77j8Bi6IFD3VyYE8k5jowxVqoujjfLS8oNAvuzq0EHyGbCSupjL/hLVQh9R162GKQxZyVfg6+pi82MnF715uM1glKIyKAF37co5SqJTGBnoX3fgyadArG/YH2Wy+8KvWBo/pSFE++stqsicY3F2rTOCKNZQCqseqTomGQamHDgFQHT1aYKuRQreiqRP571akqM3XVdDuhJZ+GIhoVluEizYduKqz3tE7vT2cNM+/evRldBmCobA2EVpzNOLJ9bfAo3r6s5YPC03SfMvOmXdOEHnIFjlw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2495.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(346002)(376002)(136003)(396003)(366004)(5660300002)(8936002)(8676002)(52116002)(956004)(26005)(2616005)(7696005)(110136005)(6666004)(16526019)(478600001)(2906002)(66476007)(86362001)(6486002)(1076003)(186003)(316002)(66556008)(54906003)(36756003)(4326008)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2QlhjpoXb7n/b7UpvwX7psGVDG6zL35XB3VVpuDsT/L4auzxKS9pQbWzMznoySQ+rrwALr9pJIzxKLTnx1n5CELnjQSKTBq2DAM9pZGW9EsJ7MNGGHTaYjn8N5LuzOXuco35Qj3PvO3Htrul1ArsFujKo0WJ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09w3Cx4i2TDziLoFA0X6G/neoS6FPSVXsEAGlIYgDDL1pczf6Rm1fChePzqW5eSDN37hP9VBuRV5mu/etzTb7cSn7fpj+tOpuiAeovTy9NQp2HrFKIod5tk8ha9z3i6oew X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d378727-f3c1-4b58-7ea2-08d8cf802784 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2495.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 18:01:00.2651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e5bipoY0TQTi+M55XVQhaXg6KBo6vtUJaBbpeJmh7nVAgrQ0in6NtRrX/J5I2TP8JU14IIemPWJeBUR8dgFMzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4397 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Frequent link up/down events can happen when a Bel Fuse SFP part is connected to the amd-xgbe device. Try to avoid the frequent link issues by resetting the PHY as documented in Bel Fuse SFP datasheets. Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 1bb468ac9635..e328fd9bd294 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -922,6 +922,12 @@ static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata) if ((phy_id & 0xfffffff0) != 0x03625d10) return false; + /* Reset PHY - wait for self-clearing reset bit to clear */ + reg = phy_read(phy_data->phydev, 0x00); + phy_write(phy_data->phydev, 0x00, reg | 0x8000); + read_poll_timeout(phy_read, reg, !(reg & 0x8000) || reg < 0, + 10000, 50000, true, phy_data->phydev, 0x0); + /* Disable RGMII mode */ phy_write(phy_data->phydev, 0x18, 0x7007); reg = phy_read(phy_data->phydev, 0x18);