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 02575A3168 for ; Wed, 16 Oct 2019 09:54:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F3EEA1E8F9; Wed, 16 Oct 2019 09:54:15 +0200 (CEST) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id 7A4AB1E8E0 for ; Wed, 16 Oct 2019 09:54:14 +0200 (CEST) Received: by mail-io1-f65.google.com with SMTP id z19so52699752ior.0 for ; Wed, 16 Oct 2019 00:54:14 -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=+bQmoMOavU+sDpRrUlaz0RWgjlB4SEiFMh+snGIc7Vw=; b=duMnzqxldvAUd/qCjJjvw59rWzLxX3lm/XAuQrp5etsAik8bzBj97eel924kIc92Xw wi2i8Xqk37PWedxmEnYx/0P9MjJREX4cdljUSF2T1xiZfSX9MBLzXOIzhTw+HqJoZRMY N/n2fWisFFKVWzqFvG3vYLUsiyYqventysCic2IDwrX0lXDt73XqbMZl+HS/X01qbsii S4AOc/k9slYO7OcJR5gIzJRhrbf45XqRkL1fzCR+0Hu/qsksjch1boSxQ9YsrYQgkMhw RJ1NraGoDzbrtHQlKorIvO64RpS2AkBZayXFfdahwmqahdez3qQX/B93QPfumx8Cnvla cAtw== 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=+bQmoMOavU+sDpRrUlaz0RWgjlB4SEiFMh+snGIc7Vw=; b=KhiPZrCNxuU/WMOU1n9jM5yGO20TQ5pwFp3qS5hJYup99Q3pvlmJLbMGD6d0SSGeL6 EUd0NPS9fSJfSS5/t2KJizNko9bXNd7P1hVMs/TJ/bOyEflrNq9QB/WmiGpJUQEwZT/C PzUtBjRqRwoyElBHv8jDiAaD2xd79mdCbXyOGjRXIvh0ET8ug31DcniWsNlK4r7RjYU8 Uiv4KCKHQ44sRdo5ox58u8lI78kiLUE9tijMvkUpqI1KSZ5IHfN68M6DbJEZlgW5YBHf kS3OBZ/S4zXV2tFqF612WlXhFsTHB5Yjvwg0aSTmGy88/TzrjSb6r+1lB3gNoSxSSg7z 3Vmg== X-Gm-Message-State: APjAAAWl3GE91GM+IVbhYWsooEvAZRCWbghV57vKV0T7t4RshjVVgrvG TwFWYxY8DAUGkixq10fTzS94M7WN8UW4MCrFNeU= X-Google-Smtp-Source: APXvYqxeqE9+Bvi+a4HbFJmu7DGqq5axZh61zEcCKJsHdzzm+9FhepoTTPh7diCfHxhWg0eeLdrENFIOyzHsk3KzFWM= X-Received: by 2002:a6b:c701:: with SMTP id x1mr44367206iof.162.1571212453522; Wed, 16 Oct 2019 00:54:13 -0700 (PDT) MIME-Version: 1.0 References: <1571125801-45773-1-git-send-email-joyce.kong@arm.com> <1571125801-45773-2-git-send-email-joyce.kong@arm.com> In-Reply-To: <1571125801-45773-2-git-send-email-joyce.kong@arm.com> From: Jerin Jacob Date: Wed, 16 Oct 2019 13:24:02 +0530 Message-ID: To: Joyce Kong Cc: dpdk-dev , nd , Thomas Monjalon , Jerin Jacob , ravi1.kumar@amd.com, Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Rasesh Mody , Shahed Shaikh , Honnappa Nagarahalli , Gavin Hu Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1 1/5] lib/eal: implement the family of rte 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 Tue, Oct 15, 2019 at 1:20 PM Joyce Kong wrote: > > There are a lot functions of bit operations scattered and > duplicated in PMDs, consolidating them into a common API > family is necessary. Furthermore, the bit operation is > mostly applied to the IO devices, so use __ATOMIC_ACQ_REL > to ensure the ordering. > > Signed-off-by: Joyce Kong > --- > lib/librte_eal/common/Makefile | 1 + > lib/librte_eal/common/include/rte_bitops.h | 56 ++++++++++++++++++++++++++++++ > lib/librte_eal/common/meson.build | 1 + > + > +static inline void > +rte_set_bit(unsigned int nr, unsigned long *addr) > +{ > + __atomic_fetch_or(addr, (1UL << nr), __ATOMIC_ACQ_REL); > +} If it is specific for IO the IMO, it makes sense call the API to rte_io_set_bit() like rte_io_rmb and change the header file to rte_io_bitops.h. The barries are only needed for IO operations. Explicitly is not conveying it in API name would call for using it for normal cases. Other option could be to introduce, generic and IO specific bit operations operations separately.