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 D6C45A052E; Mon, 9 Mar 2020 16:50:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA1D91C0AC; Mon, 9 Mar 2020 16:50:46 +0100 (CET) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 292491C07E for ; Mon, 9 Mar 2020 16:50:45 +0100 (CET) Received: by mail-pj1-f67.google.com with SMTP id mq3so10703pjb.0 for ; Mon, 09 Mar 2020 08:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MSIaH3fCD/6At0cwYbuzgdt4owQpdgOdc67zTog1Y6o=; b=McY03Z5dxdK9XEr6ONqi/it+q8EvFT6FHqZiBjeUlVm5FyZHt8lxVxMnqV+vABlrBd xS83uzhOsgymsYdOB/VAh05v49oPNofi+i/FtjiJODnMx11UNdsDY2/Lw8FiHbMToxLG WffI63m8QUsurunkihKZiV3tXLqmhU+iyPNX8HJ+MvDEaFz7ELeUD6QPYkvhd+OEsgVV C1o8kaTYhhE2j748U/h7wGITh876tQLzHsB86DbY8Ke9lU64AfKLTMh37bnSnNpqOz2S 9BV+PY40BNYqjhLvm92mivlVjmkrqxFpDptochYR2Knw/8wBrUQhskRFm8JawRu2R/uN 7ufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MSIaH3fCD/6At0cwYbuzgdt4owQpdgOdc67zTog1Y6o=; b=jQFhxNLa3cHnmyg2iHztotO1G9y8pNxAsu/ai05TYi5CbaSWXaIftMom8c2fxUYBic 0zJdwjuhlulTEOQOz6FF1JxqHCrUhYZA4AkcvOJPfM/mPnU+ATN6FBWcxr1cKu6+I6un 1+l/JR4uOI7m1wOwp94CCSF1LL8haKO2omLAZL4F0/OXPdAO9xZiKyWO+GjdAW6qXk9n LkVMTAHDZVUjVEk7nnHuSaNDkM1UbrBDcxWBhiLvlW+sPXGtQ9U0hKlKFwE9HwPhq/wP aVNd5ja8K11fQhUJ9b7gXMXgJfnKoE8lCWUpkK46fl+Ex2Zhl+dgwAx1YTZgBo12DHut g7zQ== X-Gm-Message-State: ANhLgQ2zexpLM2jmVO/HMWKAzv6nGyLA6YNr8JRYH8Q270u7gD13pecr /ffBo1yhhNJDQZCreTzVBWbxRw== X-Google-Smtp-Source: ADFU+vvF/E0lvrWzrJ34ILX/x5ReV0gW6EDAW6XQmjc7+YFJjXLoDATCXc0K2/q+Ew3wciJp5JkMZw== X-Received: by 2002:a17:90a:1048:: with SMTP id y8mr19094756pjd.29.1583769044338; Mon, 09 Mar 2020 08:50:44 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id c20sm30036142pfc.140.2020.03.09.08.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 08:50:44 -0700 (PDT) Date: Mon, 9 Mar 2020 08:50:40 -0700 From: Stephen Hemminger To: Joyce Kong Cc: thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, jerinj@marvell.com, bruce.richardson@intel.com, ravi1.kumar@amd.com, rmody@marvell.com, shshaikh@marvell.com, xuanziyang2@huawei.com, cloud.wangxiaoyun@huawei.com, zhouguoyang@huawei.com, honnappa.nagarahalli@arm.com, phil.yang@arm.com, gavin.hu@arm.com, nd@arm.com, dev@dpdk.org Message-ID: <20200309085040.387c62d2@hermes.lan> In-Reply-To: <20200309095410.28983-2-joyce.kong@arm.com> References: <20200309095410.28983-1-joyce.kong@arm.com> <20200309095410.28983-2-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v7 1/6] lib/eal: implement the family of PMD bit operation APIs 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 Mon, 9 Mar 2020 17:54:05 +0800 Joyce Kong wrote: > /** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Return the original bit from a 64-bit value, then clear it to 0 without > + * memory ordering. > + * > + * @param nr > + * The target bit to get and clear. > + * @param addr > + * The address holding the bit. > + * @return > + * The original bit. > + */ > +__rte_experimental > +static inline uint64_t > +rte_test_and_clear_bit64_relaxed(unsigned int nr, volatile uint64_t *addr) > +{ > + RTE_ASSERT(nr < 64); > + > + uint64_t mask = UINT64_C(1) << nr; > + uint64_t val = *addr; > + *addr = (*addr) & (~mask); > + return val & mask; > +} > + This is not thread safe. You should use the existing GCC builtins.