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 0523EA0352; Tue, 25 Jan 2022 13:19:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6FD42941; Tue, 25 Jan 2022 13:19:37 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2045.outbound.protection.outlook.com [40.107.95.45]) by mails.dpdk.org (Postfix) with ESMTP id 036D5426DF for ; Tue, 25 Jan 2022 13:19:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9RslYuVqbJyDDgJEwcYRagHeZZ5aQ/+1ATKgZqrML8D7AbodI8DK138A3cNfe90Ger0C0Ghoy1QKdXi8tMgb6tHvddpjesaVLAtFdXg+Bx3lNye31I+MPhe/lU3HtNQvjQJuvGDi314k8hImmtuQrT0xWiwVdSZv+Q6s+5C9QMpfWU9WZ4CJf2tI8oRBzNcL4QTppc03CI+v20E6Sx+35LujbG+BpRJJDmIfm3wJHCOxH6gM36AXdXZlT0V1bbfdwwiv9ug9/bS1MoGDN9ZLJB7Hj1VVJl/kUKwgC/WoMlxbsLumvf3CBRLhLUJhpbh9Z+w1bg2eBT+m5Wvoo67/w== 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=EMsDDkQxzhDpzNkw20lBX4wbQ7YchxTBMJUnaMGyqAQ=; b=ZC8OgQC/VCJXb+fvHx7z6SGKSPc4M9ED0Tf2l/L6+/DoKqT4cgObpeJI4siF0TVbG04IEuJxvhh1mIslP2NcNWP+h4o53ptLg+NOlg5E5ia6VaxIbiJ7vggtdebeQyKUDOAg2IIBy8Nn5+6RieqzMgX6UhGkRD5KveCdmNgRFISJJRS+61fHbt3MOzLgg0Am7biOd2PkuQrUgQ7tyDj13qNkDVd80qzhSaPUHwyxmD5FN9BUagWmS9wtqmpOTTFwITkH3wj5Bo1gEned1WSZeMErQmfqAonWcM9YPw8nQlSM4fLzOEOlD6lTr6u5Nzq0KKJklnIq/5BB+W18y8/flw== 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 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=EMsDDkQxzhDpzNkw20lBX4wbQ7YchxTBMJUnaMGyqAQ=; b=iFzPZ2SNcO+InK9yBsAJCTl4yNJ0LQQZn6w7GJuGqscWoGNqlUqNAm6K9rRe2dSbCDlhuhcq5jLoy9OLQflunZw/i6Wg60ZYsnJmc+W34NC2JESo3PoG2kFEVjOgJybVxgWZgHPfd1V7np0aO/0jfYg/nBxfjIedmDNHHNVwzZw= Received: from BN9P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::7) by BYAPR12MB3478.namprd12.prod.outlook.com (2603:10b6:a03:ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Tue, 25 Jan 2022 12:19:34 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10c:cafe::18) by BN9P222CA0002.outlook.office365.com (2603:10b6:408:10c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10 via Frontend Transport; Tue, 25 Jan 2022 12:19:33 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.7 via Frontend Transport; Tue, 25 Jan 2022 12:19:33 +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.2375.18; Tue, 25 Jan 2022 06:19:21 -0600 From: To: Subject: [PATCH v2 1/6] net/axgbe: always attempt link training in KR mode Date: Tue, 25 Jan 2022 17:47:42 +0530 Message-ID: <20220125121747.344631-2-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220125121747.344631-1-ssebasti@amd.com> References: <20220125121747.344631-1-ssebasti@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-Office365-Filtering-Correlation-Id: 3e281238-dc64-4712-83c7-08d9dffcf1ed X-MS-TrafficTypeDiagnostic: BYAPR12MB3478:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSO/5/NzqA4HZAWkxdLeolfq+fKxibXZF8rv3WpNotI/gHBRMNsVVWgOMFe41tmkpCQvhYRsSGgb1yWGKR+37Q6Z2yYsk0ZR4VGR/DABPLOLK+1wQANTzNDHUpfUiCHV+60p7GpwerUyZpkdlsWaW/msGiVsFVs+QAVlf5w7g5NciTyZVN9utdJa5YMyRsi+bDhE1vlxFVtNBYx9FAJJuAp70iyVr8fXbZYqZAMPMyQkZb2VeqKRqVRC3ycs+zhymvz6VnoMC033HOL6FnQLazsh8pqqVEgSW8L1mEfN/EbEmJJd9JenZqUoryGVH16Wo9zDyN7tTDMnMxIIikbnz3nPbz+CWoG4hmpOlPq6Ws5HnGlWrtVSCkgCtZYvhW2VKPmc1DVQzv27KCBL/gcgpu8foUcdfADFUfq9bsos+efEwzc5rg5By0JlFvIihFU6TqBC7hMXXCjeC/O/Vu8EsYNqhGbC/fNce557Jg67HHe9ZVDr4MviJl3XpbGUTas//1N55h6DA62jJoFz2jqur9D1rcJwd1mJaoHKOEP5G+PeJe8/wtyihNeuhiasCoF6gXZc9AScbRd31MuGmnLFNBVORlA6l4VspHrGfFs9o0Y3rduteZi70z8nSTR0BirdzC5c3pVnPVL6yABjorYuOqvHvNadVNJzSmk+7rnPtDYg3aQ06sHyUqqZDSugiGJ0Aro6Mpe4tH3M5HZfi6tICeZLM79rbkSiOSeYNxIBPA6Fa2Bl2nHyuBl77BauvN8UoDtRsQ/rHTb9Yoduty6PkuGVBhPDQA2zAH8ohF9vKqE= 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:(4636009)(46966006)(36840700001)(40470700004)(8936002)(8676002)(36860700001)(5660300002)(26005)(336012)(2906002)(36756003)(82310400004)(2616005)(47076005)(6666004)(6916009)(356005)(81166007)(2876002)(70586007)(70206006)(16526019)(186003)(508600001)(40460700003)(7696005)(1076003)(426003)(316002)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 12:19:33.2794 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e281238-dc64-4712-83c7-08d9dffcf1ed 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: BN8NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3478 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Selwin Sebastian Link training is always attempted when in KR mode, but the code is structured to check if link training has been enabled before attempting to perform it.Since that check will always be true, simplify the code to always enable and start link training during KR auto-negotiation. Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_mdio.c | 62 ++++++++-------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c index 32d8c666f9..913ceada0d 100644 --- a/drivers/net/axgbe/axgbe_mdio.c +++ b/drivers/net/axgbe/axgbe_mdio.c @@ -80,31 +80,10 @@ static void axgbe_an_clear_interrupts_all(struct axgbe_port *pdata) axgbe_an37_clear_interrupts(pdata); } -static void axgbe_an73_enable_kr_training(struct axgbe_port *pdata) -{ - unsigned int reg; - - reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL); - reg |= AXGBE_KR_TRAINING_ENABLE; - XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); -} - -static void axgbe_an73_disable_kr_training(struct axgbe_port *pdata) -{ - unsigned int reg; - - reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL); - - reg &= ~AXGBE_KR_TRAINING_ENABLE; - XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); -} static void axgbe_kr_mode(struct axgbe_port *pdata) { - /* Enable KR training */ - axgbe_an73_enable_kr_training(pdata); - /* Set MAC to 10G speed */ pdata->hw_if.set_speed(pdata, SPEED_10000); @@ -114,9 +93,6 @@ static void axgbe_kr_mode(struct axgbe_port *pdata) static void axgbe_kx_2500_mode(struct axgbe_port *pdata) { - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); - /* Set MAC to 2.5G speed */ pdata->hw_if.set_speed(pdata, SPEED_2500); @@ -126,9 +102,6 @@ static void axgbe_kx_2500_mode(struct axgbe_port *pdata) static void axgbe_kx_1000_mode(struct axgbe_port *pdata) { - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); - /* Set MAC to 1G speed */ pdata->hw_if.set_speed(pdata, SPEED_1000); @@ -142,8 +115,6 @@ static void axgbe_sfi_mode(struct axgbe_port *pdata) if (pdata->kr_redrv) return axgbe_kr_mode(pdata); - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); /* Set MAC to 10G speed */ pdata->hw_if.set_speed(pdata, SPEED_10000); @@ -154,8 +125,6 @@ static void axgbe_sfi_mode(struct axgbe_port *pdata) static void axgbe_x_mode(struct axgbe_port *pdata) { - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); /* Set MAC to 1G speed */ pdata->hw_if.set_speed(pdata, SPEED_1000); @@ -166,8 +135,6 @@ static void axgbe_x_mode(struct axgbe_port *pdata) static void axgbe_sgmii_1000_mode(struct axgbe_port *pdata) { - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); /* Set MAC to 1G speed */ pdata->hw_if.set_speed(pdata, SPEED_1000); @@ -178,8 +145,6 @@ static void axgbe_sgmii_1000_mode(struct axgbe_port *pdata) static void axgbe_sgmii_100_mode(struct axgbe_port *pdata) { - /* Disable KR training */ - axgbe_an73_disable_kr_training(pdata); /* Set MAC to 1G speed */ pdata->hw_if.set_speed(pdata, SPEED_1000); @@ -284,6 +249,12 @@ static void axgbe_an73_set(struct axgbe_port *pdata, bool enable, { unsigned int reg; + /* Disable KR training for now */ + reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL); + reg &= ~AXGBE_KR_TRAINING_ENABLE; + XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); + + /* Update AN settings */ reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_CTRL1); reg &= ~MDIO_AN_CTRL1_ENABLE; @@ -379,20 +350,17 @@ static enum axgbe_an axgbe_an73_tx_training(struct axgbe_port *pdata, XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_FECCTRL, reg); /* Start KR training */ - reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL); - if (reg & AXGBE_KR_TRAINING_ENABLE) { - if (pdata->phy_if.phy_impl.kr_training_pre) - pdata->phy_if.phy_impl.kr_training_pre(pdata); + if (pdata->phy_if.phy_impl.kr_training_pre) + pdata->phy_if.phy_impl.kr_training_pre(pdata); - reg |= AXGBE_KR_TRAINING_START; - XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, - reg); - - PMD_DRV_LOG(DEBUG, "KR training initiated\n"); + reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL); + reg |= AXGBE_KR_TRAINING_ENABLE; + reg |= AXGBE_KR_TRAINING_START; + XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); - if (pdata->phy_if.phy_impl.kr_training_post) - pdata->phy_if.phy_impl.kr_training_post(pdata); - } + PMD_DRV_LOG(DEBUG, "KR training initiated\n"); + if (pdata->phy_if.phy_impl.kr_training_post) + pdata->phy_if.phy_impl.kr_training_post(pdata); return AXGBE_AN_PAGE_RECEIVED; } -- 2.25.1