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 445A9A034D; Mon, 10 Jan 2022 12:35:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82BA641150; Mon, 10 Jan 2022 12:35:37 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2070.outbound.protection.outlook.com [40.107.95.70]) by mails.dpdk.org (Postfix) with ESMTP id 7189C40041 for ; Mon, 10 Jan 2022 12:35:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ked3ggAcWkihMBL4EmH69/JcVRJIPpnrfCe4TyjEmKx1fTXR0w2KIB6nW34oPFHkW1pX7g9uKBSxztH5u+pTZ2KMmLNzet0XrSDyKPn5cqQ7rb9A4l3GUwZ520QYYuGCx5ELRTqn9OkpRYUWyUDlwcGm1yb1nQArc9Czq9A7BQL17wm1aEbLCnNTZ0fL36bLw91QppKAwLPP1QLzQF7D0IZYA5IPvY76qjvis9lHuM0HSH4UW+pWXzSd0D1fa7GeDueor+M4dAIWzFIKS1GV87rXy8cAuFrSS5yViJN8DNiWuDP+U3pyPHZ0JJxrG6gJUbh7yJOY0B5NP7TaA2G8yw== 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=esx7DLm4quiUJDN6TrOJwaNa6Jb/5bEYvzlNl2waFPqk2pqHXbuR9sOLwBtMtShDd400A1021GlKdPoRuVqKrMWeBJvSaqNSOtAl84471EbGCHmsqiMuLuzJnRBI/0lTq7l6xCrhNOT3BDjc0xpoDwx60Et+sotfhCu6qO0e+5h/djDIjCeQBrlk85hmszVZQm3Q6u/7iaRlzECo+8liH0njNJeYSHXbLCek27UE/t+vzrojzxBCN6vL4ieYiUZ3kGQ63FES4SluiMvZE8jlv3U0nfB5l+qqLtKvQOeGRflTTJ6ivEkE1jZsy9K/2SZH04cPHSdgQKcq3qLEps+d+Q== 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=kPe4FcJGQdTdPnYdSrS1Ai6wPCxfMokWdn4joOybvav+9kucog5YBP6nNGsFe6MrrrNbRRojwNuTMzXwfqjW8t33ZHSJqdRXeLjnsPOJ5/QCDXqsU1YWA4jxAfob7cKZygHKgyZ5LGeT+alTWSOnyu1Dueq5OgBWMeFi/CUCHVc= Received: from MW4PR03CA0163.namprd03.prod.outlook.com (2603:10b6:303:8d::18) by BN6PR1201MB2545.namprd12.prod.outlook.com (2603:10b6:404:b1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Mon, 10 Jan 2022 11:35:34 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::f9) by MW4PR03CA0163.outlook.office365.com (2603:10b6:303:8d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9 via Frontend Transport; Mon, 10 Jan 2022 11:35: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 CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 11:35: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.17; Mon, 10 Jan 2022 05:35:31 -0600 From: To: Subject: [PATCH v1 1/6] net/axgbe: always attempt link training in KR mode Date: Mon, 10 Jan 2022 17:05:04 +0530 Message-ID: <20220110113509.553184-2-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220110113509.553184-1-ssebasti@amd.com> References: <20220110113509.553184-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: f17b68d1-080c-44e2-b61f-08d9d42d5019 X-MS-TrafficTypeDiagnostic: BN6PR1201MB2545: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: bKCbu6QxAX8raCed3nFE6+VQ1ooeAFIIoaPUZ5BAubTLTwN0Q6SbGnf+huqT5h4y7vaImq8Cl5ZCn8P+V+wgh1tgYOwic7/i73IBl4v3YhhPS/nQpG68hprymTg44aKRal+Y48gTOPoyFn9ERkSOij0WIVSb78lkpcnfK5RV33l9ueX+dM8gPogkA4FBkEJySjNBtWuvvzB5jky/Er6UhXBmL3N3ubBLzjmYwKAgWOKFGIP0Zx7cqdhvOY7stk5wR2K5XqlSJyyMXKLgmOujner8as8eA8ZkfhSM5mI1Q+e3pOcBZE25naN8GvkOi9iL8xQxvolD3wCH9IrU7fOSf0ou/0OZA6+sLIH7TWYJsPJudI62JOTU5zYhobWzTA8vo/RrIlFqke469aE3WiJLD0KL87j7V2MQSegX1S3q62f/oU6PcU+yWiGuJPU4UaqcK2pRBqshEFeLIqlMCnNpiuaxotRF6cOiydSrjXyMPx/tadReKUwZZF1rSmV8gqhlDtaJ11a9O08hREi1c/Mlb5ma6HF/NIzl6gHVgPF5i8oaQ7bsChjzHZJmmI0qYiOzF0bghAJmVRi4qSElFVlDVIzhlG+9645aVMDCJ31sM6Fo6HexHqL7LqFc8mPcUR7IyMAv4+jQWYBEeIyxAe6rgd4ym8uI9GVSHC2rLMEX2dw4ozDYJJdPFn7CS2eALPRtnaXF3toJhiXocNdUOfjqFqqSMgcC83zXZMGOjpU9InbJisksuIVffsj+UWXLPwm1n42GnutWYJeFPHVjwI+dOnBraW8u40DyXsaGzp4S9Cg= 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)(36840700001)(40470700002)(46966006)(7696005)(1076003)(70206006)(186003)(508600001)(336012)(16526019)(6916009)(47076005)(8676002)(2906002)(8936002)(5660300002)(316002)(40460700001)(356005)(2616005)(2876002)(81166007)(36860700001)(26005)(426003)(70586007)(36756003)(82310400004)(6666004)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2022 11:35:33.0396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f17b68d1-080c-44e2-b61f-08d9d42d5019 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: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2545 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