From patchwork Thu Dec 8 16:22:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 31431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp293196wrr; Thu, 8 Dec 2022 08:30:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf7TIuDBoyierngwNvfcciSxThw1aXGphwh+OvAcU9KyBT4fwAZdtBnP7wmynbRCKi/H9ACA X-Received: by 2002:a17:90a:7885:b0:20a:d81d:a8 with SMTP id x5-20020a17090a788500b0020ad81d00a8mr107313109pjk.177.1670517007947; Thu, 08 Dec 2022 08:30:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670517007; cv=pass; d=google.com; s=arc-20160816; b=Hm5Ss0Xp6iFt3A5tB+/V84OeTXBWq76M/vzlnyzfqPPMj/T1u9Nuu+X0L/TxQnkGSD KKlBQNXUh7QwL6IIgPWmA8d/PPvJ6UVaiGS+gjdYe7gdxNKbty86kTSaZH3aeuFUCit+ gpwujP2Gq4YEVYGP9GGmWvpse7jlFv01C1ydsQHByCPWLyyu8tGO9AHgy5tDttLtiaEa 75eElfFRyyLXUxJmePEzKLEuEFA1yNs2u3+zhC5jaNOEY0e/CwuMDS9GQ0aYyWVL1WxL MIBXGgkGCoDgz8jzskk/9KJwNyYoKaCi96232r2J1Ss/85rpKOdPIAfReZd0EjrihCtk t8cw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XGv1bUKoON/7BDuP65fPZTgki1lAzvgeqvNzRq3dW7M=; b=cBydJax3cu8nF+0FNCVOufCPnvoY5AcAQ1GG1YkCJxU1LJPLyzTZugfiuc1V8ZsG+2 zyrHvmkLL7yXF8ytj81PQW0cTvzzRWg4S0sBC3jU9MD8zBo5YoXzJgbO9bIXN/22P++X E6AmdIPOgtEDFPAOZFHzhmP0dWi+ZT8T0h6kxzx1JBcTTm5chh0gL3ku7b/s4Ylr1jBi s7Z8nGIBm5m1nq07rIOL5Ve/AUfbyRXTxBpyZEyMRBQqLPIzOptls78FV1L/wo+Qo2v1 bLGM7+6/LQAu+an4+s4jPGdRWSZ84BVTKdSJe2YMCS+PrdmxUFNBSkDM51vmcblF1J26 I5SA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=5Q2UZrUE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a056a001a5600b0056b81818621si65062pfv.157.2022.12.08.08.29.54; Thu, 08 Dec 2022 08:30:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=5Q2UZrUE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbiLHQXS (ORCPT + 99 others); Thu, 8 Dec 2022 11:23:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbiLHQXQ (ORCPT ); Thu, 8 Dec 2022 11:23:16 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F1FC45EF1; Thu, 8 Dec 2022 08:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFIt2AcBL6qUY/zqF6H2WRuXGBKLLATapmTvJswda5M4iakFPoxdI9YK6csdmRdQZdpb7VcIzWIg5h9KAGieeODzUg3dFW7sNqCaS943yHp6J5B3SooG9XTmO8LYM36Lr8w/GafbV/REptQBzaSWU1FV8CAiX3qqrVoIvxLjUucBHNKO+XVx1EGCYN8ZJz+IY8WfmGDs+o/i6LL0Wk3FMDtmLfql9CAnC6eEcVV0BEQkiaJ4kuhkgttIy9OY8hdHWvdJNrA7dQPcV2x4aRZE3CiTYDXS3pYkptoar7Amjsp2BwNerBusPlmi9pQ6bp5lfjutHN8aDfVmJZonlmJ6tg== 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=XGv1bUKoON/7BDuP65fPZTgki1lAzvgeqvNzRq3dW7M=; b=VbAyM/UgQhLo3/3cd9gX1Xjq2Xpiw2Snqd/zp3l4FpcoNXhaU0mnbFPekSDgW1ZP4wkhBbNskph42VIBHs2jN0JyCmmknydVIc8X4Hoygn1JeLxtmopPD/bcxbLZfxteGhIJfBE5AEMClCAL/H/VKKmA+4k6q52Qyd/DcNiSr9mmBdLX0YIAaxr/o7RDlpkotQe1LXFDCtXtVAZF8+6yNIZU6TQaXmMydbGzzcJVYvvBIDJIYQgexVMZe2GElXW7+muQpFzkhRwgrYt6DeMOhWStHrXf4cLia1++0PudjnUsyFxIOTEizv78uVfQ9TqP6G1Ne1DhkFb8pch7PsW4wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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=XGv1bUKoON/7BDuP65fPZTgki1lAzvgeqvNzRq3dW7M=; b=5Q2UZrUE7fU16Fz6PeQ0hY4g26k6dcsvokLdADLY+cQ45TxZwAAXHGrC70WW0IU7kHG1nZKwrzoYsvZiGGdVixxUIEC2xeChRJ735aVCLgMRH7ejtayO6z7NBYJuE7j9U4RIFpytDYrOKkwbEumRSg0CdHWakj6IQen0uzt7T3E= Received: from BN9PR03CA0628.namprd03.prod.outlook.com (2603:10b6:408:106::33) by CH0PR12MB5331.namprd12.prod.outlook.com (2603:10b6:610:d6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.16; Thu, 8 Dec 2022 16:23:09 +0000 Received: from BN8NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::1d) by BN9PR03CA0628.outlook.office365.com (2603:10b6:408:106::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14 via Frontend Transport; Thu, 8 Dec 2022 16:23:08 +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 BN8NAM11FT100.mail.protection.outlook.com (10.13.177.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5901.16 via Frontend Transport; Thu, 8 Dec 2022 16:23:08 +0000 Received: from tlendack-t1.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.34; Thu, 8 Dec 2022 10:23:07 -0600 From: Tom Lendacky To: , CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shyam Sundar S K Subject: [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables Date: Thu, 8 Dec 2022 10:22:24 -0600 Message-ID: <55a23ec3393c505d2420fc81190898f5e6a4ff93.1670516545.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT100:EE_|CH0PR12MB5331:EE_ X-MS-Office365-Filtering-Correlation-Id: 36774a75-84ff-4e8e-420e-08dad9387e6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C9Q0uOSmNYyY5sFmFzckElzxgxw01ovtwyKlQ2O0pWQ7Xzmi0FgMOl0XbeZ2O6zhHdCzcE44oXWtfJ70WnEXwZXKOdviVkaFQZ7/co64PRQTzr3U8e4jJLuDlCp6Pgh7om4HT+AzQI2T+G+v9/0NdaV6Lfd9T6SbdF3MrAGlcDX7go6couUlm/cldw1JZ/KFs+/GnMQJmKqQdz6TaDvOvdAvQulHPI5XAuRZrhyNd6riM50pULpuHJ57kaKUT7uivb+xD5p6W/uOrun64IZ3UlYM8XPmdUOkqtjjYNlckgYMpOWhETtUdYKsis0Y3paoc4RzcAPmwU8wloGJIUsXSMnt9cOLADEL3r59SutZbMFQmAZ8xxImMtcUpgBg4/basDXZeco+odY4gOfDKbJthNwmPreaUlmxqtBJvqmQFvns6hxkKCuncxXuLRCqON0VaqFxHNEqU4tiC2IvMg6o+sHYfpwFd/rw7jOE8Y5I2fhPInNkY8VwQ3b6n3aQ5RljVLI20ak5PX8cMbwrugHk9WfK4TuavwCFULqtTDz+1JR3G0V2Td6IE8zh0cIeCVIChsur7ZOw54XaIoTWv0WPFl5ZPuCp6RrglXR8X7m1TgR+2T2PCc8Ye5WyZsJ07jDH/SkZoYKoZ7Mjft4y96IyvEUJOpQB3D6U4jmwqJ3XoxI5I38zSs3ueWhRJ4uJXQ9o3mVjGTVCbmnfIQ8XJPhIme2BIzUxGn6L8TGoo3JlqU8= 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:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199015)(40470700004)(46966006)(36840700001)(5660300002)(7696005)(36860700001)(47076005)(426003)(316002)(8936002)(4326008)(110136005)(40460700003)(2616005)(40480700001)(54906003)(70206006)(70586007)(186003)(16526019)(26005)(86362001)(8676002)(336012)(81166007)(356005)(36756003)(41300700001)(82740400003)(83380400001)(6666004)(2906002)(478600001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2022 16:23:08.8428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36774a75-84ff-4e8e-420e-08dad9387e6e 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: BN8NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5331 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751664042446499407?= X-GMAIL-MSGID: =?utf-8?q?1751664042446499407?= SFP+ active and passive cables are copper cables with fixed SFP+ end connectors. Due to a misinterpretation of this, SFP+ active cables could end up not being recognized, causing the driver to fail to establish a connection. Introduce a new enum in SFP+ cable types, XGBE_SFP_CABLE_FIBER, that is the default cable type, and handle active and passive cables when they are specifically detected. Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules") Signed-off-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 4064c3e3dd49..868a768f424c 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -189,6 +189,7 @@ enum xgbe_sfp_cable { XGBE_SFP_CABLE_UNKNOWN = 0, XGBE_SFP_CABLE_ACTIVE, XGBE_SFP_CABLE_PASSIVE, + XGBE_SFP_CABLE_FIBER, }; enum xgbe_sfp_base { @@ -1149,16 +1150,18 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) phy_data->sfp_tx_fault = xgbe_phy_check_sfp_tx_fault(phy_data); phy_data->sfp_rx_los = xgbe_phy_check_sfp_rx_los(phy_data); - /* Assume ACTIVE cable unless told it is PASSIVE */ + /* Assume FIBER cable unless told otherwise */ if (sfp_base[XGBE_SFP_BASE_CABLE] & XGBE_SFP_BASE_CABLE_PASSIVE) { phy_data->sfp_cable = XGBE_SFP_CABLE_PASSIVE; phy_data->sfp_cable_len = sfp_base[XGBE_SFP_BASE_CU_CABLE_LEN]; - } else { + } else if (sfp_base[XGBE_SFP_BASE_CABLE] & XGBE_SFP_BASE_CABLE_ACTIVE) { phy_data->sfp_cable = XGBE_SFP_CABLE_ACTIVE; + } else { + phy_data->sfp_cable = XGBE_SFP_CABLE_FIBER; } /* Determine the type of SFP */ - if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE && + if (phy_data->sfp_cable != XGBE_SFP_CABLE_FIBER && xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000)) phy_data->sfp_base = XGBE_SFP_BASE_10000_CR; else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)