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 DE64844153 for ; Tue, 4 Jun 2024 14:13:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60C08436E2; Tue, 4 Jun 2024 14:13:07 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) by mails.dpdk.org (Postfix) with ESMTP id 92B3E436CB; Tue, 4 Jun 2024 14:13:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T8Xzheb9VFq5w46acFlta2n4XAJrdNZTy91hoLNl44gopcdmZWWJIgbq/6Y0J3UNZhtLdrR983HlDTwdPpFZn/BbKbkKuznojNEXeaAD2COdpyoZUHN00kCvOWqyiEo/iJfXCG03opxk8H1IWy1m3rRLNyY6QecdDqwx6RJppeGxJcfnK7p8gIxp+cEeNBdBNzJKkeiJMRvmEP+f8i2+Uvs2SzPDSTzNQ06vhjFGrybnYi/BFDyqIV/9zjVPmyWsQ7+CDFP6Dweurq8Bj7v1JE4mcRBu8+d6wXyaZnOroi3uD31oEHxBpqMQUDlK1qror/fVdRViXK0LWIaru9Sv2Q== 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=BnnLOVCKjXj6P88UvF+SEz5OfG5luhZX0+gkce02Fbg=; b=YsbTTWGRh6GiEJocuqu8Aa/Ytz+oeq6iUPlNV3vdTCn23SEe0JsW+NocUyd+BfMXavgCarcQbMD66Dk4E5nvq1iuZpF6Fb/UdjksnsU787HYZ+3opXB3R2L641MAuRBptFrh1u+QdRfH4LS0vA6Anuf8C89Ly8VbBRDs1bWfQ4EVJZbwsyia0bQ1JQSq06rov2MEBX77RpQ7sfRVFX/ZHG+bbfdCNV064pMiDKRMNnAm08z27eHZnU069gP8yCVHwOpZCqbJtEwsAdHn9p/Xajsu/gpaBiTgh4ljUDuoKwmD9IyURfkHVZ5hAfldNIoQ7JA3s2BUhc2HNHOHB6M4Mg== 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=BnnLOVCKjXj6P88UvF+SEz5OfG5luhZX0+gkce02Fbg=; b=Wo4hf11YrJ96kJ1xUIBI0JGBEaRJAgI0UgiMLoos+OzZMMh7xb11HyHciCdSia/tBchrxSBu98ibVwvMZ82gIFsvzBv2DWtggrAKo+/+OtRf5/DiKiGxDy+FpOIfxaHtptLQpXtgNN1jIqvGwdejyHnLexwzUaCPN+MJwFWywOg= Received: from MN2PR10CA0004.namprd10.prod.outlook.com (2603:10b6:208:120::17) by SN7PR12MB6863.namprd12.prod.outlook.com (2603:10b6:806:264::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Tue, 4 Jun 2024 12:13:02 +0000 Received: from BN3PEPF0000B372.namprd21.prod.outlook.com (2603:10b6:208:120:cafe::9a) by MN2PR10CA0004.outlook.office365.com (2603:10b6:208:120::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31 via Frontend Transport; Tue, 4 Jun 2024 12:13:02 +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 BN3PEPF0000B372.mail.protection.outlook.com (10.167.243.169) 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:13:02 +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:56 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , , Selwin Sebastian Subject: [PATCH v3 13/25] net/axgbe: fix the false linkup in axgbe PHY status Date: Tue, 4 Jun 2024 17:41:45 +0530 Message-ID: <20240604121157.3052-13-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: BN3PEPF0000B372:EE_|SN7PR12MB6863:EE_ X-MS-Office365-Filtering-Correlation-Id: 71e3f3f5-aacd-4ffc-4585-08dc848fae7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|376005|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tQudcBdRERlU+YYRafeBHefdQt7ktQXKTPDfuHgHdr/VeXvbRjwJLno44j4+?= =?us-ascii?Q?1FYiDnXKsczwLrwcA/0LbVCqikM6e4xftZCCzhOMQnY+c/uP/P5DlYBjzHeo?= =?us-ascii?Q?8lbaU3ty3twB43cTjNKkbvnkC5pLa1b+iOQcf0LZKxrwlY0wMvDe3dDnMPh2?= =?us-ascii?Q?25lYG7FMqWNo8aG8iI2n+Wci3SrA+dpjvNihKIrQbrQO4aGaVAEAbHTciKFh?= =?us-ascii?Q?dRoLjRavsbh9XTx5IYSX1jpklUHvf/uzHTEGb6CKoQvfJ8b8c4yTt8WIVT74?= =?us-ascii?Q?cmNFe7gD2Joe7KeMYQ6UXbwcYBjwuhGnXlhj6ZTVgSuYRSw1nLZ+jv4oYpOY?= =?us-ascii?Q?3v85QGN0rqEdidFJBW+r8xt5+Toml4h62m3s38YzDEk7c8agcO0LHYTNQfvd?= =?us-ascii?Q?PJhij3sdfl8VrNDL7bLqjop1nwL0c6v7wSX+k2V7W2jV7sMmHR4dL/vQZWBs?= =?us-ascii?Q?wjqvn+xvSo81/96jrseuknmVbRlbs/6KOjaWVn2W6SQ8gtLxYxJ8BjIva2TU?= =?us-ascii?Q?OkFcHKBsLPxiO6b0/r2/Sj3Ic5EHMpq28HshjjeW9mcuw1EiAQ+zRBFafXZY?= =?us-ascii?Q?xB+pFarLnw9ML8QHDTQzCKsL3hf1Z7wPn9Q3i5Es5+jzjtUaCsfHVszL8VcL?= =?us-ascii?Q?bfQIGX/M9LtCP9Q9gH/vQ2pwbraXNfmZJcCdWPuVbdqnNXXiZLJW4fPXKaP1?= =?us-ascii?Q?NMOJXM+FgF2hzbllK24D1oGerZ/tIxsGb6DxtHQmsdp65UVesM/zK+Isbxln?= =?us-ascii?Q?IKaSoFuSgANsJeoWBpvsZ62PEPWIYmowl4pO9x0aSRce9MLBrn2PftRFj0uP?= =?us-ascii?Q?+hIGRoQVUs3h3eRvGozhWwbNp4ijgcCJhugyZ/0iyTRhTv76d0QkDBTuyUTW?= =?us-ascii?Q?W9769fgrAMDsFdRBHYHBFgyC/FyzwvasbOiIOvh0CoVev8RlgTbDjwhLBqZS?= =?us-ascii?Q?l/iqjPQmK2K1JABFNBb5bit/AzYa8gCJ2eqCa1SBXxLpEtYkysDs9KVgK4RI?= =?us-ascii?Q?Ctr4SFfi8prvMwsv0MlTxd/iUVqGedezc0NvhrQ3KAMs7N0t9yAIrj1OXMaL?= =?us-ascii?Q?80gSkCPbVoPSzuMeD7/dG4u9jGWcQPKmPU7yIWY8pqN8gquW9n1Vz8PKDftM?= =?us-ascii?Q?WlkzttisbX+ECXHusdWf9eB/RUGcBy6MK9f40Q3RpvNufmTmQYjoVHqjkwah?= =?us-ascii?Q?ALng8LjLnDBxjj4Ea6vRYO5K4t96f9AREaAHwufpobCA8o58EAN7XmLKEO4y?= =?us-ascii?Q?Qss7ONTJV0Osnd1VKKv+EvjaWX01MeehV43WEw7OmA047Up88KB+I3G4I1zx?= =?us-ascii?Q?JqRQ7mDySRktAHB4G7d+jb7Wo+JM4tVkZkBn8dIwCFpUq6sn50KHAD5dNxNd?= =?us-ascii?Q?zPOfl+kYP4uwJ57FM/MyAMaq5nSvDfist9UdC+Mb6cADjPi9LQ=3D=3D?= 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)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:13:02.1934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71e3f3f5-aacd-4ffc-4585-08dc848fae7d 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: BN3PEPF0000B372.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6863 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 In the event of a change in AXGBE mode, the current auto-negotiation needs to be reset and the AN cycle needs to be re-triggered. However, the current code ignores the return value of axgbe_set_mode(), leading to false information as the link is declared without checking the status register. Fix this by propagating the mode switch status information to axgbe_phy_status(). Fixes: 102b6ec3d5c3 ("net/axgbe: support auto-negotiation for 1Gbps") Cc: stable@dpdk.org Signed-off-by: Venkat Kumar Ande Acked-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_mdio.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c index e1a737cf62..d95a52659e 100644 --- a/drivers/net/axgbe/axgbe_mdio.c +++ b/drivers/net/axgbe/axgbe_mdio.c @@ -200,13 +200,14 @@ static void axgbe_switch_mode(struct axgbe_port *pdata) axgbe_change_mode(pdata, pdata->phy_if.phy_impl.switch_mode(pdata)); } -static void axgbe_set_mode(struct axgbe_port *pdata, +static bool axgbe_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode) { if (mode == axgbe_cur_mode(pdata)) - return; + return false; axgbe_change_mode(pdata, mode); + return true; } static bool axgbe_use_mode(struct axgbe_port *pdata, @@ -1007,7 +1008,7 @@ static enum axgbe_mode axgbe_phy_status_aneg(struct axgbe_port *pdata) return pdata->phy_if.phy_impl.an_outcome(pdata); } -static void axgbe_phy_status_result(struct axgbe_port *pdata) +static bool axgbe_phy_status_result(struct axgbe_port *pdata) { enum axgbe_mode mode; @@ -1041,7 +1042,10 @@ static void axgbe_phy_status_result(struct axgbe_port *pdata) pdata->phy.duplex = DUPLEX_FULL; - axgbe_set_mode(pdata, mode); + if (axgbe_set_mode(pdata, mode)) + return true; + else + return false; } static int autoneg_time_out(unsigned long autoneg_start_time) @@ -1108,7 +1112,10 @@ static void axgbe_phy_status(struct axgbe_port *pdata) return; } } - axgbe_phy_status_result(pdata); + + if (axgbe_phy_status_result(pdata)) + return; + if (rte_bit_relaxed_get32(AXGBE_LINK_INIT, &pdata->dev_state)) rte_bit_relaxed_clear32(AXGBE_LINK_INIT, &pdata->dev_state); -- 2.34.1