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 3EEB2454E9 for ; Tue, 25 Jun 2024 02:01:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A2C8410F2; Tue, 25 Jun 2024 02:01:01 +0200 (CEST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id E4CBC40EDD for ; Tue, 25 Jun 2024 02:00:59 +0200 (CEST) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so28948815e9.1 for ; Mon, 24 Jun 2024 17:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273659; x=1719878459; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lC5YuEShZuWxQ/T2IUSwY+e8UDtds4cW1ymStGPASMo=; b=lyrrUoeFe2MPzLtppcKQ34Kj9A0Jl0gYAqNlHmOGqty5pp4pD0ZKWmUYrq/dceYWcj zfXtLWTg9FXUyNd0bDmsQHBHLQ0+cUI3bbIgaD7C/W1FC4Bri697ERRSdsx0V8iPo6oS GH2+GU+gc/sJz0SGAvvYbaGtqnCb38RJTRnb2MWB2D+WoTYbg9U9WgMJZAhcJ6CYzT13 kDSLayveCWoNXY6xS/kBD7pWnD8t+ZjkfYqjH18RXMItO0jDvN5s/19lCyj4dbvrkFs3 6+PeuP0/GYIX57DnuZKfswYlboMWq3Wr/GgjUFNIwuJ14dP+3I4H8tbPPg9x+2MFqAa+ 1uaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273659; x=1719878459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lC5YuEShZuWxQ/T2IUSwY+e8UDtds4cW1ymStGPASMo=; b=Xa37lcuATAcRslSKQsBC9mrkC8EnfGqpLjpO8XN00+1s4bDpI/N28254JNrD4usHAl wxi63yh8Ti/R3kffFM4fbsxgmzMu9krTGp+56Jqa4hG2NXAPIwou/Yp+Ju1/YOP7GJOG 57ftOIn8LXgMPGSHPpEux9N82FE3eMA97N2vEcBSnts457XfV87cCa/FCDVWeDGJSUrS BOMdIxiRwHJtb1rvC02Jb7HtYFXooBE5eS+kQiVlX+bsIqcceJA6Ukesv1MOniO0rvV7 +JKDLGy6gAo1dldI9puid6h5CBLHSbuciME3n4LiSyZv65V/KpBhrs+Lzg6ZQXetRGfU WgKg== X-Forwarded-Encrypted: i=1; AJvYcCXbc8l8PH6xQ/zgq0IIBPfmU3i/V9r6I/mH6Um98EKZ/3RPkxqAusFyUN5pKYcxe5MSZOUwOGiJowIxqmIDzx8= X-Gm-Message-State: AOJu0YxIYInFflKhvuH+APX/HQ1fIghN5lqBBEIR6CHIrji8Nm43IHVJ wV8cpWhLjnlIozo+B+LWmWwv3cROqhqVL6U4RUMfxRvY6BWPQB2U X-Google-Smtp-Source: AGHT+IG7bFiW+VBC96rRQtt1+LWQQP+RGnWqqfFdsjyR+cF+xfw9bKhuoNkiA7GlTl9AAz89Ey1rvw== X-Received: by 2002:a05:600c:3b28:b0:421:347a:f0a6 with SMTP id 5b1f17b1804b1-424893dfbadmr54900205e9.3.1719273659415; Mon, 24 Jun 2024 17:00:59 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-424817a9667sm148849795e9.15.2024.06.24.17.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:00:59 -0700 (PDT) From: luca.boccassi@gmail.com To: Venkat Kumar Ande Cc: Selwin Sebastian , dpdk stable Subject: patch 'net/axgbe: delay AN timeout during KR training' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:58:19 +0100 Message-Id: <20240624235907.885628-33-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/e8615db99073af9bc4b4a1af9dbd1b051d2d54d8 Thanks. Luca Boccassi --- >From e8615db99073af9bc4b4a1af9dbd1b051d2d54d8 Mon Sep 17 00:00:00 2001 From: Venkat Kumar Ande Date: Tue, 4 Jun 2024 17:41:44 +0530 Subject: [PATCH] net/axgbe: delay AN timeout during KR training [ upstream commit 323e8c91a7c434915920fe8668ca5664b65ea198 ] AN restart triggered during KR training not only aborts the KR training process 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") Signed-off-by: Venkat Kumar Ande Acked-by: Selwin Sebastian --- 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_ethdev.h index ae57aeaa00..b4bd56e239 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)) @@ -654,6 +655,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 axgbe_port *pdata, reg |= AXGBE_KR_TRAINING_ENABLE; reg |= AXGBE_KR_TRAINING_START; XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); + pdata->kr_start_time = 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 axgbe_port *pdata) axgbe_an_disable(pdata); axgbe_switch_mode(pdata); + pdata->an_result = AXGBE_AN_READY; axgbe_an_restart(pdata); return AXGBE_AN_INCOMPAT_LINK; @@ -967,11 +969,34 @@ static void axgbe_check_link_timeout(struct axgbe_port *pdata) { unsigned long link_timeout; unsigned long ticks; + unsigned long kr_time; + int wait; link_timeout = pdata->link_check + (AXGBE_LINK_TIMEOUT * 2 * rte_get_timer_hz()); ticks = rte_get_timer_cycles(); if (time_after(ticks, link_timeout)) { + if ((axgbe_cur_mode(pdata) == AXGBE_MODE_KR) && + pdata->phy.autoneg == AUTONEG_ENABLE) { + /* AN restart should not happen while KR training is in progress. + * The while loop ensures no AN restart during KR training, + * waits up to 500ms and AN restart is triggered only if KR + * training is failed. + */ + wait = AXGBE_KR_TRAINING_WAIT_ITER; + while (wait--) { + kr_time = pdata->kr_start_time + + msecs_to_timer_cycles(AXGBE_AN_MS_TIMEOUT); + ticks = 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 == AXGBE_AN_COMPLETE) + return; + rte_delay_us(10500); + } + } + PMD_DRV_LOG(NOTICE, "AN link timeout\n"); axgbe_phy_config_aneg(pdata); } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:15.595687630 +0100 +++ 0033-net-axgbe-delay-AN-timeout-during-KR-training.patch 2024-06-25 00:22:13.125184426 +0100 @@ -1 +1 @@ -From 323e8c91a7c434915920fe8668ca5664b65ea198 Mon Sep 17 00:00:00 2001 +From e8615db99073af9bc4b4a1af9dbd1b051d2d54d8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 323e8c91a7c434915920fe8668ca5664b65ea198 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index f122dfd516..d1fac667c2 100644 +index ae57aeaa00..b4bd56e239 100644 @@ -34 +35 @@ -@@ -661,6 +662,7 @@ struct axgbe_port { +@@ -654,6 +655,7 @@ struct axgbe_port {