[PATCH] common/cnxk: use cas with release semantics for batch alloc
Jerin Jacob
jerinjacobk at gmail.com
Thu Jan 6 13:27:11 CET 2022
On Tue, Nov 30, 2021 at 11:17 AM Ashwin Sekhar T K <asekhar at marvell.com> wrote:
>
> Before issuing the batch alloc, we clear the first word of
> cache lines so that NPA can update the status. Make sure that
> this line clear is flushed before the batch alloc is issued.
>
> Signed-off-by: Ashwin Sekhar T K <asekhar at marvell.com>
Changed cas -> CAS in git commit
Acked-by: Jerin Jacob <jerinj at marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
> ---
> drivers/common/cnxk/roc_io.h | 12 ++++++++++++
> drivers/common/cnxk/roc_io_generic.h | 9 +++++++++
> drivers/common/cnxk/roc_npa.h | 2 +-
> 3 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h
> index fe5f7f46d0..4f15503c29 100644
> --- a/drivers/common/cnxk/roc_io.h
> +++ b/drivers/common/cnxk/roc_io.h
> @@ -78,6 +78,18 @@ roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr)
> return compare;
> }
>
> +static __plt_always_inline uint64_t
> +roc_atomic64_casl(uint64_t compare, uint64_t swap, int64_t *ptr)
> +{
> + asm volatile(PLT_CPU_FEATURE_PREAMBLE
> + "casl %[compare], %[swap], [%[ptr]]\n"
> + : [compare] "+r"(compare)
> + : [swap] "r"(swap), [ptr] "r"(ptr)
> + : "memory");
> +
> + return compare;
> +}
> +
> static __plt_always_inline uint64_t
> roc_atomic64_add_nosync(int64_t incr, int64_t *ptr)
> {
> diff --git a/drivers/common/cnxk/roc_io_generic.h b/drivers/common/cnxk/roc_io_generic.h
> index ceaa3a38d8..5f90835c09 100644
> --- a/drivers/common/cnxk/roc_io_generic.h
> +++ b/drivers/common/cnxk/roc_io_generic.h
> @@ -41,6 +41,15 @@ roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr)
> return compare;
> }
>
> +static __plt_always_inline uint64_t
> +roc_atomic64_casl(uint64_t compare, uint64_t swap, int64_t *ptr)
> +{
> + PLT_SET_USED(swap);
> + PLT_SET_USED(ptr);
> +
> + return compare;
> +}
> +
> static inline uint64_t
> roc_atomic64_add_nosync(int64_t incr, int64_t *ptr)
> {
> diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h
> index 46350fdb48..19b9a9352c 100644
> --- a/drivers/common/cnxk/roc_npa.h
> +++ b/drivers/common/cnxk/roc_npa.h
> @@ -218,7 +218,7 @@ roc_npa_aura_batch_alloc_issue(uint64_t aura_handle, uint64_t *buf,
> cmp.compare_s.dis_wait = dis_wait;
> cmp.compare_s.count = num;
>
> - res = roc_atomic64_cas(cmp.u, (uint64_t)buf, addr);
> + res = roc_atomic64_casl(cmp.u, (uint64_t)buf, addr);
> if (res != ALLOC_RESULT_ACCEPTED && res != ALLOC_RESULT_NOCORE)
> return -1;
>
> --
> 2.32.0
>
More information about the dev
mailing list