patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Simei Su <simei.su@intel.com>
Cc: Qi Zhang <qi.z.zhang@intel.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'net/ice: fix race condition in Rx timestamp' has been queued to stable release 21.11.2
Date: Fri, 24 Jun 2022 17:10:08 +0100	[thread overview]
Message-ID: <20220624161016.1881349-6-ktraynor@redhat.com> (raw)
In-Reply-To: <20220624161016.1881349-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 21.11.2

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/22. 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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/f361d278e7fd1939f91ee85c0fc4d60d1c867292

Thanks.

Kevin

---
From f361d278e7fd1939f91ee85c0fc4d60d1c867292 Mon Sep 17 00:00:00 2001
From: Simei Su <simei.su@intel.com>
Date: Wed, 8 Jun 2022 10:46:01 +0800
Subject: [PATCH] net/ice: fix race condition in Rx timestamp

[ upstream commit 3d6502ee01a92f445f84af6e0660c5a0044acc35 ]

In multi-cores cases for Rx timestamp offload, to avoid phc time being
frequently overwritten, move related variables from ice_adapter to
ice_rx_queue structure, and each queue will handle timestamp calculation
by itself.

Fixes: 953e74e6b73a ("net/ice: enable Rx timestamp on flex descriptor")
Fixes: 5543827fc6df ("net/ice: improve performance of Rx timestamp offload")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/ice_ethdev.h |  3 ---
 drivers/net/ice/ice_rxtx.c   | 48 ++++++++++++++++++------------------
 drivers/net/ice/ice_rxtx.h   |  3 +++
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 56e53a6df3..ac56c3cc60 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -530,7 +530,4 @@ struct ice_adapter {
 	bool ptp_ena;
 	uint64_t time_hw;
-	uint32_t hw_time_high; /* high 32 bits of timestamp */
-	uint32_t hw_time_low; /* low 32 bits of timestamp */
-	uint64_t hw_time_update; /* SW time of HW record updating */
 	struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS];
 	struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS];
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 91cdc560f2..71e5c6f5d6 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1594,5 +1594,5 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
 		uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
 
-		if (unlikely(sw_cur_time - ad->hw_time_update > 4))
+		if (unlikely(sw_cur_time - rxq->hw_time_update > 4))
 			is_tsinit = 1;
 	}
@@ -1638,14 +1638,14 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
 					ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1,
 									   rxq->time_high);
-					ad->hw_time_low = (uint32_t)ts_ns;
-					ad->hw_time_high = (uint32_t)(ts_ns >> 32);
+					rxq->hw_time_low = (uint32_t)ts_ns;
+					rxq->hw_time_high = (uint32_t)(ts_ns >> 32);
 					is_tsinit = false;
 				} else {
-					if (rxq->time_high < ad->hw_time_low)
-						ad->hw_time_high += 1;
-					ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high;
-					ad->hw_time_low = rxq->time_high;
+					if (rxq->time_high < rxq->hw_time_low)
+						rxq->hw_time_high += 1;
+					ts_ns = (uint64_t)rxq->hw_time_high << 32 | rxq->time_high;
+					rxq->hw_time_low = rxq->time_high;
 				}
