event/cnxk: arm early to account for software delays

Message ID bd8a2f1697e86cd3eac0463fa7d0e26516a073bc.1670944154.git.sthotton@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series event/cnxk: arm early to account for software delays |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Shijith Thotton Dec. 13, 2022, 3:10 p.m. UTC
  Arm a bucket early to account for software delays in timer arm routine.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 drivers/event/cnxk/cnxk_tim_worker.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Jerin Jacob Jan. 18, 2023, 12:49 p.m. UTC | #1
On Tue, Dec 13, 2022 at 8:41 PM Shijith Thotton <sthotton@marvell.com> wrote:
>
> Arm a bucket early to account for software delays in timer arm routine.
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>

Updated the git commit title as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks


event/cnxk: arm timer early to account for software delays
> ---
>  drivers/event/cnxk/cnxk_tim_worker.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
> index eda84c6f31..16909ef06d 100644
> --- a/drivers/event/cnxk/cnxk_tim_worker.h
> +++ b/drivers/event/cnxk/cnxk_tim_worker.h
> @@ -133,11 +133,13 @@ cnxk_tim_get_target_bucket(struct cnxk_tim_ring *const tim_ring,
>  {
>         const uint64_t bkt_cyc =
>                 tim_ring->tick_fn(tim_ring->tbase) - tim_ring->ring_start_cyc;
> -       uint64_t bucket =
> -               rte_reciprocal_divide_u64(bkt_cyc, &tim_ring->fast_div) +
> -               rel_bkt;
> +       uint64_t bucket = rte_reciprocal_divide_u64(bkt_cyc, &tim_ring->fast_div);
>         uint64_t mirr_bucket = 0;
>
> +       if ((bkt_cyc - bucket * tim_ring->tck_int) < tim_ring->tck_int / 2)
> +               bucket--;
> +
> +       bucket += rel_bkt;
>         bucket = cnxk_tim_bkt_fast_mod(bucket, tim_ring->nb_bkts,
>                                        tim_ring->fast_bkt);
>         mirr_bucket =
> --
> 2.25.1
>
  

Patch

diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index eda84c6f31..16909ef06d 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -133,11 +133,13 @@  cnxk_tim_get_target_bucket(struct cnxk_tim_ring *const tim_ring,
 {
 	const uint64_t bkt_cyc =
 		tim_ring->tick_fn(tim_ring->tbase) - tim_ring->ring_start_cyc;
-	uint64_t bucket =
-		rte_reciprocal_divide_u64(bkt_cyc, &tim_ring->fast_div) +
-		rel_bkt;
+	uint64_t bucket = rte_reciprocal_divide_u64(bkt_cyc, &tim_ring->fast_div);
 	uint64_t mirr_bucket = 0;
 
+	if ((bkt_cyc - bucket * tim_ring->tck_int) < tim_ring->tck_int / 2)
+		bucket--;
+
+	bucket += rel_bkt;
 	bucket = cnxk_tim_bkt_fast_mod(bucket, tim_ring->nb_bkts,
 				       tim_ring->fast_bkt);
 	mirr_bucket =