From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89F3542B91; Wed, 24 May 2023 22:13:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D3F84067E; Wed, 24 May 2023 22:13:52 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 256B940156 for ; Wed, 24 May 2023 22:13:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684959230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wJ4Cg6/8HpLrNTWQfzWNZIvZIpnnoovoOt9BQvLZytY=; b=MJC5sLA5a7OstvOqI8UA1mxThyXjSRZXCD0DrX7Y4cgY1KdzEA3zeKhBQYjWB1u4I4fGd/ j+q/cGEzEgizKzOk/eK2DPAc/DUoHCJIVc6kdPNMrraePtpzHA8nnE40q0pBRSokEnJMPH d1kCQ/x58zSwBzY5oMJVmKQy/q+Ar68= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-s-fHUIZhP2WV0MA3lzX9rQ-1; Wed, 24 May 2023 16:13:48 -0400 X-MC-Unique: s-fHUIZhP2WV0MA3lzX9rQ-1 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1ae4c08429eso3792365ad.1 for ; Wed, 24 May 2023 13:13:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684959228; x=1687551228; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wJ4Cg6/8HpLrNTWQfzWNZIvZIpnnoovoOt9BQvLZytY=; b=N/4JNG54tknuCWLeGMvtK6HZD42mSqh2i9oMnAct6CBGL9+FS6FyZBasble0SqxWxZ JMIi1x7vVJ9GR0E4nkHxDUZBLFpgB4sQJf24xmrbAFV3VrayuFFo0ScORhcOwGleBvbr eb0md9/77Pz+Cv/D5Qyxt8y+cAZFiCvVfxyHM0DZ4ppmEF3I1UVITogqNgzEqFLgbfJd 9xUPOcZvNvMAoeisgNZxc3jkVMmlwvA6TGiGuNRcu6wZIBsfoJriJvB6Y+y+St16rnMG 88nyTDgLAEMR2YpxYt7842GOYZfDSGM7mqHoPVFxh/1vQODlIp9i1i0gUW36xgUboV9G hePQ== X-Gm-Message-State: AC+VfDzNPvi3YVI4Ipymx4pFi+L0kGRf4teAlU/3Ooj9aG5RjzpDfCtr pq/If8OS1B1Z0qD5RbfKvxA8X2WYzO37ZfZR/dkx1Thed20QAsUAp9gMFO1xcSEBBBb3Idel2Op 1WwmzqzPht6Njf9+shvc= X-Received: by 2002:a17:903:18b:b0:1ac:82bb:ebdf with SMTP id z11-20020a170903018b00b001ac82bbebdfmr20333305plg.58.1684959227857; Wed, 24 May 2023 13:13:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+d5kKZy1dtSbMLFqk29m6H0ewbBuHMX0Q43Ulgixea/YEQLwueIy82cqQ2q0RgWP8F/ZwFuKVg18cBKtSKPk= X-Received: by 2002:a17:903:18b:b0:1ac:82bb:ebdf with SMTP id z11-20020a170903018b00b001ac82bbebdfmr20333289plg.58.1684959227605; Wed, 24 May 2023 13:13:47 -0700 (PDT) MIME-Version: 1.0 References: <1679084388-19267-1-git-send-email-roretzla@linux.microsoft.com> <1679612036-30773-1-git-send-email-roretzla@linux.microsoft.com> <1679612036-30773-7-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1679612036-30773-7-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Wed, 24 May 2023 22:13:36 +0200 Message-ID: Subject: Re: [PATCH v3 6/7] net/null: replace rte atomics with GCC builtin atomics To: Tetsuya Mukawa Cc: dev@dpdk.org, Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, stephen@networkplumber.org, mb@smartsharesystems.com, Tyler Retzlaff X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hello Tetsuya, Review please. On Thu, Mar 23, 2023 at 11:54=E2=80=AFPM Tyler Retzlaff wrote: > > Replace the use of rte_atomic.h types and functions, instead use GCC > supplied C++11 memory model builtins. > > Signed-off-by: Tyler Retzlaff > --- > drivers/net/null/rte_eth_null.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_n= ull.c > index 47d9554..31081af 100644 > --- a/drivers/net/null/rte_eth_null.c > +++ b/drivers/net/null/rte_eth_null.c > @@ -37,8 +37,8 @@ struct null_queue { > struct rte_mempool *mb_pool; > struct rte_mbuf *dummy_packet; > > - rte_atomic64_t rx_pkts; > - rte_atomic64_t tx_pkts; > + uint64_t rx_pkts; > + uint64_t tx_pkts; > }; > > struct pmd_options { > @@ -101,7 +101,8 @@ struct pmd_internals { > bufs[i]->port =3D h->internals->port_id; > } > > - rte_atomic64_add(&(h->rx_pkts), i); > + /* NOTE: review for potential ordering optimization */ > + __atomic_fetch_add(&h->rx_pkts, i, __ATOMIC_SEQ_CST); > > return i; > } > @@ -128,7 +129,8 @@ struct pmd_internals { > bufs[i]->port =3D h->internals->port_id; > } > > - rte_atomic64_add(&(h->rx_pkts), i); > + /* NOTE: review for potential ordering optimization */ > + __atomic_fetch_add(&h->rx_pkts, i, __ATOMIC_SEQ_CST); > > return i; > } > @@ -152,7 +154,8 @@ struct pmd_internals { > for (i =3D 0; i < nb_bufs; i++) > rte_pktmbuf_free(bufs[i]); > > - rte_atomic64_add(&(h->tx_pkts), i); > + /* NOTE: review for potential ordering optimization */ > + __atomic_fetch_add(&h->tx_pkts, i, __ATOMIC_SEQ_CST); > > return i; > } > @@ -174,7 +177,8 @@ struct pmd_internals { > rte_pktmbuf_free(bufs[i]); > } > > - rte_atomic64_add(&(h->tx_pkts), i); > + /* NOTE: review for potential ordering optimization */ > + __atomic_fetch_add(&h->tx_pkts, i, __ATOMIC_SEQ_CST); > > return i; > } > @@ -316,8 +320,9 @@ struct pmd_internals { > RTE_MIN(dev->data->nb_rx_queues, > RTE_DIM(internal->rx_null_queues))); > for (i =3D 0; i < num_stats; i++) { > + /* NOTE: review for atomic access */ > igb_stats->q_ipackets[i] =3D > - internal->rx_null_queues[i].rx_pkts.cnt; > + internal->rx_null_queues[i].rx_pkts; > rx_total +=3D igb_stats->q_ipackets[i]; > } > > @@ -325,8 +330,9 @@ struct pmd_internals { > RTE_MIN(dev->data->nb_tx_queues, > RTE_DIM(internal->tx_null_queues))); > for (i =3D 0; i < num_stats; i++) { > + /* NOTE: review for atomic access */ > igb_stats->q_opackets[i] =3D > - internal->tx_null_queues[i].tx_pkts.cnt; > + internal->tx_null_queues[i].tx_pkts; > tx_total +=3D igb_stats->q_opackets[i]; > } > > @@ -347,9 +353,11 @@ struct pmd_internals { > > internal =3D dev->data->dev_private; > for (i =3D 0; i < RTE_DIM(internal->rx_null_queues); i++) > - internal->rx_null_queues[i].rx_pkts.cnt =3D 0; > + /* NOTE: review for atomic access */ > + internal->rx_null_queues[i].rx_pkts =3D 0; > for (i =3D 0; i < RTE_DIM(internal->tx_null_queues); i++) > - internal->tx_null_queues[i].tx_pkts.cnt =3D 0; > + /* NOTE: review for atomic access */ > + internal->tx_null_queues[i].tx_pkts =3D 0; > > return 0; > } > -- > 1.8.3.1 > --=20 David Marchand