-				ad->hw_time_update = rte_get_timer_cycles() /
+				rxq->hw_time_update = rte_get_timer_cycles() /
 						     (rte_get_timer_hz() / 1000);
 				*RTE_MBUF_DYNFIELD(mb,
@@ -1860,5 +1860,5 @@ ice_recv_scattered_pkts(void *rx_queue,
 		uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
 
-		if (unlikely(sw_cur_time - ad->hw_time_update > 4))
+		if (unlikely(sw_cur_time - rxq->hw_time_update > 4))
 			is_tsinit = true;
 	}
@@ -1980,14 +1980,14 @@ ice_recv_scattered_pkts(void *rx_queue,
 			if (unlikely(is_tsinit)) {
 				ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1, rxq->time_high);
-				ad->hw_time_low = (uint32_t)ts_ns;
-				ad->hw_time_high = (uint32_t)(ts_ns >> 32);
+				rxq->hw_time_low = (uint32_t)ts_ns;
+				rxq->hw_time_high = (uint32_t)(ts_ns >> 32);
 				is_tsinit = false;
 			} else {
-				if (rxq->time_high < ad->hw_time_low)
-					ad->hw_time_high += 1;
-				ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high;
-				ad->hw_time_low = rxq->time_high;
+				if (rxq->time_high < rxq->hw_time_low)
+					rxq->hw_time_high += 1;
+				ts_ns = (uint64_t)rxq->hw_time_high << 32 | rxq->time_high;
+				rxq->hw_time_low = rxq->time_high;
 			}
-			ad->hw_time_update = rte_get_timer_cycles() /
+			rxq->hw_time_update = rte_get_timer_cycles() /
 					     (rte_get_timer_hz() / 1000);
 			*RTE_MBUF_DYNFIELD(rxm,
@@ -2370,5 +2370,5 @@ ice_recv_pkts(void *rx_queue,
 		uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
 
-		if (unlikely(sw_cur_time - ad->hw_time_update > 4))
+		if (unlikely(sw_cur_time - rxq->hw_time_update > 4))
 			is_tsinit = 1;
 	}
@@ -2431,14 +2431,14 @@ ice_recv_pkts(void *rx_queue,
 			if (unlikely(is_tsinit)) {
 				ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1, rxq->time_high);
-				ad->hw_time_low = (uint32_t)ts_ns;
-				ad->hw_time_high = (uint32_t)(ts_ns >> 32);
+				rxq->hw_time_low = (uint32_t)ts_ns;
+				rxq->hw_time_high = (uint32_t)(ts_ns >> 32);
 				is_tsinit = false;
 			} else {
-				if (rxq->time_high < ad->hw_time_low)
-					ad->hw_time_high += 1;
-				ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high;
-				ad->hw_time_low = rxq->time_high;
+				if (rxq->time_high < rxq->hw_time_low)
+					rxq->hw_time_high += 1;
+				ts_ns = (uint64_t)rxq->hw_time_high << 32 | rxq->time_high;
+				rxq->hw_time_low = rxq->time_high;
 			}
-			ad->hw_time_update = rte_get_timer_cycles() /
+			rxq->hw_time_update = rte_get_timer_cycles() /
 					     (rte_get_timer_hz() / 1000);
 			*RTE_MBUF_DYNFIELD(rxm,
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index bb18a01951..f5337d5284 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -96,4 +96,7 @@ struct ice_rx_queue {
 	uint32_t hw_register_set;
 	const struct rte_memzone *mz;
+	uint32_t hw_time_high; /* high 32 bits of timestamp */
+	uint32_t hw_time_low; /* low 32 bits of timestamp */
+	uint64_t hw_time_update; /* SW time of HW record updating */
 };
 
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-24 16:54:05.739953049 +0100
+++ 0006-net-ice-fix-race-condition-in-Rx-timestamp.patch	2022-06-24 16:54:05.535165033 +0100
@@ -1 +1 @@
-From 3d6502ee01a92f445f84af6e0660c5a0044acc35 Mon Sep 17 00:00:00 2001
+From f361d278e7fd1939f91ee85c0fc4d60d1c867292 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3d6502ee01a92f445f84af6e0660c5a0044acc35 ]
+
@@ -13 +14,0 @@
-Cc: stable@dpdk.org
@@ -24 +25 @@
-index f9f4a1c71b..c257bb23d3 100644
+index 56e53a6df3..ac56c3cc60 100644
@@ -27 +28 @@
-@@ -607,7 +607,4 @@ struct ice_adapter {
+@@ -530,7 +530,4 @@ struct ice_adapter {
@@ -36 +37 @@
-index 975ab55749..bfb3a16ae2 100644
+index 91cdc560f2..71e5c6f5d6 100644
@@ -39 +40 @@
-@@ -1596,5 +1596,5 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
+@@ -1594,5 +1594,5 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
@@ -46 +47 @@
-@@ -1640,14 +1640,14 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
+@@ -1638,14 +1638,14 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
@@ -68 +69 @@
-@@ -1862,5 +1862,5 @@ ice_recv_scattered_pkts(void *rx_queue,
+@@ -1860,5 +1860,5 @@ ice_recv_scattered_pkts(void *rx_queue,
@@ -75 +76 @@
-@@ -1982,14 +1982,14 @@ ice_recv_scattered_pkts(void *rx_queue,
+@@ -1980,14 +1980,14 @@ ice_recv_scattered_pkts(void *rx_queue,
@@ -97 +98 @@
-@@ -2372,5 +2372,5 @@ ice_recv_pkts(void *rx_queue,
+@@ -2370,5 +2370,5 @@ ice_recv_pkts(void *rx_queue,
@@ -104 +105 @@
-@@ -2433,14 +2433,14 @@ ice_recv_pkts(void *rx_queue,
+@@ -2431,14 +2431,14 @@ ice_recv_pkts(void *rx_queue,


  parent reply	other threads:[~2022-06-24 16:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 16:10 patch 'malloc: fix allocation of almost hugepage size' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/octeontx: fix port close' " Kevin Traynor
2022-06-24 16:10 ` patch 'common/cnxk: fix decrypt packet count register update' " Kevin Traynor
2022-06-24 16:10 ` patch 'common/cnxk: handle ROC model init failure' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/qede: fix build with GCC 13' " Kevin Traynor
2022-06-24 16:10 ` Kevin Traynor [this message]
2022-06-24 16:10 ` patch 'net/ice/base: fix build with GCC 12' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/qede: " Kevin Traynor
2022-06-24 16:10 ` patch 'net/mlx5: fix build with clang 14' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/mlx5: fix RSS expansion for patterns with ICMP item' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/mlx5: add limitation for E-Switch Manager match' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/mlx5: fix metering on E-Switch Manager' " Kevin Traynor
2022-06-24 16:10 ` patch 'net/mlx5: fix stack buffer overflow in drop action' " Kevin Traynor
2022-06-24 16:10 ` patch 'doc: fix flow integrity hardware support in mlx5 guide' " Kevin Traynor

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=20220624161016.1881349-6-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=qi.z.zhang@intel.com \
    --cc=simei.su@intel.com \
    --cc=stable@dpdk.org \
    /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).