]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: use CAS with release semantics for batch alloc
authorAshwin Sekhar T K <asekhar@marvell.com>
Tue, 30 Nov 2021 05:45:27 +0000 (11:15 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 6 Jan 2022 14:05:25 +0000 (15:05 +0100)
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@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_io.h
drivers/common/cnxk/roc_io_generic.h
drivers/common/cnxk/roc_npa.h

index fe5f7f46d0d57a112ff395cff7ecda55c747fda7..4f15503c29bcc46b8a1bcbdb40609d6930a938f6 100644 (file)
@@ -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)
 {
index ceaa3a38d846474fa75dce94d91661ad08270376..5f90835c096abacfbcf3b47a1253a8463643c253 100644 (file)
@@ -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)
 {
index 46350fdb48f6c2983d18c7c354bc1134b934b73c..19b9a9352c73b6d64bd80c092178393e54556099 100644 (file)
@@ -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;