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 AAFEF44077; Mon, 20 May 2024 12:42:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59C0B40697; Mon, 20 May 2024 12:42:14 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by mails.dpdk.org (Postfix) with ESMTP id B6DDF4067C; Mon, 20 May 2024 12:42:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uy5W7imq3sC8jgWn7SDYzuL73i4RrXUIzmGM1Vp8mGFQIAtbtZMEIqDYv0QZvs+9s95Yq9fjyC+mlHvjpSFzRuhDsmGu78C0SPB9iK+5eD1ODm/IIt0Lq/rV+HblFvZp7eVyJrLvEeueTstV/S8jeBfyZUvjx2vi2qShyre5jYwiCIEMvxBT/sT2GXYGq7OvdBRXwMW7+dB3ciJu37nOfByxVhR3jhULI3soY7nBDfCG767UZj9MbjY4p4hDhv4vY5haTtTDC9Pa8ZrWV//Lw7HvDm+VEfoZKfiZDad4kT+/X5kgwcDePT5sfY6GVA9tUOpWBWZj0HPSc6WVGfLU9g== 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=Kiu04xSdR/MFPiRhX3wr7eZqPDdC/ahIqe+geADHvdE=; b=k9uP8bxnjWsHfjRfAc2Hx+wl89U8eE9MbV74keOkUCB6WSu0Ykw3svfwd5ypBKnhLdqWLO1GpwZN/U0oBDa+wu4/k/QHuULeo/UOZchMqD+PvOmp27q38KNE5Wym9XjP78fQGRn6UJsWEfzeqeusrv3y79YwkufTVnqMgP9ca/UUoK/dsY3gKyWTs5SQNXAvpUG826MrsCQOX7gHKJUOVk0xGMrXCeMZNhxJtb7/gGG4ydTps2pQq7vLJpnA1GeThP7ZL/mBSTii4iYSewKJEUmKfa1LsjCcU6Lz+0Sn1g9w/QVIIVuG2kXnOC5x50JcUtgMzJpUeLmT0o/QgZrDJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=Kiu04xSdR/MFPiRhX3wr7eZqPDdC/ahIqe+geADHvdE=; b=5OgcGF5GTo+Rhjw68VgAvs+ckYEzIP8YPhG5WXisFj1/8mpcIdtAsaabYffy7O2H/HMcxGVwEd1+VQHklRw8MrWsS2rgdBi2+5pMIoMKywE5rOLUS7imK0bMCc1mWQmpAxdgI8K8arJf4GiDjHyBwp7yjoJNfTitykKjlVGCUAk= Received: from DM4PR12MB5055.namprd12.prod.outlook.com (2603:10b6:5:39a::20) by CY8PR12MB7123.namprd12.prod.outlook.com (2603:10b6:930:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Mon, 20 May 2024 10:42:10 +0000 Received: from DM4PR12MB5055.namprd12.prod.outlook.com ([fe80::acbd:ea93:4496:51a5]) by DM4PR12MB5055.namprd12.prod.outlook.com ([fe80::acbd:ea93:4496:51a5%7]) with mapi id 15.20.7587.035; Mon, 20 May 2024 10:42:10 +0000 From: "Sebastian, Selwin" To: "Ande, Venkat Kumar" , "dev@dpdk.org" CC: "stable@dpdk.org" Subject: RE: [PATCH v2 12/25] net/axgbe: delay AN timeout during KR training Thread-Topic: [PATCH v2 12/25] net/axgbe: delay AN timeout during KR training Thread-Index: AQHaoHw+jCU3g141hkq1veS2Od9KELGgA79g Date: Mon, 20 May 2024 10:42:10 +0000 Message-ID: References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@amd.com> <20240507124305.2318-12-venkatkumar.ande@amd.com> In-Reply-To: <20240507124305.2318-12-venkatkumar.ande@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=b8b7d970-e8f5-44a4-9d46-71df4daf3e7b; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-20T10:42:06Z; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR12MB5055:EE_|CY8PR12MB7123:EE_ x-ms-office365-filtering-correlation-id: ca71195f-ae14-4e4a-8e9e-08dc78b980ea x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|1800799015|366007|376005|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?Ft5e8Q9pHrPW2AX6EAYOn0Unj5wPk2VLCHYcJ00fyMHt4DbYvJeFakgP+rVW?= =?us-ascii?Q?1GLh5p3thTKb2VFVsFUGS/iAQnZjV5a0CIWnLHajNhXmb8Noy9oXziUPkH2A?= =?us-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KCqo+geA3xaAG?= =?us-ascii?Q?xgJkSNSr7F2IE7RfhYStaZu/JXRN0La2qGyzdGEAiMPbBAq8tltFusnet6Qa?= =?us-ascii?Q?glcOwXBoVuIPYffi8mlvo1US1FDXofzfB6hHcb1moyD4XXy25ptisOWKfyMz?= =?us-ascii?Q?+VtNR5HEJgmF2agYE0ZZZzG1gGREJP9Kv7PCsw5tZskP+2RTSg6wy6e3LrjW?= =?us-ascii?Q?ofn8it37SxmIQ3VOTbrVfoBW0zSYQfQt3Q6HPaJbMo+iW8Qb1ltzVVXQNyr+?= =?us-ascii?Q?lYG6HhyFbt5yogfu4kEDlP49NZOOrdwm/96QxjDAs+auY5MPFf4yzDUomPtY?= =?us-ascii?Q?iCF9OBvR6RPpevSjEp96TXSWVfIVyxBBBy+EFYlEgsXsLw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5055.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(366007)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mDCSL9vrKFYVUKDDMURJ4vKAcHRH9gA1/sNQVEOkILW0Ow5eQt7VwbBNMhPN?= =?us-ascii?Q?F3l4BJqaBuI3FlvSIkBR+pj493HeTAjhJCNXvKm4NIj7PDgEEYle23FD6RMS?= =?us-ascii?Q?vZZAhI2lkiypraCl044oPi3NpR7Q4vtoOWxprGQXTZeE7LbgBl0Wz/XcUoGv?= =?us-ascii?Q?liHV1oVyWyVnjS9SgYRpkqRNuOz97UkCZb2OxF8/MSiGU9n0XYKd0sxTGNys?= =?us-ascii?Q?T0VmO4JROBDBWW/wM1oo2xBLpu0d0trx6nK5ahqJY0axamySvtBaSX+I23s0?= =?us-ascii?Q?66WTiTz3JeYOi/cKq/hANiyF5gSVSLUV1tmapN9Wo7xJI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dpM0buDemo8ksRQWoNJo3LEy+JhujKZXtbPWcsmgf?= =?us-ascii?Q?my8AfeXSfqzJd/UQpDSAZGrbu63rlRxM+qE3kLlxxInc7WdAVHzOeAGkcwS2?= =?us-ascii?Q?9UiH8Hd4utIb8hAIfDf/Uc2h1KxOSOY07BtQqoAwub+zHSVxTWnEVJzkhQj6?= =?us-ascii?Q?KEVNQuReYCUMEGoW28WHdtyjKmTwoyG6R1VQZcA3LI8VLGnvTPenDueHiOtL?= =?us-ascii?Q?FpMCzUW4fwnIMwB4Q5GT8T1bSq2rlmheSW/OKo+Rkv5xYOZZH7NorWtUuF5S?= =?us-ascii?Q?qpALeMM2ngdkkXfCpWPvD/nfbt71z4AVcS9AnNQIb7sBJAkSQ26MMEo5c3Tq?= =?us-ascii?Q?QecdgUl1/KUsnIP4C5XkamYW04W0SE00cLYM90gS?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5055.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca71195f-ae14-4e4a-8e9e-08dc78b980ea X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2024 10:42:10.6785 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2fRdftBD3Ui+BhhiiVImI8qJc89codEsTNa1KiH4Fbf3OEGXk5IodDNhQKtkFeJKv5/qEKRpkj2/1CF4xEFxQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7123 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 [AMD Official Use Only - AMD Internal Distribution Only] Acked-by: Selwin Sebastian -----Original Message----- From: Ande, Venkat Kumar Sent: Tuesday, May 7, 2024 6:13 PM To: dev@dpdk.org Cc: Sebastian, Selwin ; Ande, Venkat Kumar ; stable@dpdk.org Subject: [PATCH v2 12/25] net/axgbe: delay AN timeout during KR training AN restart triggered during KR training not only aborts the KR training pro= cess but also move the HW to unstable state. Driver has to wait up to 500ms= or until the KR training is completed before restarting AN cycle. Without the fix the user will face KR training failure issues. Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs") Cc: stable@dpdk.org Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_ethdev.h | 2 ++ drivers/net/axgbe/axgbe_mdio.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_eth= dev.h index f122dfd516..d1fac667c2 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -111,6 +111,7 @@ /* Auto-negotiation */ #define AXGBE_AN_MS_TIMEOUT 500 #define AXGBE_LINK_TIMEOUT 5 +#define AXGBE_KR_TRAINING_WAIT_ITER 50 #define AXGBE_SGMII_AN_LINK_STATUS BIT(1) #define AXGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3)) @@ -661,6 +662,7 @@ struct axgbe_port { unsigned int parallel_detect; unsigned int fec_ability; unsigned long an_start; + unsigned long kr_start_time; enum axgbe_an_mode an_mode; /* I2C support */ diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.= c index b03bc471cb..e1a737cf62 100644 --- a/drivers/net/axgbe/axgbe_mdio.c +++ b/drivers/net/axgbe/axgbe_mdio.c @@ -357,6 +357,7 @@ static enum axgbe_an axgbe_an73_tx_training(struct axgb= e_port *pdata, reg |=3D AXGBE_KR_TRAINING_ENABLE; reg |=3D AXGBE_KR_TRAINING_START; XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); + pdata->kr_start_time =3D rte_get_timer_cycles(); PMD_DRV_LOG(DEBUG, "KR training initiated\n"); if (pdata->phy_if.phy_impl.kr_training_post) @@ -487,6 +488,7 @@ static enum axgbe_an axgbe_an73_incompat_link(struct ax= gbe_port *pdata) axgbe_an_disable(pdata); axgbe_switch_mode(pdata); + pdata->an_result =3D AXGBE_AN_READY; axgbe_an_restart(pdata); return AXGBE_AN_INCOMPAT_LINK; @@ -967,11 +969,34 @@ static void axgbe_check_link_timeout(struct axgbe_por= t *pdata) { unsigned long link_timeout; unsigned long ticks; + unsigned long kr_time; + int wait; link_timeout =3D pdata->link_check + (AXGBE_LINK_TIMEOUT * 2 * rte_get_timer_hz()); ticks =3D rte_get_timer_cycles(); if (time_after(ticks, link_timeout)) { + if ((axgbe_cur_mode(pdata) =3D=3D AXGBE_MODE_KR) && + pdata->phy.autoneg =3D=3D AUTONEG_ENABLE) { + /* AN restart should not happen while KR training i= s in progress. + * The while loop ensures no AN restart during KR t= raining, + * waits up to 500ms and AN restart is triggered on= ly if KR + * training is failed. + */ + wait =3D AXGBE_KR_TRAINING_WAIT_ITER; + while (wait--) { + kr_time =3D pdata->kr_start_time + + msecs_to_timer_cycles(AXGBE_AN_MS= _TIMEOUT); + ticks =3D rte_get_timer_cycles(); + if (time_after(ticks, kr_time)) + break; + /* AN restart is not required, if AN result= is COMPLETE */ + if (pdata->an_result =3D=3D AXGBE_AN_COMPLE= TE) + return; + rte_delay_us(10500); + } + } + PMD_DRV_LOG(NOTICE, "AN link timeout\n"); axgbe_phy_config_aneg(pdata); } -- 2.34.1