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 BF764A0032 for ; Fri, 24 Jun 2022 18:10:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAE24400EF; Fri, 24 Jun 2022 18:10:35 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8E912400EF for ; Fri, 24 Jun 2022 18:10:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656087034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xRgYpheJMwjNkLsNS3OVRLmH2CLr5CQ7GAk8Lre4BOE=; b=PVIDQPifc8X6Tr/j82NzkJHf4soY2XD+V4TxizFcuFgu78+mybDwTpYqf3aS1Iv7UGaf3M BjkVOu5f64c9rSVHhKmWLcjpXeLroq4k4u49u5byTZQJr4VkYfYPonyTXrDKhwxlMknVmC qmd1Rj9hXWhkLsq9VY8CUk0HE4uTCJ4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-NRSI8tIZNj6cFhZ2AIybuw-1; Fri, 24 Jun 2022 12:10:31 -0400 X-MC-Unique: NRSI8tIZNj6cFhZ2AIybuw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC63419705A7; Fri, 24 Jun 2022 16:10:30 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id E642B40334F; Fri, 24 Jun 2022 16:10:29 +0000 (UTC) From: Kevin Traynor To: Simei Su Cc: Qi Zhang , dpdk stable 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 Message-Id: <20220624161016.1881349-6-ktraynor@redhat.com> In-Reply-To: <20220624161016.1881349-1-ktraynor@redhat.com> References: <20220624161016.1881349-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 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 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 Acked-by: Qi Zhang --- 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,