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 789AFA04B3; Mon, 23 Dec 2019 17:36:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1CAF2BA3; Mon, 23 Dec 2019 17:36:55 +0100 (CET) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 5F7B61F5 for ; Mon, 23 Dec 2019 17:36:54 +0100 (CET) Received: by mail-pl1-f195.google.com with SMTP id a6so6648152plm.3 for ; Mon, 23 Dec 2019 08:36:54 -0800 (PST) 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=eTd8fkh5L9qtlSaxWN+wHwT008BsJsU+o1O0KxA9q60=; b=cirkxKLyTjboQRZgRFBkpD/BZwFot7PT77GRvck94SqG9VvqTJCe+ZE45+T1mA/nU7 6jjv+pEQVjr1u3K8uXxPfDaJ0UlfFywDsSN/2nsiYVtLE+PNCWJ/dv7UuCni+UoPtP9c WKNHeVpAHXqunH7frM9lRU0zX2Dzv9d3GWCGhp6SHv+O22jusrxsmdKggwzLo8H9SLkt tEC86Z/nHjcv69i4DBfkIZ0YgQAaS5yypdDhfIYApBogg3ED+3lxXLJIazloO5flKrVG duBVZtUkmXuISHBKJ465ehdbj9e1A1ESlo9SqCqqikSduUn5QHGWGzy0MDYJekNDRr9w c+YQ== 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=eTd8fkh5L9qtlSaxWN+wHwT008BsJsU+o1O0KxA9q60=; b=MQNrWx77BJoBVQxM9hbSrFCjCnkbmPGUUuFwIUu/IaujYgqL/Ag9MVjI4Sjj8EDmLm jY41JFyVIWQyUadq8gr3mgsOsqAip5XSi374LEZ3LGsnZyPMbE5ApopgQrnCiBUQjctu Fk8Gfd8fCdx2Kv8DejxgWiSiZvt4KlLG5E4rDraa+vrnk65a0q5tLGOyyffNh9IEuGld pU3gdNWXcbkW5WCE3uIY2fqlEbreBrrmmGQGYzicdgGc7Sro8ZWfHytf/ur3f5Z28xdS NgcHaGFxPBAOB2auljJL8ZBQUKUZUITxcVHPf6ConFjgbvHdChgrMadwFFI6afS6B4AS 6bLw== X-Gm-Message-State: APjAAAXcg8W5XYhZ9Nd8KYce3AFyMK/iUs10CyMUUeAob3xjMYojxnYv /fiMBu5pWLGeZnQcH/6wewOwlg== X-Google-Smtp-Source: APXvYqwoa3A6NGGz1iwvkFMjyJKGItHDIxYJgeH1QvRUrGWdZXNZoeFlMZVTHTJUuD2NmcAyxmQgLg== X-Received: by 2002:a17:90a:b78d:: with SMTP id m13mr4147480pjr.100.1577119013382; Mon, 23 Dec 2019 08:36:53 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z30sm25570953pff.131.2019.12.23.08.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2019 08:36:53 -0800 (PST) Date: Mon, 23 Dec 2019 08:36:44 -0800 From: Stephen Hemminger To: Honnappa Nagarahalli Cc: Joyce Kong , "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" , Phil Yang , Gavin Hu , nd , "dev@dpdk.org" Message-ID: <20191223083644.4de8e184@hermes.lan> In-Reply-To: References: <1571125801-45773-1-git-send-email-joyce.kong@arm.com> <1576648808-24765-2-git-send-email-joyce.kong@arm.com> <20191221100752.04838f7a@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 1/6] 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 Mon, 23 Dec 2019 05:04:12 +0000 Honnappa Nagarahalli wrote: > > > > > > On Sat, 21 Dec 2019 16:07:23 +0000 > > Honnappa Nagarahalli wrote: > > > > > Converting these into macros will help remove the size based duplication of > > APIs. I came up with the following macro: > > > > > > #define RTE_GET_BIT(nr, var, ret, memorder) \ ({ \ > > > if (sizeof(var) == sizeof(uint32_t)) { \ > > > uint32_t mask1 = 1U << (nr)%32; \ > > > ret = __atomic_load_n(&var, (memorder)) & mask1;\ > > > } \ > > > else {\ > > > uint64_t mask2 = 1UL << (nr)%64;\ > > > ret = __atomic_load_n(&var, (memorder)) & mask2;\ > > > } \ > > > }) > > > > Macros are more error prone. Especially because this is in exposed header file > That's another question I have. Why do we need to have these APIs in a public header file? These will add to the ABI burden as well. These APIs should be in a common-but-not-public header file. I am also not sure how helpful these APIs are for applications as these APIs seem to have considered requirements only from the PMDs. Why do we have to wrap every C atomic builtin? What value is there in that?