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 58256A2EFC for ; Tue, 15 Oct 2019 18:53:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22E7F1EDDA; Tue, 15 Oct 2019 18:53:42 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 777531EDC0 for ; Tue, 15 Oct 2019 18:53:40 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id u12so9848199pls.12 for ; Tue, 15 Oct 2019 09:53:40 -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=9Ty0pSUwYq+TYnlUsbtMO/d0VxpAZBH+tN0qzbUjEdg=; b=ERTveTGvlaWX4qQiIgyXeoXHA/Q+7vqrqNjXA9opgpNeSgKMwN/PAY2oR9DbcXrzob R2H6EIuT3AOv7dHxfKksfuetazUeiez7aIw9kagxhVa1HQ+Ati9Y4SIFOBPcEbSGd+sn ahAP0W+EkcC4LIV0Qd3fXu8Sme+VS4JzjOfBEH1REXK7VyBoL73JKd2M9nkUKXaYZoJ5 mignHuPqWyyEmhZqoXeRGAsB7SKTRuC0OOCnqoSJkOAvA5ekaGGBKApvgNIWVe9wis1o iWtXUOQXSx+Voj8JPHLitvPCRqkBqA3VuMJ7v4d05+7yr5jDXVw+X/6KrnPjfiwfwv0K Vfmg== 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=9Ty0pSUwYq+TYnlUsbtMO/d0VxpAZBH+tN0qzbUjEdg=; b=tXdUvYSppf6xXxtrh0nFpOkKEFchh0l2pBtUn5wYIrCfz6a9EaA39YCMETgL/Tlmz2 V5fRN2UROeLlIGxBLLOy9eg2SsH9Jl1KHTwC8P6XVCznJDGtoTOWyObMZqh7DDe+Ldtu 2NtuVT9mLMA/oEzHGnxR5rArgrQy/arCBFMIRkPqAm1fkVdQoMC3p6upTiHrOCw5K/kE ZBxkO6LG+D3zEjrWGgPiq2lMSzSPQQs843IEEg+yssmZtGDCoKadUxzbGGe38CGvTuOq cR7w4hSwbmjhoO3zWsOJC6M8sxz3FBMWc3gc5sp9yaZ6qWAAOXdPoCIYb0IiVo8upQX6 C6GQ== X-Gm-Message-State: APjAAAXxgnGdmvDUietnH3q5brGufYpgvE1hL/lRpXAlRrc2JUBy3lq6 boaIQJt+h0U/5TnaRdZUYclOb7m5u+v3YA== X-Google-Smtp-Source: APXvYqz0or1yNzrzn6ZUHZ0bkj48JCjDC/xYzV/VwfQ4wsWxnoLNfGdrWbGEhFN2yLlpXOt8ryYQtw== X-Received: by 2002:a17:902:8348:: with SMTP id z8mr37026483pln.12.1571158419641; Tue, 15 Oct 2019 09:53:39 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 193sm22506485pfc.59.2019.10.15.09.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 09:53:39 -0700 (PDT) Date: Tue, 15 Oct 2019 09:53:32 -0700 From: Stephen Hemminger To: Joyce Kong Cc: dev@dpdk.org, nd@arm.com, thomas@monjalon.net, jerinj@marvell.com, ravi1.kumar@amd.com, xuanziyang2@huawei.com, cloud.wangxiaoyun@huawei.com, zhouguoyang@huawei.com, rmody@marvell.com, shshaikh@marvell.com, honnappa.nagarahalli@arm.com, gavin.hu@arm.com Message-ID: <20191015095332.6c4934eb@hermes.lan> In-Reply-To: <1571125801-45773-2-git-send-email-joyce.kong@arm.com> References: <1571125801-45773-1-git-send-email-joyce.kong@arm.com> <1571125801-45773-2-git-send-email-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 15 Oct 2019 15:49:57 +0800 Joyce Kong wrote: > +static inline void > +rte_set_bit(unsigned int nr, unsigned long *addr) > +{ > + __atomic_fetch_or(addr, (1UL << nr), __ATOMIC_ACQ_REL); > +} > + > +static inline void > +rte_clear_bit(int nr, unsigned long *addr) > +{ > + __atomic_fetch_and(addr, ~(1UL << nr), __ATOMIC_ACQ_REL); > +} > + > +static inline int > +rte_test_bit(int nr, unsigned long *addr) > +{ > + int res; > + rte_mb(); > + res = ((*addr) & (1UL << nr)) != 0; > + rte_mb(); > + > + return res; > +} > + > +static inline int > +rte_test_and_set_bit(int nr, unsigned long *addr) > +{ > + unsigned long mask = (1UL << nr); > + > + return __atomic_fetch_or(addr, mask, __ATOMIC_ACQ_REL) & mask; > +} > + > +static inline int > +rte_test_and_clear_bit(int nr, unsigned long *addr) > +{ > + unsigned long mask = (1UL << nr); > + > + return __atomic_fetch_and(addr, ~mask, __ATOMIC_ACQ_REL) & mask; > +} These functions need to be part of API, and have doxygen comments?