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 159A043FC9 for ; Tue, 7 May 2024 14:44:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71107433DC; Tue, 7 May 2024 14:44:11 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2045.outbound.protection.outlook.com [40.107.93.45]) by mails.dpdk.org (Postfix) with ESMTP id B7EFF433C7; Tue, 7 May 2024 14:44:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVvEJgWq8R55p3UZJIa1LPcwTINSCRC2NNp6OSDRifqyQDskDSrfxrzkcgcUByZcV9mmtaSUIfatUWb6zJRNSSgRl3hmJMLpRcBZd/AEuu6YWYaaMyVwOAgNR4gFGIAB4w0e+JD1tIYvLltSBihdb7kG7N/jGLxA4okuy+gw+u/mmmEeINFVoj/FNmkPtb4SqdhTCNLzWN2QSlVDyDe5kLy/vhGlS9e1JOMimsEKBa7jwJ4u+KbNtAGJxVkyC2xIxtZ1J4fszjKU2qWO91TJegVMqF8kBGl7rN2eVQp7RzdHoUry5BdB/FUrbOM9XZGK16t7pPYcmfxRBp44/siQ5w== 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=4C6WUrfnRtBasiF4Qk7C2+/3Uo3/RkGocpAsjy8ebiY=; b=kt5hTa4ZWUJb6CCC4af/dS4EYI7WxP/YG6/3fXy+93URwFMaeppPd7iuzOr50rMlIeivQ/7ruw2pGz/ZG4AuZgFvAkCfPuc9rM9tIx4Uky48zgPzyYyCWop79uwmpD0ggrkfdznEHX35V80tjR2Fj7+eIwPx1VeiYigF7jVRInK9lRON30kClJ0mA2UFrahjhEQp4xVAuQJy86CLY+QI8rxduzY3ebchKR2OnrSZx4Sb1HzUJwQkGGtSVRxq2N5B5PcxOUyu8yTGhNyn+z4c23SjVcCmUu+cWcAwphq3Te1c3RlMdz1fa+uO5VyokM7TBgd8x7jv/Smghx4vv5V2iQ== 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=4C6WUrfnRtBasiF4Qk7C2+/3Uo3/RkGocpAsjy8ebiY=; b=ebD7J0uUZihp6iPd+WdCQ7xiuRVx+ZSk7jfKi0Bkc9FXeteFwPFlkrH+397nDueBp4hfI55nfuA/dyWX4+s7i2Nf02Pg6QKzoqRewLGVpsYE4uQcBCcM0s+4jrnQNOnJXAAWtKVzQ8bCXCmNqm5xVFAcwZKVozUd7OuxKupmE8s= Received: from PH7PR03CA0005.namprd03.prod.outlook.com (2603:10b6:510:339::31) by PH8PR12MB7447.namprd12.prod.outlook.com (2603:10b6:510:215::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Tue, 7 May 2024 12:44:04 +0000 Received: from SN1PEPF00036F3F.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::79) by PH7PR03CA0005.outlook.office365.com (2603:10b6:510:339::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Tue, 7 May 2024 12:44:04 +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 SN1PEPF00036F3F.mail.protection.outlook.com (10.167.248.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 7 May 2024 12:44:03 +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, 7 May 2024 07:44:01 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Subject: [PATCH v2 12/25] net/axgbe: delay AN timeout during KR training Date: Tue, 7 May 2024 18:12:52 +0530 Message-ID: <20240507124305.2318-12-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240507124305.2318-1-venkatkumar.ande@amd.com> References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-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: SN1PEPF00036F3F:EE_|PH8PR12MB7447:EE_ X-MS-Office365-Filtering-Correlation-Id: 7552371d-dfbe-44ff-2a29-08dc6e936091 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wGWtdVADVJwiAn3/6ItF0OiC9ud0N7Maat0fVCqXemyQeWkQu7y4SChih9IJ?= =?us-ascii?Q?y3TEVI5M2RH54C3h627G3mA9wq+Zs+XhPosVY+VocEK2FuznwI0xY5IIVlen?= =?us-ascii?Q?M9CrCUg4Of6KFGkgKUFMUaQ/IhQruGahvA7h6FFr7RcHY/92yt2eZ+Ic6PRy?= =?us-ascii?Q?CMisyjN+aU5nSchONTnn353ZADtKk3v3dvwZWaY9t6wvxZYB65RnTR5D7qC0?= =?us-ascii?Q?jc7smqctmRkOMrPlqb+3GLV4TY03raVJC2jlZTFav4GPXS19MuYdzlSAMNz0?= =?us-ascii?Q?yC6r4QOdTq0+IPpcuJ8ZoqZWE2m8ys9REfenj/JsbkVo3hGJxcOn9WsXNqrd?= =?us-ascii?Q?hvkaVHyoFdxNWWoeayLBA7G3uOJFoEMT61zvfTVoszUYdtQMrDE1MUw6LM10?= =?us-ascii?Q?yLu68toxAnxgnU3kKdnZ3NhT0DWvLTSVHlab3n6UNqd4OYqScy9vizDKmD7f?= =?us-ascii?Q?PQTLWg9bC9xKpg1Z8Mgg99r7N17yu1CLRboAEYjB/LVNmt6gSLHqu2rqlrco?= =?us-ascii?Q?goJEVkHJE+jeiQBpgsoyZ4u5aDruBAnr2hWuXuTUvM/othpOU5gulatoKrTK?= =?us-ascii?Q?5/3925nZQhebjJLGEdedB/zddcA/ymXW4o3IOwz5gTqrVRclUtNnTtQ4SOJK?= =?us-ascii?Q?mtDcCs1w0hWP9toI2jxbiXqffEk7lVLRhINgwBrzn8hE5VnZCbSgA9VG4lKa?= =?us-ascii?Q?1wxmEghqdgYJYqdqUklXCbfvl7u2ljRg6lrnM/KheFCXKSi2o2IF1NSakesc?= =?us-ascii?Q?ieOALyOX4xeOSI0gcbY4Th+/X9x3bDf89oW/xQDK6AXwzzIDmyL3PRhW4Naq?= =?us-ascii?Q?AipAJ3Kgdl1YwoHKtYkjlpgsHqylsqAvciTWofshiKDueuvYoyg1bES5U3qn?= =?us-ascii?Q?LJ0sUC7tvzejyUITbuLaxQa6KiWzSMdoshvHxRPWSyip8vRNXzECAb+4yegd?= =?us-ascii?Q?m29VZ/iAut0UvPlEzG/LLZytmcNxF4HufHD+4TNBZOLrMnmRTDPCWuwUnkDQ?= =?us-ascii?Q?HK99U0VL8vFyC9elIn9bnAiBIBZ6nbNNxjJgkrOHK7/Bmfmf5XonqhqhsbN9?= =?us-ascii?Q?RI3BOyfjiwSHYQ690Ecz7i2P67cZPn5o2b4vlyWFwM8IHRXPnW0jJCuCSxDD?= =?us-ascii?Q?T54FxZRzH5Ni/lXZx5YUOrymC6im1/OLUJbmS8zLqTTQIOFFcwI8MCpOEmrb?= =?us-ascii?Q?aWTEodzNkcEK9FPVsDWWsdmXGp3+aEIlZAK2OnFBPZUZ3MPMPQCYCdCpf61Q?= =?us-ascii?Q?4sBgeun1dj4HMRzEeKh+irWt+tALzoIARcHwuWZg+RvdFy84Sg5E7OBoqo8X?= =?us-ascii?Q?2hPr5Ej/GF8WTn852RTYx/c/g8qiKWuP0hh0Rc4bcVox1V/iXaDaZ2D4b1SM?= =?us-ascii?Q?cv/ptvOZO+FMWC5uR+FnUIWpMKju?= 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)(82310400017)(36860700004)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 12:44:03.8516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7552371d-dfbe-44ff-2a29-08dc6e936091 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: SN1PEPF00036F3F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7447 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 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 --- 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