From patchwork Tue Feb 16 19:07: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: 12090519 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 472BAC433E6 for ; Tue, 16 Feb 2021 19:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A75D64E65 for ; Tue, 16 Feb 2021 19:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbhBPTIo (ORCPT ); Tue, 16 Feb 2021 14:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbhBPTIj (ORCPT ); Tue, 16 Feb 2021 14:08:39 -0500 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04on060b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4d::60b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 233AFC061756 for ; Tue, 16 Feb 2021 11:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ih2ANkFsMTSkQVaVoKxj5I6wJfToMEgMVfKvtUuwc5o//s47jdiWnUK0VYdKzcquOn1n/LdmWSJldhkHvs0RiXgMQkaXg9FWYMl7jcq3i6SdYRGHXc37h0oAhmFkzyLY/hlrvIJJDOd+HvYE17nDo4LoufSl4alBf5zYU0d6UDothOophDGFv24qcJCWeYZSLnJlqg+qppV1Slcx+AJw8QfwJ7wLcFFnDUgD5xugVi9o32xb2H0KDXcM2sMBFSI2vQM+hepfW/GLqlNejrVsY/X2vDw4lgnfqhf08k1oiyacq76bWQd0TYwqJwN1FIToB0Tg9yifePYhCnHbqkRrNg== 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=dSyvPVGe9jDL3zkzIpw+vu0zYBgmCAjL6jsB59SRpzk=; b=AoShvi/kzET7clvbYx8/4NbZW43TZX8AUk99Y2pGKmkyu2iYjRSFNcEy5qf0jEi0qaTZvf4USHje7ShYz3IB2z+i7XtoRUWb5scWKNL4onqOaYlp4e8xN4HTKHXWEQwcyI1RJ6d/6i/sKNK0Zb35z0iSIlm/tD25Z+OwyfCcLaR6jKxzixx4gEZHg/mPkznosw45gaKUvnCf1uUChAHsyPQGq7I0QSpIqc2NgZxKtXCwG2R7c1DfxS5XIumj9a5VLf5L1wn8tsuGkrHIC0GB+cLwzwzg65RucfHZ4eMUmrTfnna7xKYQNwYSkIJPLmPCJBhFKiYut49cJXtbZLvLtA== 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=dSyvPVGe9jDL3zkzIpw+vu0zYBgmCAjL6jsB59SRpzk=; b=I49B8s2Y/TT1E14d72NJy+cNADuSOiEzLpMIrSO0Rdf4DTkzXgdu3IOdJ06g/sFaIuLgD6n0wPexVhD56s9Gon60JUvXwQeKVTBhD+Zo4Z69MujhOrkaEdrhotXHfLshcBNzEfWXf5mKPOWktqULH5illdWJJpqfNchlfv++Eog= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) by MN2PR12MB4334.namprd12.prod.outlook.com (2603:10b6:208:1d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Tue, 16 Feb 2021 19:07:52 +0000 Received: from BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2]) by BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2%6]) with mapi id 15.20.3846.031; Tue, 16 Feb 2021 19:07:52 +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: [net,v2, 1/4] net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout Date: Wed, 17 Feb 2021 00:37:07 +0530 Message-Id: <20210216190710.2911856-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> References: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) To BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 16 Feb 2021 19:07:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d2b32b93-4fa1-4d9c-5d08-08d8d2ae28ec X-MS-TrafficTypeDiagnostic: MN2PR12MB4334: 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: /sP5sPG4X+yzMW/VFpTUgHp1Wupw87JREq9wI0trZ2HpLKPKR8aVpG9GAa1TCAg1NoYxppM+SZPv87JQcuRtVAK0qOu7tBwp/aNnnTYRBthTyIJ+nC33gHOtmBxN/QaK7enmNXDByfw8mlN64+WdQngBUJF3YmHLGdGI4SYwyymI1t0VZ2v1Luf5fA+TH/6NLiiK04CyVe4c4cjyfXhQFM+I2ZPqHUe2HWwVMvNcANIy8kETA9Coopx7yCr+c295JZdkeRYSqxMpZFBVI/B70PrLfET8p08D+cfUhCCbil+nwj9c/52mktGPW8WoMPKR8kFSfFV43IU2Gvi9fFrNrQh5VUhBmM3zsnzT0g58FNOWaqiT38OygiErtln69wv1xMzz5H6RrLYt3RBuXPxQetcwUAvdJwd3b5KmwEfu+JoBDWx92Ml23lcjJV7U8Xn+CRgkIt8B4PLbx6slOuKwvCrfBI1uOXuDk0FjRv4V4HSZQR/BHjQhsUMNqLRsaeL6XZlZF1QMINv2n29Q7lpT9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB2484.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(376002)(366004)(39860400002)(136003)(8936002)(36756003)(7696005)(52116002)(956004)(2616005)(1076003)(86362001)(316002)(2906002)(26005)(66946007)(54906003)(5660300002)(16526019)(66556008)(66476007)(110136005)(186003)(83380400001)(8676002)(15650500001)(6666004)(6486002)(4326008)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RMdjt3yqmIWpsyynNwB2ekZTpHiEUa/8xhpRdP8B+QNptnjnito2JMsq4y1IZmzWwkTnyGOSSS1QUKV9zv06O4M5Q8GQB24R2t7rKHX7Kg/KypQuYsNiBbzd00LpElYsQdKA2PaB0KhpO8RFKWaNpPTF3BPaUMzS7Ua1A347OkUOGvKyHoS0IVaQLjlLpdJWQYlimd+KCuGTbYjHzYrN2P2LV21tWVDxM24nBZkNU3SvJI+6P+4iVx2bpSb54KyZ/hfuHX/yXePf9eZuBs1K2M40LTQiJnsuDhbucNFQMHN73a7LOjAZ/T8sIhUrloZSTzOIus9gmOJ/MYHmKi4nx8hKtb27grhsU3aEFzTEbI3UGH7BRUCgjBKTzN4hVxBqPhGp6autzj0lhpZWfe3Qfy0jKAFPDyVpwsNbT7F4JWi4VSc+KJyM+SRo6d/B6737HvwFtpwtHhq/5LkqWCkYqCSiEQDa05w7lRZqun9GtuMwPpfDuchYxfHRy3s/H4xAG1WxQsOQfTBP5ad+/VCdbkGIxV5+tUN6JT/vwe6UB3cCTTzDKkzlNTSMM4tPDdQeH3oXW7QgvRCz4RrGwMSmaDpYkeLZY5J33Xwp+GQf066QjDAcoVSo3JZYKr8k3MLwoAgxSPZO1JfrNc/RrxEJH9/+R/4aZ4ZD1Rkp73Vul7rLmAUe5R4SISMObUUZ+hwu5EDBcZGpr3kvCW5SZIcWdLty0C2Xx3NILAcpAJZvGUp7ejs4VQdeY7oSe0qu0cnt+jSXeFYJWBjyMe4VczIY/CPNA/LMM2wrzFARkHQ0CYkcxDPKiUuvw3n+s8awOFPDetWYVm5XzCZl/AJWM9ccsUDCE/0Gg2xStiXogb3JA4zCPxqOOAGCgmxUiBDvm2NaxOeFXWN86spkAFN4a97aT74tjgbgXKsLB3NJyRdID0m58Qc0ZBsiP28ZMPCEUz71uq19ftjZlqO8FlmDe9A3mWE3Kn/lcQ2xBbP/0jun3y026tNEG4ezKjmmYJsSUvI3cf7hf55bDHFEzon7FCDrcsDmmkzhkeO1gg0ull5iOstAOiXrpHMLI2NDa+Xj5V4Qm1sVAHgEav8q//Gl4N6JTOrbZySfvJdpGSN/Sf/PGd/bElQKSKlQxoVu4g2B+WRNf1AnFoxWEqGgDGXYlmzmzbruAfnXITlDbPoY2w5Mur8PEuLOpMkt+ZCRm2Kaj2RtUrXDqbDvxqq/GZM0wT0mj4fPQtgxAjt4LXA0b7CDlQfcORp80FXCOJc9cVQWQIKcXODX5ysp4h3W/YDfQb14DzxqcS3mJDzsTIHYAmWrr6yez0RUjPBftXJj5RCWdgyi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2b32b93-4fa1-4d9c-5d08-08d8d2ae28ec X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2484.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 19:07:52.7025 (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: G9wBcGYh0u3AKlaxNMoz13COqYyK9pfxqF5pZKUifITRK95qwU6cR9NxpcKjhEpTjNrvYtSla5wQWXBO78xczg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4334 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. Fixes: 549b32af9f7c ("amd-xgbe: Simplify mailbox interface rate change code") Co-developed-by: Sudheesh Mavila Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- v1->v2: - Add Co-Developed-by: and Fixes: tag - Changes suggested by Tom on right usage for PSEQ_STATE. drivers/net/ethernet/amd/xgbe/xgbe-common.h | 14 +++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 28 ++++++++++++++++++++- 2 files changed, 41 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..b2cd3bdba9f8 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,8 @@ #define XGBE_KR_TRAINING_ENABLE BIT(1) #define XGBE_PCS_CL37_BP BIT(12) +#define XGBE_PCS_PSEQ_STATE_MASK 0x1c +#define XGBE_PCS_PSEQ_STATE_POWER_GOOD 0x10 #define XGBE_AN_CL37_INT_CMPLT BIT(0) #define XGBE_AN_CL37_INT_MASK 0x01 @@ -1375,6 +1385,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..087948085ae1 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -1953,6 +1953,27 @@ 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_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); + 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 +1981,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 +2007,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 Tue Feb 16 19:07: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: 12090521 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 43D82C433E0 for ; Tue, 16 Feb 2021 19:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23C4E64E79 for ; Tue, 16 Feb 2021 19:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbhBPTJR (ORCPT ); Tue, 16 Feb 2021 14:09:17 -0500 Received: from mail-bn8nam12on2058.outbound.protection.outlook.com ([40.107.237.58]:51168 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231247AbhBPTI5 (ORCPT ); Tue, 16 Feb 2021 14:08:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KBU1My5xoFF1aA8Q51D7+PzPLbBYyQQPVxxCFm6/Xe3ScK00dC17r2za+5Zk7hQFGe2Szxn8IgIqnNXPeqbR4bzgc0GY7gXGfdz0MR8Q2jmEBG/NQybGBse8esa6nuSUoF9EZj1410OUr2ZRAnyw1UmX+m5tyiN4O1nz5v4Y2V7mIuwKT3lFXJM0lyWM1fysgnipuwNeHWk2iW/jEjg66xmL4I2gLkVMZZbDToN5hfopfYURF8vmfAfdlaj1hYH7Gdvnpn3LWpXEo1PcQkydHWT2hJJYCBcubzYGHgVwOoF7IWbiiciatqMa5sMMVaxnxvyDcg0VgYDIiIfXemZ4rQ== 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=TIqzXFiat7pbIGtFHKIXloHJf+aIrPnyJzi7SW06kfM=; b=HFDreeKrm4HeT0dvxgAeFfI9TDqBaCz5Ll0G+jyXJwpa0NeLKtNOWH/ZQckO2AJcHzGlmlY2vKEw3iaGrMoXd4ufk7gUaXO/QiJV2jSuRKxsUXvMzCevdQlEvCvKIh2LaOygQHSkxUUqngZtpiK01E9Ga4nFLW3Jay86MvlRjE2feWp7ozOg5wB464Yd5N4Ez1QEFnlHEh2dcF4vEgHOWfXcWPCLbasJoYDEg1fuky7EgQbzxwsNEhxBk6zBMnN1xo/Rcq8gNhD86brN3LBJ4RMVlL842skqeOrbYciL7E+fVMZ4gUnmxGGQDSquzSvwEPz7qkbE8hmyg0RjNKEGAg== 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=TIqzXFiat7pbIGtFHKIXloHJf+aIrPnyJzi7SW06kfM=; b=twq6NePJ44AKqc79SZy8WnItdK4yDWgqmrgc3y44T6nOE8GEPyynSxX09fDLPoHzEcaRrKnZ1bX5KM7LZ22SWOOxG3ZoZx0fq1KFQZ3zR2y3IeKyXKav82rFx2mJS7YrnYyUpXdZZjzNunHK9HTlLNEXbq0GN0mdG3sNv22ENtE= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) by MN2PR12MB4112.namprd12.prod.outlook.com (2603:10b6:208:19a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Tue, 16 Feb 2021 19:08:04 +0000 Received: from BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2]) by BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2%6]) with mapi id 15.20.3846.031; Tue, 16 Feb 2021 19:08:04 +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: [net,v2, 2/4] net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Date: Wed, 17 Feb 2021 00:37:08 +0530 Message-Id: <20210216190710.2911856-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> References: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) To BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 16 Feb 2021 19:08:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c115b4be-3ba9-4052-660c-08d8d2ae2f84 X-MS-TrafficTypeDiagnostic: MN2PR12MB4112: 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: M3nEi2Ko8wWiL9VnG+ngNGP3YAhQxYCDTHpwTutofnXKuIZfxr8aQqIDxki/WlAOwYDJAQOcHh65pzTDGeGD5fruXXbiqkdrosYgl9wTewdfo/oKDI6RiAS7kdRfevNjf2sSiLXrFhLOtvDzYhOm0OyOcCDdVN418BjSrR8p+NE5Vf7iiF1g3ozYdPoK3nDAY54RcHWDIFCHNkwMrYR6ucWqLq7tSi4dDWAg3bvDAMZlLgGO8RFAbu2SX0WFsmt/hBUHmPoOt8WcTX9o2r/dIzOOWiTeuePy5nM6wFXTgW1QoCC6UBbnKivpzu15AEz2gxmLyJJNPBSuSN6Z1LBl/qE2+yB4SNZ0lRiv2LlR0V6psK9wYtbjse8m69ZCwbrsjb9Dnom10FLcH1B5LEmpcGSZr6rrONRIEy7bl90iyR6vuLkHz1B8/LrV9JgL107qMePUJLBVMM/IYjNhdYiRYOBJHJvlWchVsVh7H6ZLB2JkVLVlBtRxq/T/PD8emz9eESS27ORboqiDgPlcEFalQQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB2484.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39860400002)(376002)(366004)(136003)(396003)(7696005)(54906003)(1076003)(83380400001)(8936002)(86362001)(66476007)(2906002)(4326008)(8676002)(52116002)(5660300002)(478600001)(110136005)(186003)(26005)(956004)(66946007)(2616005)(45080400002)(316002)(16526019)(66556008)(36756003)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1JqZa2YYajhtsUU+YkMVpTMp2KcJiRE6oLaVzw/tocDVfYKMlnYXRqM7s6kclzrBeTgfDUHkR0EInmcAA2M7neMuYSQESiczmtoFAB/R0BP9ZJ7Np/ZoNqgGZbebeUj7DrTCbdvIQjYvkOpq5NC9GGwRbC+XQU1hNZHB/PdCypIf0YXVRwMmSb6YL/3oKfi8n5yU+GgT6rnO/5jnjZ7remsYeBJoRC0BAYyF+fz/7twQ0M9sqiyJu725tEvTd8/lVyDnbYKhzREyxK1BIUC5n/FRr2QGD2NXA6rlfa+xFzpAFm+15aGE0hDFZd5lRF+MrP9nkYuB11Z/hJhvcMtUqILWKnjLjOscUijvWYjJ3eqIaPHmd5GdG9SPIJhcDKKQRi4jJg4IB5X0OePKnPF8KhckEThzL7aZQzgueVnPI4s984rWd1dq7ZvMSk+UEBLkY+O90+XKbrSXzJ3Bt/4gVZCr9tjN1LatukX6HGt3j0M3N6MNlRBDfYXsvifUtb7OKHx5G6Sa+lZbj8woK0rcWBZevY+kg9JSW43Fe7tBQIxT7OqWUMstG7jOiIAno2AuBVvUSs6B1BgGrBKEFB7Z36gaPeEakBO5OxSySzVTzqj4/Jg72WXGIQKZqOjMiDSm6TV/YGRwh+MbsMs4RUyl45zhOaCuVbG8Q7uFb11hIDexrpqXNXrir5+c76IEJiO8xmGOsMKsKXFmacAbFPteH3CFvvIzbb1rUlUkNYR93sbZCFMHYvaRL1xmqhgERA2+1Zno/fzMWqEXFI6xZMWE4m7QlqmBQIfkrmS+oPdg7tSyN3M9YS66gL0kaFogyXFgqBmrSp4Kmg7RfByE6i79sJub/WBfTH/DceaFHP1Uu5fzesUUQvDEggKkegCAglja4ShD8KXMDpjuXp10w+dpMf7tL2gmiafHNFHModdX2jDF3ii1ePNvsxwi3tXrokyOOgsf8YxXOo8DBIGawU1ceT4P+vr6UGOEjZjSRHsf+7XIP8xja1QbPylusYcR6dblG0QI0VmcTGFyWVIn22QcH3HmGgea/HJMmeSjY8tcJOy/NAN2haqOlTvkCBnDVzexC06wEOBW7FtDZShmv9uiLTGb1NPYYRuRWsIYubPQQk0Zj7DbrNq2KGPGMXPds4xo6npYeQ5w7kvnhwwBO9IjTvaVlYbR7aacCGPKw8xWd0KndGAi+w2KZUBOm0WK4WFAQ2gB3AH70L2+wFaJkYL3u+pLkdJucQdx6tzgAu/Mu3o+sb4kgDRjXvLx/bKVXnBfAWVHkH4WkuMMc3t+RVyQLOViyZklf+eAnqvWvn8K9cxF8Ttmi2VZpd2FigZb1NZp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c115b4be-3ba9-4052-660c-08d8d2ae2f84 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2484.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 19:08:03.9351 (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: xD34UpfB0ovUazhJQjrNRgeGf0+IIWg/1KXkEP6YmBs3xc6rbp6TuqMYklTIiLshLOHFhUT8SLKuLLMbvdLIjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4112 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The current driver calls netif_carrier_off() late in the link tear down which can result in a netdev watchdog timeout. Calling netif_carrier_off() immediately after netif_tx_stop_all_queues() 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 Fixes: e722ec82374b ("amd-xgbe: Update the BelFuse quirk to support SGMII") Co-developed-by: Sudheesh Mavila Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- v1->v2: - Add Co-Developed-by: and Fixes: tag - Commit message changes. 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 Tue Feb 16 19:07: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: 12090527 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 5B4C4C43381 for ; Tue, 16 Feb 2021 19:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3881064E28 for ; Tue, 16 Feb 2021 19:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231282AbhBPTJp (ORCPT ); Tue, 16 Feb 2021 14:09:45 -0500 Received: from mail-bn8nam12on2064.outbound.protection.outlook.com ([40.107.237.64]:26688 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231254AbhBPTJh (ORCPT ); Tue, 16 Feb 2021 14:09:37 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZSiJ2QSuBWrOMrPbyshyCrmgE+Lqn1bbtMJ6szRDYH70dcpZBfEDvW2r6oSL3ehq21JKY2OAEV2AfcvzR5n8IlCXCvVn9GbkOgiuHLJdTX0DKWYnxLb0K78Q2J7w+6k9IDCpU7+rT/Oc1VX7C/q57WoyzwERiwCPArOTOL4y16GbMfx4biLooISmZzX3c/6jZuhDEoATZemwi4Dt+1YOyzvvyIUBWelbojdp1lRuz6LIhXpwN3uCugA7yKhm1eqLZqnaieQ13vSY1556wCBUCF2nUkiSnqHXY2vBGjUuOA8t4Hr+k/LQ1laMasY+XIHSI6qcq5rd+0ty6aDKA3VpHQ== 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=dKQApd0mf6MLiz+QFWvbOF9BGGxhNSaGblNTzHzxCsk=; b=RAFLeab8/ha1AcLqbZ10UZlr5pA5+cCL8gxZCX/QsAEVJzV1L0Sel6IKNS9K81S4vacqJCOcQDBC3fomZ90CSqgWciUvTOcSR3fRHfIzdd5j2qTzsjNSood0SyZ7/80rCWU072B/f1aLI0GQOKftNDqY29p5EzJ5en4Pwmlcl1DguR7+/2ePq/kx9jOerpl/bWrObP63m5yujnD9K0udOaI+f+ikBfPw7dllcUIPkx24nE/xbU8QTPmZUkEvRZ3nLAsZTQDGL8/U215bk/H+WZKW9jlky3yvu4qVIbtKByybWL4xatf5JAjO9pgUzdVsZMcMmmsgWbRjbpZvO6rl3A== 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=dKQApd0mf6MLiz+QFWvbOF9BGGxhNSaGblNTzHzxCsk=; b=sdd2OB+QctKv3wblRh37LDMpllOb0777lelJ02pB2EjInaOPPidlhj+Rnh1PBlyRCyqGbNCg5g87M5UPo50pqL/WVMAZVhBZ15hDGVkNtJUPSYAsOr+MBgelpDruU6wwKNlmxOQ70CZ7ZgTp4mjb4tY2TzkQPYoL2xfc9OGxD24= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) by MN2PR12MB4112.namprd12.prod.outlook.com (2603:10b6:208:19a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Tue, 16 Feb 2021 19:08:15 +0000 Received: from BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2]) by BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2%6]) with mapi id 15.20.3846.031; Tue, 16 Feb 2021 19:08:14 +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: [net,v2, 3/4] net: amd-xgbe: Reset link when the link never comes back Date: Wed, 17 Feb 2021 00:37:09 +0530 Message-Id: <20210216190710.2911856-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> References: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) To BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 16 Feb 2021 19:08:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f1b894ba-1ef0-4b5a-48ac-08d8d2ae3613 X-MS-TrafficTypeDiagnostic: MN2PR12MB4112: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c4AKReY/kZOdY7StxKXDJxBFgHYJPR9R/XwMwpxuiMcMOMCigtmfKoGc7CtvPoyAULTEBSXTj/LLCaBUeBgQklkvHjGmxzlqFUoz/g5/iYSnmc5yIkCbo/AigBx7g3DX90F7s8u6peXY5Jv2Fni2Z6Pg7PLnd3YFz/uVAnl2kVb6Rb76M1ysXUsN65G2FEUhU85YP1SUKJyPhCacwWk8F/NuiBeIOjb9abeQhnHZ2WDVG3oAu9a3ex4hCPrrxkoTzPA7J9GPsnwPVUFlzMXdzUweMA1F+1vBT2SmqixA7hbdPjk/n9zTQXVAQ4fjAECw5krg0tjc+UXQ5YGkf0L/+pDQIgqivxg+QTudFhU/EPw/EOPlRmL8EzxXRutktvocE11r3z926zqSRSvzuvHnnHZTlybyzALbfoXYT04DB7qHH4KalVAKoVerHAi71/e2lOOyct256nsY0ZZi9DbE0XRhqrSvEbxQ4sxlgU2cd/ZRjeCl2n3j9wYQSwLzCqA55Czw1EZj/D3Vyolhp6A88w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB2484.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39860400002)(376002)(366004)(136003)(396003)(7696005)(54906003)(1076003)(83380400001)(8936002)(86362001)(6666004)(66476007)(2906002)(4326008)(8676002)(52116002)(5660300002)(478600001)(110136005)(186003)(26005)(956004)(66946007)(2616005)(316002)(16526019)(66556008)(36756003)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TghOvwHDMS2nVH38UpTDZ+rFzS+Qemxo5jg1hS1sH8qAnbC3BcjP/ZhKbVaYpOtDlAWjGl2AJCC62m1h9cmSUd6XtShT9cf1+6KB1/h0401VcJv3rzZZrWXutAHdOLytda4urluJVrVuCb5KVeam086M8wjOybRg4eakjS8oTWs9U/jyI7NU4p+CgmSRjn1TdFbp9npvxHqIt4YrZTHm2SOYHf9JD8R/8tYfg0fs+UQePREW+GlHDWueEptUhaa0H8giY9k3xhEJpCO9WosYTyhX9bW6OpT4hShC4OGO0SOmzpp0taJS2cP3Jpjqxz5ob544ghcRGwK1jF8swU7Iu9kY14ybW13bFrtlvOqOZ5UYmEchvgLQybW1U/ZVR617zsL51GBS9Kk3ghTRdt7GRRkPKGtvxQp/VyFgbbVsgZ6ZSbtuT1p3pt+OrY6FC0BEk7XZFgxkFvEYrlG7SJNdpzeuDOqPqg9rc+ForEGosBLTGaCuoHVZ4jfIxTO60WcibnOhBLNjqDPS/fuYNP6aqn/es37/zHZDK7rihquO1+b3r68CFh7v7uoDUkBt1ansOnU5NpynYBRjuFVg7Q2YTCdAn/24/BopSifVPaWHRJtJMVCj71k2w+FmScTQUs/vXLAFE6xxYrfdCYFsF5tnf6Zp1yzbAzslMfqhlCJWmbczhkSG1C6VhIse6+SK/I7hlNQuPgz7Kbo4GnNbCOpVNboIHDy5fv8j1AIsasJXp9+4E9Su1Ej2zTKX5jGxWyOIRqk/66POfeDsqBI5GVr0oNi8bTsfnTx51MotPpCk8BIKI4LK4+xNOXIQvq9/1KFVGgw8MqLeCHgT0naPjjRlHeSPB2iy4pHFhvoPpZa8FRcKR64hvzzt0X7kpojeG5kBt3GKkH8Bcb2X6aV8q8hTozDQwxc8cWiwlCSTJYj0qFXyZi1ddwwR+1Z3QtOQlH6e9bQRiezsJQlFW8QgwE9OFT5kAa+fs+kShXoIwlaAAzfSSSNIiEDdk51kQwAW09+GSSq/GfDAWfRI/xOcqDTXDbAnRuprvxxbsZ7VVUswkKZecU775KBAl4gKqupbqoDV12jcFzvpNORiwauE+kfFIr4gO1xwxiJU29wb8JJaL3a4+s55GX3V6i0ILJEJLobKaEsFDzphNK9KdW3eVzi4Qj2FUpT+0/0Sb4RXOCgbUWLYQhAwJGaqQ6wrbTtE26KIfYM3sZjzEfQsVs1sQrocA9H/ijFuGPJcLG/72BZ6THlnkG3vTw/fxAeiwcZt0rJVsUbV6l1GSXgW9DMzQGBle2IXMz5Ej0zaOKzYN6NRPudq94TgbtEYfJBTgCLL4vnq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1b894ba-1ef0-4b5a-48ac-08d8d2ae3613 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2484.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 19:08:14.8539 (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: 7DA4xlFqSHr3BuHLDBu0DfHzOPD3hy/axAPz0yk1n/cxodKCbjqQmxBdwnU+HoR2ic/qQR7acp1EB7uW2k+Yfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4112 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 needs an auto-negotiation restart. Also, a change in xgbe-mdio is needed to get ethtool to recognize the link down and get the link change message. This change is only required in a backplane connection mode. Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules") Co-developed-by: Sudheesh Mavila Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- v1->v2: - Commit message changes - Add Co-Developed-by: and Fixes: tag 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 087948085ae1..d3f72faecd1d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -2610,6 +2610,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 Tue Feb 16 19:07: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: 12090525 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 2C5C3C433E9 for ; Tue, 16 Feb 2021 19:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 072F864E28 for ; Tue, 16 Feb 2021 19:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbhBPTJm (ORCPT ); Tue, 16 Feb 2021 14:09:42 -0500 Received: from mail-bn8nam12on2058.outbound.protection.outlook.com ([40.107.237.58]:51168 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231236AbhBPTJf (ORCPT ); Tue, 16 Feb 2021 14:09:35 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PNN6xXsRpxSXzYU8y9sRr8v2gXbXu6EVNQ/NjTUdk6DrASc+gPIr3M/Ol10iKl1v5Pr9+Qe+0wJQ+O9h9WVMpTPj0Z8xEYHWg/+uJjPl8Ioeg683wW8FWL2y9+n7J62h2oz7Ad0ZX1x9NCJ17G7CnRBjhLuhCVtkZWEBAxoHru6HIuXUsgCXoscLffV6eU7WZCgT/107XxS4d2uPjoo04PEWjHC5u7XLyvAWtZ0BK2d9ISg1DMKIcCYTzA95bgGJ9m2aWne1Pcohk6jY8JbJrWk4ys1JXD1nBxiCpVgCjkg2T5KJ6xxIjeh6YFGfHK5c5qPyPf/cHRIl8JtAKezj9Q== 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=v0LNsyiMZVZ4TKwsOk1oNTqslbwWUaCQ7+gv+tx3T6Y=; b=h3anAlbO6A5+33SuLfcrympldpIP+i7GjM6OstkYEO3YC3FA+gsNFhERQ8BR23hYvEDUn3M8NIFIYjkkkvpzd7WE8Qlkx/e2yd5R6W38206HoFI6eie7ByMhLh4Eq0U7fcLzDvoBEEupvMoK+wSeY9y6KVVif0guxfvipfJ33EOzT5QA7o0dq3FJChc/JRhSV6Csmt/KeQjY2T4Sq0oFvNc/kPhIJ8rvxk3hHiT313rBWnXXmu6BWodkbut59jNcGCWVhFaESAteMg06tUsssdjVbuJczBQn6RRCG+2qFbO8mXRVKDZgcWVKpPe/JsvynoVplx1/NI4Ms1PpkAOC0g== 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=v0LNsyiMZVZ4TKwsOk1oNTqslbwWUaCQ7+gv+tx3T6Y=; b=Rvg3L3/h4mkEmJ74W8/V8SD9jy6JKYJrXoqfhSn8K8ZNt0MfxWyRLQvUN1UKl785hqCzYLKlwXNMuZi2awN/QHhFzGaymDW7/fek+Wm/cxgrfIR/IvPCvcwQJzJ4BIXf5IjQ0SKMOi+pNbIizgieSsfGYv+1t4UwjDKtaJc4FdM= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) by MN2PR12MB4112.namprd12.prod.outlook.com (2603:10b6:208:19a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Tue, 16 Feb 2021 19:08:22 +0000 Received: from BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2]) by BL0PR12MB2484.namprd12.prod.outlook.com ([fe80::5883:dfcd:a28:36f2%6]) with mapi id 15.20.3846.031; Tue, 16 Feb 2021 19:08:22 +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: [net,v2, 4/4] net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Date: Wed, 17 Feb 2021 00:37:10 +0530 Message-Id: <20210216190710.2911856-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> References: <20210216190710.2911856-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) To BL0PR12MB2484.namprd12.prod.outlook.com (2603:10b6:207:4e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0074.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 16 Feb 2021 19:08:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 45ff2d9e-0107-4d30-6471-08d8d2ae3a63 X-MS-TrafficTypeDiagnostic: MN2PR12MB4112: 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: 7RRB9f6k7JCnlvNlW6NMTaKPO5fIN6QDOGixKOloHZq4c5/6El8dkmHXIky58Wj8ujqdUVrcDlwvAjNGqr2uENtmNYt6W9rdLXD22WTrf8i2dU74+EXVxHuNlignWIqamTICE2GI+UFi1rAsSc0aKnX4opmoikCKm2jAUQ0ve/8f/Dw6W48iQN3PgtLIhBmnh1ZUUKhsOxJ6NW0u/bEqB++jpPxCZZcbPtf0/8IsZaL1u92gonDHlmkblEhjif9SwRFGuwnDaRejtyyJzi7+jU/yC4k/cT8gLTYv4ldohq8WDNA8epjnEt97v+5ZBDxjh5njrlFHZoZ/vkZI7Ir79MubGWDO6wk30OxARYFbZ1r33Df3UwSYu4vwHNrwiFZdhclAYBK49IwGP+YNn/lHGJjkkhhC8GAEdw04M35bjwPwp121uvQ14GQyMvMUE5DWRn01xxxbTQJOcsOYI4ZjhzWYGAkM42ewiBOAW+LApbJHqoS+7frP5XTtWafPC6ICoJgtrkMSp3uPeEBuwwxu8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB2484.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39860400002)(376002)(366004)(136003)(396003)(7696005)(54906003)(1076003)(83380400001)(8936002)(86362001)(6666004)(66476007)(2906002)(4326008)(8676002)(52116002)(5660300002)(478600001)(110136005)(186003)(26005)(956004)(66946007)(2616005)(316002)(16526019)(66556008)(36756003)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AO3WNrxRlgzkwACeaVarCokd1vkejUToKyNlt5MkxBY/hHtimoik9g8EEdgMEDWgXm4R4fTDVq7KQZ/GeaNDb1gqb+gpaRmP/EyQFqHbILQftgbK/NfDskKJ6faAVX5qJmyihz9LxRAQ4s3n0R/wABEv1jW9lSDH4baa/7AKJGSQCPrxENgLsmscQQlrljPKDdIY5yKVFyrHy816L465X1f5zrbjKBEbJP0ZxwIHvipE1l0L3mRCako1+G0az3Te8xRj+DDNP91GKRjiaWvnr8v492G7OpfwZz5R8cVd8fIFOidm1y7f0qQ5QiUfYIC+PFr/0s5L/xAqYWyMP1NAI2jF98Fa80I6wNwlEErS5VxvrZ8fbhl4Np+idGSzgF+Fr2t4MNLe/D9lDX7gOlNz2WAjzJQm2Gsgsu2d+iy/GzKLg0GnZ8z1ajXH5EOEErjXR+aKDsIOEDOnoJuICCTOJFEOCcC4n4jmjhhiVoGuQGmWZK7gusiY7Q/stfOMsYcZPOFnH8e0r9DJwbVw0HAN4jzwhEzvnxPUtF1dcHt58AwryQQo5MJeNLmM5zeL6hjwR/kV7ZR1SaXxM7Ha8JDiGXCPRq1Uj6pRLJ1ATE9LRmSHZSPoqNLnSEDUKRQrVjrEHPlNoLr6SY6rawwpiBLMpvTsQD6vrkSBynSPdzRViUwsPvOPaQO+JfkCOWFchCcIsxAJAb8hAXeg2a26L753pUbYh+QaAKCXyCPvHJ3uRy7tVrdB3NDB9rTHNioSHSfVMDCK955+PY6xTNV97CCKIHXJYgqmFSxr7ic2F7jpyJ2QQwaxO51r5GIS2ZPZK9KTOYy1UkDZ2LUORNOgZXYiT8i9PsRqoykKYRUL8BxLGsF9+WPwKE6CpE4WMDloLKY6rpT/S9E7MT51Kt1yyoqzIobVgXxhWaBzwMdASV2pO5j/y9w0KlFS25En2COAoZ0K6vOhOoZfQyOBzcAUO4EUN+xMZobTQyBpOPzooXUF0G/1beYznyTTdk3E2omEnXJCUIE8rMUbPPARoXGi2948e6vn0i8Q4H//sYpEW1CPs78zIMuWEAIUgXkPHXLYNEj6dLXC4s7i2A8gtHT1Z8ehdhtxVAsCv5PoXdBBbaOmNT8XFxZ+Bq7t7xeo4uSCzt8upu9miypTfFcbNvCzjGuvbeSRTJr4DFim/eV1vhUdWWZPmlXEuXwhfsnRQa46C1FIpHwbbQ//VeEK5xxWYQq68XWoJz0xkvGG1WilZHTcCGV2YWISxoIaRziU7bdLs8UJlBhRlA4xZATqxrNrwvIJ+5rxsm9foUIEHeLJX6ABwrnpR+givUxDydc8LzFCzNu8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45ff2d9e-0107-4d30-6471-08d8d2ae3a63 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2484.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 19:08:22.3157 (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: ZltXnej/4LCDYnO0yeAaSmHq8zplwqs0LyJL/5h/QlAIHGfWE9r49ieaP0I9H/FlHvcqpgRjBRWQy5cDhPB1MA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4112 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. Fixes: e722ec82374b ("amd-xgbe: Update the BelFuse quirk to support SGMII") Co-developed-by: Sudheesh Mavila Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- v1->v2: - Add Co-Developed-by: and Fixes: tag - Use genphy_soft_reset() as suggested by Florian. drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index d3f72faecd1d..18e48b3bc402 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -922,6 +922,9 @@ 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 */ + genphy_soft_reset(phy_data->phydev); + /* Disable RGMII mode */ phy_write(phy_data->phydev, 0x18, 0x7007); reg = phy_read(phy_data->phydev, 0x18);