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 9880544153 for ; Tue, 4 Jun 2024 14:13:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4B7B436DF; Tue, 4 Jun 2024 14:13:04 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2081.outbound.protection.outlook.com [40.107.94.81]) by mails.dpdk.org (Postfix) with ESMTP id 61DEA436D0; Tue, 4 Jun 2024 14:13:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KF+xQCx0fgKGIBAPA0zfl8qeGY3exqAMHekU8+2FxIzr28pfTgeVOt1g4mo98Ro5G/R1sbKyl2R8ivpuZMLlROAxSj0xDTkNOmdBaSa62XGuS3EGI97KTl2dFrZYgr3tFcDvqULIQs98ukKZJ5YQFMm6MFK7CEg21UkxMaQpv9oOQKGZfTmxSNwcRc9FLXEMYeKawZI7AlTTowVlnu83jgXAgBat/r6UhuBnmY3s0lezCGFCzK4yU0HDHuHwVKJZ6lTAn2kQF4BIOwPulclyvFRwD3lV7IoOTitU/bZOE9GoojVP7cHQhOyUFsyRxZQfBvVKpevkWFqSe81tr+2Npg== 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=R+q1xzIZ4jkhNgOq/vmVThYSZ5I5fL9R3wKyzxW6luE=; b=Th1zXtwNQlzDgEiwV9yO1Xl0mlNs50GHqI03FFNAAaitx5kAqy0mnZ3vmWYmSouN7A5/now8E+kA+6Q3YBdvvgfjFW+caa5/XGnc8TKXezk3TJG/aB154HkP3Zh4k2vAVwtccn7hf6Rny9c3KBDb2GKoeegP7ge68MsapPL41f1XsAdq/iyLPhpcBx3G686vepEFhc6HbCFPVjx13LeFKph/WsXk/5AyVkssX3Fmtj+0YlBJ1tj59uM5vq9FfFhE391FCPz83Pq3a3eiTPGvsqdxUjYO9jVYGkDlfEeclWvC/mq/MUoH5n5OfA97Lz57ySpId8of6hcaI+TRaZurkA== 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 (0) 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=R+q1xzIZ4jkhNgOq/vmVThYSZ5I5fL9R3wKyzxW6luE=; b=ptJQi+Ng3LKZn1+PIO8VEqW+QhYz1MQRnzxk50BXj77A1aZ7pCuf6OeJRbVYnfZ4dMtz01U9KjUWdwZT/GBoqlUmZCEWz7w1YaSZvkC1r8p/B3axH/OhCrmz51b0uAWK6X3IpD1d5KrJvMuaxbA9q2OwrmfrP6SAAA0rT/mz9yw= Received: from BN9PR03CA0945.namprd03.prod.outlook.com (2603:10b6:408:108::20) by CH3PR12MB8581.namprd12.prod.outlook.com (2603:10b6:610:15d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Tue, 4 Jun 2024 12:12:55 +0000 Received: from BN3PEPF0000B36E.namprd21.prod.outlook.com (2603:10b6:408:108:cafe::7a) by BN9PR03CA0945.outlook.office365.com (2603:10b6:408:108::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Tue, 4 Jun 2024 12:12:55 +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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B36E.mail.protection.outlook.com (10.167.243.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Tue, 4 Jun 2024 12:12:55 +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.2507.35; Tue, 4 Jun 2024 07:12:53 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , , Selwin Sebastian Subject: [PATCH v3 12/25] net/axgbe: delay AN timeout during KR training Date: Tue, 4 Jun 2024 17:41:44 +0530 Message-ID: <20240604121157.3052-12-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604121157.3052-1-venkatkumar.ande@amd.com> References: <20240507124305.2318-1-VenkatKumar.Ande@amd.com> <20240604121157.3052-1-venkatkumar.ande@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-TrafficTypeDiagnostic: BN3PEPF0000B36E:EE_|CH3PR12MB8581:EE_ X-MS-Office365-Filtering-Correlation-Id: e9b36ae2-bf44-4a7e-548a-08dc848faa7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|82310400017|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Hz+qETSo/ZDCBgh5xg1rF4eyWKfa1O6IRvqZRoN59+j752CQT3cnll43P9hR?= =?us-ascii?Q?eEuUBODkFusEeBsKZgrF/LTjkh7CZGbbsijoV/MRTpJqB+3WZrGpQw9YocJ+?= =?us-ascii?Q?rXoW7o7ANUOMOtdDpXYCrdKZYfdWwqXSL8ctN4IQc5aFXHl4uTRbSYX8r7na?= =?us-ascii?Q?92L9Bj8LrJScCM2LHtYxG5ur8qapTFXFxpbUEvCv8FO5FhG3eMehcGpVv060?= =?us-ascii?Q?rQjVfDTgEUPifMnznCNcxXfwNWwL6t9eSfHolfZ6sktfuk9g/JqDFPn8jrLc?= =?us-ascii?Q?hMP6c7A8OcgJi+Pz8oYMUdmLe0BG2i3eIDRVjST4tsw/fgKDla4BO6vVzava?= =?us-ascii?Q?Zv8V7oHymi4xWhoiLS5wtOg0d7AihFdQk9LCn5bvwEASmtNBPpzNvQxXnvdG?= =?us-ascii?Q?nGsDLtGkoeZVIRL7uLYi72DTN3VOJamNoa/m3CqcPNJbC+cFwhWD38D8dSwH?= =?us-ascii?Q?FGkmXwL9TNVdOAUBP+wJD0Qu0W/Bs0FBq8ypHqri6OlnX4T1h2kwBRjE5XqM?= =?us-ascii?Q?oM5SVH12RlJjT4puQnnZDR2BEegNZLucHfRRR6eg5VFCby1IaG+dWaIEee/j?= =?us-ascii?Q?OED85say5Je/Ftbjg6eH+anFV3jULMHl6FoXCJndPIw1hwL8qIbkV+O0RSOg?= =?us-ascii?Q?3vA3UYfwiYH+y8S3XYwpy5u7bsE/YPO+Svnam3+P4sOoMk2Hex0LoUYCu935?= =?us-ascii?Q?b3zZiPApbWHcMt1QXQVMx+9occM3j+2cBSlHYFKUzWKIHdGHkQxIgbSXJSv0?= =?us-ascii?Q?4/1gv8m7/Oj/ZDGiAvgtdQVrhAoP5+sA0uFJfbXGK+UEBTSVsSQ6MOQ+hec9?= =?us-ascii?Q?BldTopqiYXpgnCbsoxz8AH+j/gV7WYFCYapuOR5r7LSxvUyXZmChG5HGy8Jn?= =?us-ascii?Q?MGloNy5Zt8FoF6gK2jIwdmlGOU3Rni6+StTPl45ypugbqBRzCWpmCkxBJuTn?= =?us-ascii?Q?I7/JmMvnHKb+qxJ3LVxKvU6GnbMNcaIERcnRogViK34pzGIkz03rlDOvd+Ra?= =?us-ascii?Q?Z6d15viKdcETY/ewb4ZidSXhc0lpo7RS0lvfa39oM0CtQr9GSl21QIUI1Jm3?= =?us-ascii?Q?A5FlUxa0ZYDr2tBx0r4U7glC/XI1kTWIdSO5xXazgS7rAyNTEbGMikHZUgXO?= =?us-ascii?Q?wfiYrCtLqJbO1hTjn3WvNIvNLHcDFGhWg/XD94vmA7X02hG/WgzljRhbZy6z?= =?us-ascii?Q?Os6jSvep1Jh+0JQhmMk69womJqpfiPg/JZE0TjVt13gNQSJ+dDDNGY2fZFb8?= =?us-ascii?Q?RnKMhh7IwlLq5DTQoRLAt6HednTgqvjY2Nt+kCMYwU22BSy//rTNA/8cMOZb?= =?us-ascii?Q?hU0vPtv8dXQz+WH9btx+OOFQmoMc9wuAegTjAPtT9C7cRs9Ch9HLIHY6KN8m?= =?us-ascii?Q?wuFlOyvAy2vGwkAxx+dAG/VIINx9?= 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:(13230031)(376005)(82310400017)(1800799015)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:12:55.5051 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9b36ae2-bf44-4a7e-548a-08dc848faa7e 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: BN3PEPF0000B36E.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8581 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Venkat Kumar Ande AN restart triggered during KR training not only aborts the KR training process but also move the HW to unstable state. Driver has to wait up to 500ms or until the KR training is completed before restarting AN cycle. Without the fix the user will face KR training failure issues. Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs") Cc: stable@dpdk.org Signed-off-by: Venkat Kumar Ande Acked-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_ethdev.h | 2 ++ drivers/net/axgbe/axgbe_mdio.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index f122dfd516..d1fac667c2 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -111,6 +111,7 @@ /* Auto-negotiation */ #define AXGBE_AN_MS_TIMEOUT 500 #define AXGBE_LINK_TIMEOUT 5 +#define AXGBE_KR_TRAINING_WAIT_ITER 50 #define AXGBE_SGMII_AN_LINK_STATUS BIT(1) #define AXGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3)) @@ -661,6 +662,7 @@ struct axgbe_port { unsigned int parallel_detect; unsigned int fec_ability; unsigned long an_start; + unsigned long kr_start_time; enum axgbe_an_mode an_mode; /* I2C support */ diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c index b03bc471cb..e1a737cf62 100644 --- a/drivers/net/axgbe/axgbe_mdio.c +++ b/drivers/net/axgbe/axgbe_mdio.c @@ -357,6 +357,7 @@ static enum axgbe_an axgbe_an73_tx_training(struct axgbe_port *pdata, reg |= AXGBE_KR_TRAINING_ENABLE; reg |= AXGBE_KR_TRAINING_START; XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); + pdata->kr_start_time = rte_get_timer_cycles(); PMD_DRV_LOG(DEBUG, "KR training initiated\n"); if (pdata->phy_if.phy_impl.kr_training_post) @@ -487,6 +488,7 @@ static enum axgbe_an axgbe_an73_incompat_link(struct axgbe_port *pdata) axgbe_an_disable(pdata); axgbe_switch_mode(pdata); + pdata->an_result = AXGBE_AN_READY; axgbe_an_restart(pdata); return AXGBE_AN_INCOMPAT_LINK; @@ -967,11 +969,34 @@ static void axgbe_check_link_timeout(struct axgbe_port *pdata) { unsigned long link_timeout; unsigned long ticks; + unsigned long kr_time; + int wait; link_timeout = pdata->link_check + (AXGBE_LINK_TIMEOUT * 2 * rte_get_timer_hz()); ticks = rte_get_timer_cycles(); if (time_after(ticks, link_timeout)) { + if ((axgbe_cur_mode(pdata) == AXGBE_MODE_KR) && + pdata->phy.autoneg == AUTONEG_ENABLE) { + /* AN restart should not happen while KR training is in progress. + * The while loop ensures no AN restart during KR training, + * waits up to 500ms and AN restart is triggered only if KR + * training is failed. + */ + wait = AXGBE_KR_TRAINING_WAIT_ITER; + while (wait--) { + kr_time = pdata->kr_start_time + + msecs_to_timer_cycles(AXGBE_AN_MS_TIMEOUT); + ticks = rte_get_timer_cycles(); + if (time_after(ticks, kr_time)) + break; + /* AN restart is not required, if AN result is COMPLETE */ + if (pdata->an_result == AXGBE_AN_COMPLETE) + return; + rte_delay_us(10500); + } + } + PMD_DRV_LOG(NOTICE, "AN link timeout\n"); axgbe_phy_config_aneg(pdata); } -- 2.34.1