From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B349BA2EEB for ; Wed, 11 Sep 2019 14:27:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B21751E916; Wed, 11 Sep 2019 14:27:05 +0200 (CEST) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by dpdk.org (Postfix) with ESMTP id 535DB1E915 for ; Wed, 11 Sep 2019 14:27:04 +0200 (CEST) Received: by mail-io1-f66.google.com with SMTP id d25so45342433iob.6 for ; Wed, 11 Sep 2019 05:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vRSgBhS453y87LEgXm/HIo48EeYp0FhgkpA6KPeGyMw=; b=PwcVNHxRPrjcZZQuhqv2JwJvVXTxor0NBeZLT6/I/1Cmx5i51xkv26PHx89pVjahfi 1mqasrcxe1we1hHs66GAN9N5r9vaKgN4K8HBMlmtzKsvVxE2hiSFE00b0Xze072wV9Xc 39eIe4zrNvk6az4v77lrGT20JXw1Rdwv/dyRDO3s3NgvqoeLUYulU67s3QcQ+54jwVvZ MBLpO5DkejaUb+MVnz+5VFA+APAxojWHbD7lvY2w3NuhP1ZSTDwhPpm6GiG00GxeGxZy 5Ci66aF5anB2xsjN/q7+8i6QaNeJB1hT/sCRCaVQ0QoAwutslJioMccxCVEFaqihzI/8 y3Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vRSgBhS453y87LEgXm/HIo48EeYp0FhgkpA6KPeGyMw=; b=W8WFChRMadnT//AU18delTdtn2ygMBTqKyLBjldQfawrsLmM+XNKbNaOFYWzlQdqRw x3mvCBXSSELUjeH0jIuo2IMiqEybP7drvuI+CjkuQFTXrV4QmSe+VSEPkVzLHHQ9A6xl W2qau2ftXVZNBOP2CbNVZ7qUbaXJ/4nrtlH7E6y6ZR6TtZNnXOURXhzYU7nmQKTWA+I/ S0sEyJLI2IVRjJDJkTybpL/7xpQy3ArWVcPT7LAoOMU53ZCeOz4Waev8jwTR9Brh0W/F k87nZh3c8q52FSS7va/dxk3N0ymDP4C2TYJVxtRueLASeCNPd3tXAiW1747WBZ+SXBhR aClA== X-Gm-Message-State: APjAAAWzSAjLu8F1oOzt7nkE0gDu7Mls4Wo0tcz1qFWJdXI8Xz9he4O+ MaZ4C1Iqp6oQElvtYpVf1dhPQeyBwCGQToEWwe0= X-Google-Smtp-Source: APXvYqxRd6RGYHt94q98WuSNye9Llh1IG8H5fzd9bfpTgeZ3b0g1SNPYhwhizX+RHVt7clfDWhHW60AnkK9soIYQGBs= X-Received: by 2002:a05:6638:a:: with SMTP id z10mr7626331jao.113.1568204823408; Wed, 11 Sep 2019 05:27:03 -0700 (PDT) MIME-Version: 1.0 References: <1561911676-37718-1-git-send-email-gavin.hu@arm.com> <1566454356-37277-1-git-send-email-gavin.hu@arm.com> <1566454356-37277-3-git-send-email-gavin.hu@arm.com> In-Reply-To: <1566454356-37277-3-git-send-email-gavin.hu@arm.com> From: Jerin Jacob Date: Wed, 11 Sep 2019 17:56:52 +0530 Message-ID: To: Gavin Hu Cc: dev@dpdk.org, nd@arm.com, Thomas Monjalon , stephen@networkplumber.org, Jerin Jacob , Pavan Nikhilesh , Honnappa.Nagarahalli@arm.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 2/6] eal: add the APIs to wait until equal X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Aug 22, 2019 at 11:43 AM Gavin Hu wrote: > > The rte_wait_until_equalxx APIs abstract the functionality of 'polling > for a memory location to become equal to a given value'. > > Signed-off-by: Gavin Hu > Reviewed-by: Ruifeng Wang > Reviewed-by: Steve Capper > Reviewed-by: Ola Liljedahl > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Phil Yang > Acked-by: Pavan Nikhilesh > --- > .../common/include/arch/arm/rte_pause_64.h | 30 ++++++++++++++++++++++ > lib/librte_eal/common/include/generic/rte_pause.h | 26 ++++++++++++++++++- > 2 files changed, 55 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h > index 93895d3..dabde17 100644 > --- a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h > @@ -1,5 +1,6 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright(c) 2017 Cavium, Inc > + * Copyright(c) 2019 Arm Limited > */ > > #ifndef _RTE_PAUSE_ARM64_H_ > @@ -17,6 +18,35 @@ static inline void rte_pause(void) > asm volatile("yield" ::: "memory"); > } > > +#ifdef RTE_ARM_USE_WFE > +#define __WAIT_UNTIL_EQUAL(name, asm_op, wide, type) \ > +static __rte_always_inline void \ > +rte_wait_until_equal_##name(volatile type * addr, type expected) \ > +{ \ > + type tmp; \ > + asm volatile( \ > + #asm_op " %" #wide "[tmp], %[addr]\n" \ > + "cmp %" #wide "[tmp], %" #wide "[expected]\n" \ > + "b.eq 2f\n" \ > + "sevl\n" \ > + "1: wfe\n" \ > + #asm_op " %" #wide "[tmp], %[addr]\n" \ > + "cmp %" #wide "[tmp], %" #wide "[expected]\n" \ > + "bne 1b\n" \ > + "2:\n" \ > + : [tmp] "=&r" (tmp) \ > + : [addr] "Q"(*addr), [expected] "r"(expected) \ > + : "cc", "memory"); \ > +} > > +/* Wait for *addr to be updated with expected value */ > +__WAIT_UNTIL_EQUAL(relaxed_16, ldxrh, w, uint16_t) > +__WAIT_UNTIL_EQUAL(acquire_16, ldaxrh, w, uint16_t) > +__WAIT_UNTIL_EQUAL(relaxed_32, ldxr, w, uint32_t) > +__WAIT_UNTIL_EQUAL(acquire_32, ldaxr, w, uint32_t) > +__WAIT_UNTIL_EQUAL(relaxed_64, ldxr, x, uint64_t) > +__WAIT_UNTIL_EQUAL(acquire_64, ldaxr, x, uint64_t) > This scheme doesn't allow to write Doxygen comments for the API Please change to some scheme where you can Doxygen comments for each API without code duplication. Something like /** * Doxygen comment */ rte_wait_until_equal_relaxed_16(..) { __WAIT_UNTIL_EQUAL(..) }