From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6157C32771 for ; Tue, 7 Jan 2020 00:45:05 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 3A914206F0 for ; Tue, 7 Jan 2020 00:45:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="sGfJPoVk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="sGfJPoVk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A914206F0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AD371D730; Tue, 7 Jan 2020 01:45:04 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150070.outbound.protection.outlook.com [40.107.15.70]) by dpdk.org (Postfix) with ESMTP id 681581D72F for ; Tue, 7 Jan 2020 01:45:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kwHRIkEtjTcK57Q86yy9bYE71cxynZaJY+0Qw1KmDI=; b=sGfJPoVkqSqYddTkSDl4dOMwhwpzSOLKC+YRwBNuLD1H7CBVR6ENMxPvNwhzmp7ZH3K46Yp//83oQ+JstGmR0KECkLK+uNc5PqPdo1eBqOFW2YHciLnxiuNmPn8ft3lQbRBn0IqpJ5nd8SX77mSeoRQ7Dfy++HynkQbrNOTKC48= Received: from VE1PR08CA0012.eurprd08.prod.outlook.com (2603:10a6:803:104::25) by DB6PR0802MB2597.eurprd08.prod.outlook.com (2603:10a6:4:99::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Tue, 7 Jan 2020 00:45:00 +0000 Received: from VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by VE1PR08CA0012.outlook.office365.com (2603:10a6:803:104::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10 via Frontend Transport; Tue, 7 Jan 2020 00:45:00 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT006.mail.protection.outlook.com (10.152.18.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 00:45:00 +0000 Received: ("Tessian outbound ca1df68f3668:v40"); Tue, 07 Jan 2020 00:44:59 +0000 X-CR-MTA-TID: 64aa7808 Received: from 1511c86d9a7c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2A06BCA1-5736-4716-AB30-DE8739EC7DC0.1; Tue, 07 Jan 2020 00:44:54 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1511c86d9a7c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jan 2020 00:44:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nQl0cbnjY09F4Rt9MBTkitaZR2v3jlpg8z+6HZ1FiDxX22Bdjxcy3J386akWLNxkk5Z8WzOkEk5e3VBv7XQe+yUgXU2zLPEDm0+MYAv7sSfk99YMk69LVBl5WqResupI3R8yY80RGLrncwWKNNeFNRh2AGbz/gHbNGqBT7h3ck+xcwIKnag1534IanNLEKQ7O/Ama49tIxrhMBZSjgDpXIKGSan6xN3Ath+NaIr98UuerZJfBzwJqzS4u5Wfets3H+C9NfbcLmQYz02bUuATz+ar/9/sPsR/sLXuSrQtfYwBoU3u5I8uh8sskqM4kzx8aTPgq807cFejtuvWFYZMhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kwHRIkEtjTcK57Q86yy9bYE71cxynZaJY+0Qw1KmDI=; b=jjfJGrWDOksmNaXTAV9oo6TSYnwvUrADGGVXLTZI+DpiNxi8GHhMqPAzEDSa9a0Baa2KuS3hKtoVFSlVvBr0YSBVEyj8vy91LYBZawpyBbdA1qcjBiLeRX6RVtQZSW1Ottpmr9WZ5HTdI3mkhdgqWy5FYl5CN/3XevicKCBvCTfLT2ntxm8iQ7/a00eNuuR4W6I41717ig9s8Z469VXQ22wUQiDrQ7Bv6kcQXdYGt4KrRHe6Ek7n1qNTnSF/gT863kXufBYgTQJaj1a/rLNHSlW/gTInNla23gUFWFweC/X7CCYnBVXPqiA0/MSBZfIfDdenlX7vkBZFt0evylJoXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kwHRIkEtjTcK57Q86yy9bYE71cxynZaJY+0Qw1KmDI=; b=sGfJPoVkqSqYddTkSDl4dOMwhwpzSOLKC+YRwBNuLD1H7CBVR6ENMxPvNwhzmp7ZH3K46Yp//83oQ+JstGmR0KECkLK+uNc5PqPdo1eBqOFW2YHciLnxiuNmPn8ft3lQbRBn0IqpJ5nd8SX77mSeoRQ7Dfy++HynkQbrNOTKC48= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB5039.eurprd08.prod.outlook.com (10.255.159.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 00:44:51 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 00:44:51 +0000 From: Honnappa Nagarahalli To: Gavin Hu , Stephen Hemminger 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 , nd , "dev@dpdk.org" , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v6 1/6] lib/eal: implement the family of rte bit operation APIs Thread-Index: AQHVtWiBQ1n0Dk5tDEKroTViQBZDeKfCfMMAgAJBDyCAACp8AIACRrEggADEggCAChzcgIAMZtQw Date: Tue, 7 Jan 2020 00:44:51 +0000 Message-ID: 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> <20191223083644.4de8e184@hermes.lan> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 49da9bcf-15b1-437c-a545-24e2407fe7b7.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ca53618a-5d2f-497b-67c2-08d7930ad384 X-MS-TrafficTypeDiagnostic: VE1PR08MB5039:|VE1PR08MB5039:|DB6PR0802MB2597: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; x-forefront-prvs: 027578BB13 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(346002)(396003)(136003)(39860400002)(189003)(199004)(186003)(8936002)(71200400001)(478600001)(45080400002)(52536014)(966005)(33656002)(76116006)(7416002)(86362001)(8676002)(81156014)(26005)(66476007)(81166006)(66946007)(66556008)(64756008)(66446008)(7696005)(55016002)(9686003)(2906002)(5660300002)(316002)(110136005)(6506007)(54906003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5039; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: SB4SZGXkxW/PkFRXoz273RcWBqmY2qPm3C7TdDwjGtHoUJc6luxy3GFBKNF5/gqPGFN2X7ZZFc6GojA5yLGGZh9f6zs4TOlBzCuSIBN6qKfcdRdoKhgs+Hz1QpV01l8geBxyW+sID05NWDZXz3yph3VFj+nPhsKE2epKqaG+WnI714UVMC9+ZU2EBc22zDB1z/3duDIzZ+A6Pa73V/N08ChlYSLIbFz8qHzYQy/XJKCiMPLODRSPgp/jrAGsIoa984OwFzs2k0cd46uQ44ApfhJSnRnDZ3cf9F7xul+ZlI8zK3ipvQkwl1IoTm3Sx8Y3Thbc6FYzyUizH2Icx0kDMuueaOrlmBveKlNabKHIlXOs6ZK3paxyIPWJ5KkfBvXFCSJVlNIGal23kaxxje/Pe0aVrKVlB12y6045j0X8jrj2TUPMba70j7RivJvDI4rtGY/x3d88a4jEMMP7akv6FIxRWUquJbKKSsnzsi9/oIc= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5039 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(39860400002)(376002)(396003)(189003)(199004)(26005)(9686003)(70206006)(336012)(356004)(70586007)(966005)(8936002)(55016002)(186003)(2906002)(6506007)(7696005)(8676002)(52536014)(4326008)(36906005)(81156014)(478600001)(81166006)(86362001)(26826003)(316002)(54906003)(45080400002)(33656002)(5660300002)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2597; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 6e51a2c1-0945-4481-b6fc-08d7930ace3b NoDisclaimer: True X-Forefront-PRVS: 027578BB13 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JoXVOU7PZ9onzsv02XZ3l3A1nZiftL3Q2qdrIjMGw9f15GWWI9tFpL6OYq/WH4rEpZG54wDG3E0IUyFqEYcPtVUB/82uLNJWeJprUC/SjE5d6Za9P/alCqYcr8L5ZIqF6axZ2hkwhbuzX6uS+rR014agI77LwYQyP5KcAiTiZSfaLHJqx1/tOfXfxsp0fKYH40o77GzoCQcI/Zql969xlrsmv5OcL1KJZf+yDtLWhX2esvSIeA56qomgR/oAzqpPd0nmqDFwzzfrd6ERbGCBFRLgmRWm0Wmna/nvyT+nr28rm5jWkzK23pU1L+eomvFeqTn6WnampKPSks6V7Tel+DrzEtRtaNFHOflixiqt/7lFjdUdw+sxVwcAgb1LgX7JswfiBlXzvv0js1ql1isBAGeHnx/egBga8yiY6Lz76MDJ8k0gxQ870Wmpt6lm9ta7LbXp1UbEPFDU8JnRGH9XWSTrczjBujsODmepHY0+ccVQdwPWwXpc4lEDVXkmguU5t8z4fpQelzFuM9uAnI6cOw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 00:45:00.2749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca53618a-5d2f-497b-67c2-08d7930ad384 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2597 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 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) =3D=3D sizeof(uint32_t)) { \ > > > > > uint32_t mask1 =3D 1U << (nr)%32; \ > > > > > ret =3D __atomic_load_n(&var, (memorder)) & mask1;\ > > > > > } \ > > > > > else {\ > > > > > uint64_t mask2 =3D 1UL << (nr)%64;\ > > > > > ret =3D __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 t= hat? >=20 > The wrapping is aimed to reduce code duplication, on average 3 lines cut > down to 1 line for a single core. > Overall I am thinking this bitops APIs are targeted for use by PMDs only, > applications can use C11 freely. > The initial thought for the new APIs came from the idea of consolidating = the > scattered bit operations all over the PMDs. It is unwise to expanding to > applications or libraries, as different memory orderings are required and > complexity generate. >=20 > If the use cases are limited to PMDs, a 'volatile' or a compiler barrier = is > sufficient therefore the number of APIs can be saved by half. > http://inbox.dpdk.org/dev/VI1PR08MB53766C30B5CDA00FB9FCE9678F2E0 > @VI1PR08MB5376.eurprd08.prod.outlook.com/ >=20 > Any thoughts and comments are welcome! I would prefer that the APIs/Macros just address PMD's requirements. These = also should be kept private (through naming conventions?). Given that the c= urrent PMDs are not using C11, we can skip using C11 atomics in these APIs. >=20