patch 'net/ice: fix race condition in Rx timestamp' has been queued to stable release 21.11.2

Kevin Traynor ktraynor at redhat.com
Fri Jun 24 18:10:08 CEST 2022


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 at 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 at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at 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 at 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,



More information about the stable mailing list