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 2F72044153; Tue, 4 Jun 2024 14:14:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D815F436ED; Tue, 4 Jun 2024 14:13:18 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2044.outbound.protection.outlook.com [40.107.236.44]) by mails.dpdk.org (Postfix) with ESMTP id 71ED7436A2 for ; Tue, 4 Jun 2024 14:13:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XO2yC7LeWZ6Ezk/winhhnRBDk2ZvLXa07HQAlj060UPG0Lk/glUVUBixtMTPPokOmF1DNxjtPNP5doubJ4+IPXqARzbksIdlLy11bfZ7vk8c9FviHA3sBiekDT7/sxu4t0q2os+ny2tDqtDbhlVIJ8WUT41rlijWwUkk49QWqNBTAo/U7yyLc7sR6fJCF/grlFOV6uJm9be3wQpM1EWJWzFbc4MszX+s5NtCZ7l2VNutEZ4wir4s5E5OzMIdmCZeGbnq4O6578899oZX76pcWO7u2zqrrojqNdJxgv8IDDcCkhNcWYHaZeyHT3946EvBcRWC+TCueYNHc7VSgoL//g== 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=QY55qn6tORLm1NVQrzbIatLeLx8pQdus3AhuamgYPc0=; b=l2Lu00Thd6GyyRN0PHNUJQYGDPZtz/u+5dG/T3Co88THoCObKK7hiZxatJWAuak0EhFu6f2SHXcOL5fgPQpDPdkOMUCGIWmiddu1lFekDOlEYxAZN6GFY3EOebG8D6u87/bGTeP++k8DAGd+BRmwHaPaEjLWRDean0QegqWA9xMyHQXcSSnxmRe0NtodARv0XoZZegfFg02puLaNhalaRSDc2zvKEk9i83ONgExk1v8Eug/WVg2Ok5P0nSQtCtX7G+j3n8ol8dGf7GGr6nphn5ysT44HZIxbE7nY1NQ2mlhClZiDzMJx+U65x7Y6/iQ9Bj8tmA6FRPUD+PxsVVNj/g== 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=QY55qn6tORLm1NVQrzbIatLeLx8pQdus3AhuamgYPc0=; b=PgF1g7TFlzGKg36EKr+WYJqguFX17zryFpNtUEBpliQNIOC9HmZ8P/1RSVrhj5Sv2CTaSPGIgixATUy7MqPMI5QCAIP7pcNwkPhwp1AZa+whChOcXXjIGxOiRVU620o2/V4g1mY7skW4ykDB7tKuekAvfkpvVqkF85M7bcwGH3A= Received: from MN2PR18CA0023.namprd18.prod.outlook.com (2603:10b6:208:23c::28) by LV8PR12MB9359.namprd12.prod.outlook.com (2603:10b6:408:1fe::10) 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:13 +0000 Received: from BN3PEPF0000B372.namprd21.prod.outlook.com (2603:10b6:208:23c:cafe::54) by MN2PR18CA0023.outlook.office365.com (2603:10b6:208:23c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.30 via Frontend Transport; Tue, 4 Jun 2024 12:13:13 +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:13 +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:13:10 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Selwin Sebastian Subject: [PATCH v3 16/25] net/axgbe: improve SFP 100Mbps auto-negotiation Date: Tue, 4 Jun 2024 17:41:48 +0530 Message-ID: <20240604121157.3052-16-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_|LV8PR12MB9359:EE_ X-MS-Office365-Filtering-Correlation-Id: a857fd9c-fb17-431a-5935-08dc848fb566 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|376005|36860700004|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?V3wMLyVs+atYOsI/pKLF56ouZv8pBikmkP5g4bjiMYskugqxMN+M7MMaDp4p?= =?us-ascii?Q?tb5N3POl4A9jeCWBYnpq0nyp9dXqoqZDs1Xof9QImYMZ9lYmBPXGaHQMcSKd?= =?us-ascii?Q?7xqlJxjtlFsP1fhvI/4tfIWjoyhD/zhNEix51duZwGlN0Uy72ZvSTwfYH5G7?= =?us-ascii?Q?5lqeLM7kS6Orpu/cM+mdydpouxrrmY/t1mwS+GF6r6tp2dwLTCcOKOu749WF?= =?us-ascii?Q?PeGTpsDd+qtrtJ/uCwU3JSNTsojDSKnXOdIH+vDZCe0/a88M/g4IFfVQ82v5?= =?us-ascii?Q?eurqf/j4uaQDuj2ZSjqRxLVF5yV2yC2adrM2VZygdJUnvYH/+QThlFp6ajDY?= =?us-ascii?Q?FjNbbS8rS8Y9EtxQejvfM19npTYHfWuZcgmMoTzyP4yH7tFEz48YGyLaX4zf?= =?us-ascii?Q?4BWHOgRgxPDLUSIVFfVxiHuwnQNMtxdp37TUqRcJkuWw1mWED6YN/Z7XHwma?= =?us-ascii?Q?iUBALyDVzGeMa09o4ehvQwSdOIU2aobQNuqz9SWNSRvzzHT2DEIBNi28tU5o?= =?us-ascii?Q?FvdOM7B6fAtg8HSEUZyEB1kOtuMJvYR/MCzfdY6s3MnBxARUa5SFkcOoNaCt?= =?us-ascii?Q?KV5GosfrUI5eBsIyVjRpqgi7pko/udOzdvQUUNKSI/vbYPlBK3I8q8CpV8KU?= =?us-ascii?Q?TteYM8mH2Bc4FwVcNUggQDO4rcCyvYQhRQS8aIIgXpl4zoEe9mowX10mieE1?= =?us-ascii?Q?Ul611GQq+NURf647/7wrFppD1xLdwFpKxE2j96xaqcZQgBkvx3jqmNa3EiCJ?= =?us-ascii?Q?rHF+3Mg49mqY3l4LmF0yV0wwwdqYkYWmO95XwRE2LDjqlNeS+m8XUA36612S?= =?us-ascii?Q?6Uu+akFxF8L2vI9gScsG0Vwjdvnvf9PS46S1fWsf9WsjT1Z7xONw0jSCLfVo?= =?us-ascii?Q?RpneVBvz8rWq2ElLrOLrXnyFsf7R5ZXFq+/bQZi3sS5/LCA1G5ySQu0QPcU6?= =?us-ascii?Q?NiNgYrrgUose2kz+PM6XtFW5intQrG8XJZmngRbKMSQw8jc4uWYdDA51BHOi?= =?us-ascii?Q?ZbJY5H/wbyNKAFJlLm3ffd6y/T640wUiCWTrgnmqGrTS+mysX6/+bzl/FZbH?= =?us-ascii?Q?KKvB90suJC0YW20B0QbZ13BQr868POHK0rZuELyqHYLbSWJgiK4DvPYVNHwV?= =?us-ascii?Q?edV2u3n0gyGNXSjgfCjXgAGIms+88mA/tWhU54SRPV3J2u1GCTwyZZvsrpQN?= =?us-ascii?Q?u7dQrdGU8SA9H4dnYVpn4L5SBLklmM/pj8Y/tVwNj6kw5qrjbOQmkdaR188g?= =?us-ascii?Q?5GvdxBFpJIkmUcETUvnwacwdfDKY+Wz17aEz9j0oYP6LbmPAMMsxCGrl8eZS?= =?us-ascii?Q?RhNDjAErl+kQaS/9XNZb0jlQSr5xrsEJtODd2QFSWiVf7JkChLMonRlFmGHm?= =?us-ascii?Q?D181Vgc9Vyk6i1m4RaJ7qFljyy2p?= 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)(376005)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:13:13.7716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a857fd9c-fb17-431a-5935-08dc848fb566 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: LV8PR12MB9359 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: Venkat Kumar Ande After changing speed to 100Mbps as a result of auto-negotiation (AN), some 10/100/1000Mbps SFPs indicate a successful link (no faults or loss of signal), but cannot successfully transmit or receive data. These SFPs required an extra auto-negotiation (AN) after the speed change in order to operate properly. Add a quirk for these SFPs so that if the outcome of the AN actually results in changing to a new speed, re-initiate AN at that new speed. Signed-off-by: Venkat Kumar Ande Acked-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_ethdev.h | 1 + drivers/net/axgbe/axgbe_mdio.c | 74 +++++++++++++++++------------- drivers/net/axgbe/axgbe_phy_impl.c | 5 ++ 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index d1fac667c2..b9d8a4e74f 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -658,6 +658,7 @@ struct axgbe_port { enum axgbe_an an_state; enum axgbe_rx kr_state; enum axgbe_rx kx_state; + unsigned int an_again; unsigned int an_supported; unsigned int parallel_detect; unsigned int fec_ability; diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c index d95a52659e..3ec899a61d 100644 --- a/drivers/net/axgbe/axgbe_mdio.c +++ b/drivers/net/axgbe/axgbe_mdio.c @@ -883,21 +883,22 @@ static int axgbe_phy_config_fixed(struct axgbe_port *pdata) return 0; } -static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) +static int __axgbe_phy_config_aneg(struct axgbe_port *pdata, bool set_mode) { int ret; + pthread_mutex_lock(&pdata->an_mutex); rte_bit_relaxed_set32(AXGBE_LINK_INIT, &pdata->dev_state); pdata->link_check = rte_get_timer_cycles(); ret = pdata->phy_if.phy_impl.an_config(pdata); if (ret) - return ret; + goto out; if (pdata->phy.autoneg != AUTONEG_ENABLE) { ret = axgbe_phy_config_fixed(pdata); if (ret || !pdata->kr_redrv) - return ret; + goto out; PMD_DRV_LOG(DEBUG, "AN redriver support\n"); } else { PMD_DRV_LOG(DEBUG, "AN PHY configuration\n"); @@ -907,23 +908,26 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) rte_intr_disable(pdata->pci_dev->intr_handle); /* Start auto-negotiation in a supported mode */ - if (axgbe_use_mode(pdata, AXGBE_MODE_KR)) { - axgbe_set_mode(pdata, AXGBE_MODE_KR); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_KX_2500)) { - axgbe_set_mode(pdata, AXGBE_MODE_KX_2500); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_KX_1000)) { - axgbe_set_mode(pdata, AXGBE_MODE_KX_1000); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_SFI)) { - axgbe_set_mode(pdata, AXGBE_MODE_SFI); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_X)) { - axgbe_set_mode(pdata, AXGBE_MODE_X); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_SGMII_1000)) { - axgbe_set_mode(pdata, AXGBE_MODE_SGMII_1000); - } else if (axgbe_use_mode(pdata, AXGBE_MODE_SGMII_100)) { - axgbe_set_mode(pdata, AXGBE_MODE_SGMII_100); - } else { - rte_intr_enable(pdata->pci_dev->intr_handle); - return -EINVAL; + if (set_mode) { + if (axgbe_use_mode(pdata, AXGBE_MODE_KR)) { + axgbe_set_mode(pdata, AXGBE_MODE_KR); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_KX_2500)) { + axgbe_set_mode(pdata, AXGBE_MODE_KX_2500); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_KX_1000)) { + axgbe_set_mode(pdata, AXGBE_MODE_KX_1000); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_SFI)) { + axgbe_set_mode(pdata, AXGBE_MODE_SFI); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_X)) { + axgbe_set_mode(pdata, AXGBE_MODE_X); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_SGMII_1000)) { + axgbe_set_mode(pdata, AXGBE_MODE_SGMII_1000); + } else if (axgbe_use_mode(pdata, AXGBE_MODE_SGMII_100)) { + axgbe_set_mode(pdata, AXGBE_MODE_SGMII_100); + } else { + rte_intr_enable(pdata->pci_dev->intr_handle); + ret = -EINVAL; + goto out; + } } /* Disable and stop any in progress auto-negotiation */ @@ -941,16 +945,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) axgbe_an_init(pdata); axgbe_an_restart(pdata); - return 0; -} - -static int axgbe_phy_config_aneg(struct axgbe_port *pdata) -{ - int ret; - - pthread_mutex_lock(&pdata->an_mutex); - - ret = __axgbe_phy_config_aneg(pdata); +out: if (ret) rte_bit_relaxed_set32(AXGBE_LINK_ERR, &pdata->dev_state); else @@ -961,6 +956,16 @@ static int axgbe_phy_config_aneg(struct axgbe_port *pdata) return ret; } +static int axgbe_phy_config_aneg(struct axgbe_port *pdata) +{ + return __axgbe_phy_config_aneg(pdata, true); +} + +static int axgbe_phy_reconfig_aneg(struct axgbe_port *pdata) +{ + return __axgbe_phy_config_aneg(pdata, false); +} + static bool axgbe_phy_aneg_done(struct axgbe_port *pdata) { return pdata->an_result == AXGBE_AN_COMPLETE; @@ -1042,10 +1047,13 @@ static bool axgbe_phy_status_result(struct axgbe_port *pdata) pdata->phy.duplex = DUPLEX_FULL; - if (axgbe_set_mode(pdata, mode)) - return true; - else + if (!axgbe_set_mode(pdata, mode)) return false; + + if (pdata->an_again) + axgbe_phy_reconfig_aneg(pdata); + + return true; } static int autoneg_time_out(unsigned long autoneg_start_time) diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 73cdcdc49d..f583e8ebc9 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -556,6 +556,8 @@ static bool axgbe_phy_belfuse_parse_quirks(struct axgbe_port *pdata) if (memcmp(&sfp_eeprom->base[AXGBE_SFP_BASE_VENDOR_NAME], AXGBE_BEL_FUSE_VENDOR, strlen(AXGBE_BEL_FUSE_VENDOR))) return false; + /* For Bel-Fuse, use the extra AN flag */ + pdata->an_again = 1; /* Reset PHY - wait for self-clearing reset bit to clear */ pdata->phy_if.phy_impl.reset(pdata); @@ -797,6 +799,9 @@ static void axgbe_phy_sfp_detect(struct axgbe_port *pdata) struct axgbe_phy_data *phy_data = pdata->phy_data; int ret; + /* Clear the extra AN flag */ + pdata->an_again = 0; + /* Reset the SFP signals and info */ axgbe_phy_sfp_reset(phy_data); -- 2.34.1