patches for DPDK stable branches
 help / color / mirror / Atom feed
From: luca.boccassi@gmail.com
To: Venkat Kumar Ande <venkatkumar.ande@amd.com>
Cc: Selwin Sebastian <selwin.sebastian@amd.com>,
	dpdk stable <stable@dpdk.org>
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	[thread overview]
Message-ID: <20240624235907.885628-33-luca.boccassi@gmail.com> (raw)
In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com>

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 <venkatkumar.ande@amd.com>
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 <venkatkumar.ande@amd.com>
Acked-by: Selwin Sebastian <selwin.sebastian@amd.com>
---
 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 {

  parent reply	other threads:[~2024-06-25  0:01 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 23:57 patch 'test: force IOVA mode on PPC64 without huge pages' " luca.boccassi
2024-06-24 23:57 ` patch 'bus/pci: fix build with musl 1.2.4 / Alpine 3.19' " luca.boccassi
2024-06-24 23:57 ` patch 'eal/unix: support ZSTD compression for firmware' " luca.boccassi
2024-06-24 23:57 ` patch 'pcapng: add memcpy check' " luca.boccassi
2024-06-24 23:57 ` patch 'net/virtio-user: " luca.boccassi
2024-06-24 23:57 ` patch 'eal/windows: install sched.h file' " luca.boccassi
2024-06-24 23:57 ` patch 'latencystats: fix literal float suffix' " luca.boccassi
2024-06-24 23:57 ` patch 'net/nfp: fix representor port queue release' " luca.boccassi
2024-06-24 23:57 ` patch 'net/bonding: fix failover time of LACP with mode 4' " luca.boccassi
2024-06-24 23:57 ` patch 'net/hns3: fix offload flag of IEEE 1588' " luca.boccassi
2024-06-24 23:57 ` patch 'net/hns3: fix Rx timestamp flag' " luca.boccassi
2024-06-24 23:57 ` patch 'net/hns3: fix double free for Rx/Tx queue' " luca.boccassi
2024-06-24 23:57 ` patch 'net/hns3: fix variable overflow' " luca.boccassi
2024-06-24 23:58 ` patch 'net/hns3: disable SCTP verification tag for RSS hash input' " luca.boccassi
2024-06-24 23:58 ` patch 'net/af_packet: align Rx/Tx structs to cache line' " luca.boccassi
2024-06-24 23:58 ` patch 'doc: fix testpmd ring size command' " luca.boccassi
2024-06-24 23:58 ` patch 'net/af_xdp: fix port ID in Rx mbuf' " luca.boccassi
2024-06-24 23:58 ` patch 'net/af_xdp: count mbuf allocation failures' " luca.boccassi
2024-06-24 23:58 ` patch 'net/af_xdp: fix stats reset' " luca.boccassi
2024-06-24 23:58 ` patch 'net/af_xdp: remove unused local statistic' " luca.boccassi
2024-06-24 23:58 ` patch 'net/tap: fix file descriptor check in isolated flow' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: fix MDIO access for non-zero ports and CL45 PHYs' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: reset link when link never comes back' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: fix fluctuations for 1G Bel Fuse SFP' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: update DMA coherency values' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: disable interrupts during device removal' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: disable RRC for yellow carp devices' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: enable PLL control for fixed PHY modes only' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: fix SFP codes check for DAC cables' " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: fix connection for SFP+ active " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: check only minimum speed for " luca.boccassi
2024-06-24 23:58 ` patch 'net/axgbe: fix Tx flow on 30H HW' " luca.boccassi
2024-06-24 23:58 ` luca.boccassi [this message]
2024-06-24 23:58 ` patch 'net/axgbe: fix linkup in PHY status' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ice: fix check for outer UDP checksum offload' " luca.boccassi
2024-06-24 23:58 ` patch 'app/testpmd: fix outer IP " luca.boccassi
2024-06-24 23:58 ` patch 'net: fix outer UDP checksum in Intel prepare helper' " luca.boccassi
2024-06-24 23:58 ` patch 'net/i40e: fix outer UDP checksum offload for X710' " luca.boccassi
2024-06-24 23:58 ` patch 'net/iavf: remove outer UDP checksum offload for X710 VF' " luca.boccassi
2024-06-24 23:58 ` patch 'app/testpmd: fix lcore ID restriction' " luca.boccassi
2024-06-24 23:58 ` patch 'hash: fix return code description in Doxygen' " luca.boccassi
2024-06-24 23:58 ` patch 'hash: check name when creating a hash' " luca.boccassi
2024-06-24 23:58 ` patch 'mempool: replace GCC pragma with cast' " luca.boccassi
2024-06-24 23:58 ` patch 'vhost: fix build with GCC 13' " luca.boccassi
2024-06-24 23:58 ` patch 'vhost: cleanup resubmit info before inflight setup' " luca.boccassi
2024-06-24 23:58 ` patch 'net/virtio: fix MAC table update' " luca.boccassi
2024-06-24 23:58 ` patch 'baseband/acc: fix memory barrier' " luca.boccassi
2024-06-24 23:58 ` patch 'event/sw: fix warning from useless snprintf' " luca.boccassi
2024-06-24 23:58 ` patch 'eventdev/crypto: fix opaque field handling' " luca.boccassi
2024-06-24 23:58 ` patch 'eal: fix logs for '--lcores'' " luca.boccassi
2024-06-24 23:58 ` patch 'net/fm10k: fix cleanup during init failure' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ixgbe: do not update link status in secondary process' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ixgbe: do not create delayed interrupt handler twice' " luca.boccassi
2024-06-24 23:58 ` patch 'net/e1000/base: fix link power down' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ixgbe/base: revert advertising for X550 2.5G/5G' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ixgbe/base: fix 5G link speed reported on VF' " luca.boccassi
2024-06-24 23:58 ` patch 'net/ixgbe/base: fix PHY ID for X550' " luca.boccassi
2024-06-24 23:58 ` patch 'net/cnxk: fix RSS config' " luca.boccassi
2024-06-24 23:58 ` patch 'net/cnxk: fix outbound security with higher packet burst' " luca.boccassi
2024-06-24 23:58 ` patch 'net/cnxk: fix promiscuous state after MAC change' " luca.boccassi
2024-06-24 23:58 ` patch 'graph: fix ID collisions' " luca.boccassi
2024-06-24 23:58 ` patch 'bpf: disable on 32-bit x86' " luca.boccassi
2024-06-24 23:58 ` patch 'hash: fix RCU reclamation size' " luca.boccassi
2024-06-24 23:58 ` patch 'common/mlx5: fix unsigned/signed mismatch' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5/hws: decrease log level for creation failure' " luca.boccassi
2024-06-24 23:58 ` patch 'common/mlx5: fix PRM structs' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5/hws: fix function comment' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5/hws: fix spinlock release on context open' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5/hws: add template match none flag' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5/hws: fix action template dump' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5: fix indexed pool with invalid index' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5: fix hash Rx queue release in flow sample' " luca.boccassi
2024-06-24 23:58 ` patch 'net/mlx5: fix flow template indirect action failure' " luca.boccassi
2024-06-24 23:59 ` patch 'net/mlx5: break flow resource release loop' " luca.boccassi
2024-06-24 23:59 ` patch 'net/mlx5: fix access to flow template operations' " luca.boccassi
2024-06-24 23:59 ` patch 'net/mlx5: support jump in meter hierarchy' " luca.boccassi
2024-06-24 23:59 ` patch 'net/mlx5: fix crash on counter pool destroy' " luca.boccassi
2024-06-24 23:59 ` patch 'test/crypto: fix enqueue/dequeue callback case' " luca.boccassi
2024-06-24 23:59 ` patch 'telemetry: lower log level on socket error' " luca.boccassi
2024-06-24 23:59 ` patch 'bus/vdev: revert fix devargs in secondary process' " luca.boccassi
2024-06-24 23:59 ` patch 'doc: fix link to hugepage mapping from Linux guide' " luca.boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240624235907.885628-33-luca.boccassi@gmail.com \
    --to=luca.boccassi@gmail.com \
    --cc=selwin.sebastian@amd.com \
    --cc=stable@dpdk.org \
    --cc=venkatkumar.ande@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).