From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B1055A0526;
	Tue, 21 Jul 2020 03:55:29 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C874D1BFCD;
	Tue, 21 Jul 2020 03:55:28 +0200 (CEST)
Received: from EUR05-VI1-obe.outbound.protection.outlook.com
 (mail-vi1eur05on2086.outbound.protection.outlook.com [40.107.21.86])
 by dpdk.org (Postfix) with ESMTP id B2AB21BFCA
 for <dev@dpdk.org>; Tue, 21 Jul 2020 03:55:27 +0200 (CEST)
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=kC0YCU8f3R46Yt9IjVDRRwyCyPbY6zUCRg/Ek/Q5YcE=;
 b=Nl50kpj0cYEVtDWEzrgCzmrydi6sRM1UcMgenrFLTqlO7AYCihlyIMHK7hyWcyaY5tVRAGm6brBbn5nIJAyGxJfQgQZ73Mv1HJCmL+CL9GIPz1Clwv3Jf4hyU/3vENKfW8Z8abs+7vq6tAbZ1bY1K6n04t+M8Q5MwM8N3eX049c=
Received: from AM7PR04CA0030.eurprd04.prod.outlook.com (2603:10a6:20b:110::40)
 by VI1PR08MB3967.eurprd08.prod.outlook.com (2603:10a6:803:df::16)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.24; Tue, 21 Jul
 2020 01:55:24 +0000
Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:20b:110:cafe::27) by AM7PR04CA0030.outlook.office365.com
 (2603:10a6:20b:110::40) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend
 Transport; Tue, 21 Jul 2020 01:55:24 +0000
X-MS-Exchange-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
 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with
 Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3195.18 via Frontend Transport; Tue, 21 Jul 2020 01:55:23 +0000
Received: ("Tessian outbound 8f45de5545d6:v62");
 Tue, 21 Jul 2020 01:55:23 +0000
X-CR-MTA-TID: 64aa7808
Received: from a40fa26ca6fb.2
 by 64aa7808-outbound-1.mta.getcheckrecipient.com id
 9A7FFD91-9F38-4CF9-B245-448138CA350B.1; 
 Tue, 21 Jul 2020 01:55:18 +0000
Received: from EUR02-VE1-obe.outbound.protection.outlook.com
 by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a40fa26ca6fb.2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
 Tue, 21 Jul 2020 01:55:18 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=KVMfAJ0cB9/8uaP9BywllmkXSlocmatYYFKeNAsV+v9fLvbov434ApOygEU489oqazFTwHdRr4+6fiUNbDgqzIWFFjYJAoX8dQMMDZXHgrOMbBze8dVLmiSEmUAZAa1WgS15K6SWLrWiI5AwzWWvNEXgzGtr5/y4ur7umXuhJVhCHRjfDiDZc0Ln6cGk7dGRc3eVWQDV3v8JbziYMJi3VRKskNfYQJjPFStRjfHEMzQ2tuwdqgdYwmtWudevC6WJ15DbnWY6GbM3wiZI3AY5lFOj2+vnGaM9Ko9ubRl0EroUSq2APRuBuoEUcFxMBzHL03I9TMLgiTJLahllIo3TSA==
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=kC0YCU8f3R46Yt9IjVDRRwyCyPbY6zUCRg/Ek/Q5YcE=;
 b=gRhOgtGRHRiR7KgekuJlRo47/+CPDjvp+knHzcBh61zYkCO73xG1DVsragLrajn4VKK7RvGERSWJCipPjaT9Qs9JTOL/JsBKkhun4ZtgNHqp6iCvH646/6pWkj/D6t5iKuSQtKvBSIIM5385iwwkQ7cVM4qF6RG5RUMk+lbfGc7TdGSplT/IQ4nMerThJ2HkzirVMI2JjtqKF/qH0Kqk5bRkZ/bpgXBjEjcU4Z62oRv8ArjpiilLurP/VvDiu8LzP1biMNG4RO1Ad4HKOCUow5JmEMIrtvvtgnnhw41nyHTM7AY+gdSHbBrBfLZbs7nBJFFo1lZCnM0aPpo45zlz7Q==
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=kC0YCU8f3R46Yt9IjVDRRwyCyPbY6zUCRg/Ek/Q5YcE=;
 b=Nl50kpj0cYEVtDWEzrgCzmrydi6sRM1UcMgenrFLTqlO7AYCihlyIMHK7hyWcyaY5tVRAGm6brBbn5nIJAyGxJfQgQZ73Mv1HJCmL+CL9GIPz1Clwv3Jf4hyU/3vENKfW8Z8abs+7vq6tAbZ1bY1K6n04t+M8Q5MwM8N3eX049c=
Received: from VE1PR08MB4640.eurprd08.prod.outlook.com (2603:10a6:802:b2::11)
 by VE1PR08MB4909.eurprd08.prod.outlook.com (2603:10a6:802:a8::22)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.25; Tue, 21 Jul
 2020 01:55:14 +0000
Received: from VE1PR08MB4640.eurprd08.prod.outlook.com
 ([fe80::28a3:3a4e:65ca:5707]) by VE1PR08MB4640.eurprd08.prod.outlook.com
 ([fe80::28a3:3a4e:65ca:5707%3]) with mapi id 15.20.3195.025; Tue, 21 Jul 2020
 01:55:14 +0000
From: Phil Yang <Phil.Yang@arm.com>
To: Alexander Kozyrev <akozyrev@mellanox.com>, Matan Azrad
 <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>, Slava Ovsiienko
 <viacheslavo@mellanox.com>
CC: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
 "drc@linux.vnet.ibm.com" <drc@linux.vnet.ibm.com>, nd <nd@arm.com>,
 "dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>, nd <nd@arm.com>
Thread-Topic: [dpdk-dev] [PATCH v3] net/mlx5: relaxed ordering for
 multi-packet	RQ buffer refcnt
Thread-Index: AQHWXuyRqTPpygPJg0imDSLz2DSNPakRQ72Q
Date: Tue, 21 Jul 2020 01:55:14 +0000
Message-ID: <VE1PR08MB4640533BAC018189F7164F39E9780@VE1PR08MB4640.eurprd08.prod.outlook.com>
References: <20200410164127.54229-7-gavin.hu@arm.com>
 <1592900807-13289-1-git-send-email-phil.yang@arm.com>
 <VE1PR08MB4640FDCC1C68241E77DC4CD7E9600@VE1PR08MB4640.eurprd08.prod.outlook.com>
 <AM0PR05MB4561A88F6F1F6B15FB754DCBA27B0@AM0PR05MB4561.eurprd05.prod.outlook.com>
In-Reply-To: <AM0PR05MB4561A88F6F1F6B15FB754DCBA27B0@AM0PR05MB4561.eurprd05.prod.outlook.com>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ts-tracking-id: 1cd67ba2-3585-4ac7-b332-1218b481ccac.0
x-checkrecipientchecked: true
Authentication-Results-Original: mellanox.com; dkim=none (message not signed)
 header.d=none; mellanox.com;
 dmarc=none action=none header.from=arm.com; 
x-originating-ip: [203.126.0.113]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: 2c48e78d-96c2-43df-7874-08d82d1921f8
x-ms-traffictypediagnostic: VE1PR08MB4909:|VI1PR08MB3967:
x-ms-exchange-transport-forked: True
X-Microsoft-Antispam-PRVS: <VI1PR08MB39670361FA7A54A7481ADA3CE9780@VI1PR08MB3967.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original: v5RLK/R+m4U8gVTMIIFuzRbXPmdEQ3Pi+nE/7kKEef5V8e+ssJ+KJTo3bel4O/eTcCwFpKua6R4Hf4+tyKYdMjPJP6O4OVNSKvTMAdNy2qxeT5IDtg49yLPnRVDQkTZuIToCNpvNroSbM9G2ud7v5cw4264yKLubIsoqpm3s6w0BYSzyDkex6hs9jmQ9NhcQOMohVTEX1IOLiSmuoh2W/7CzEjJ69YEf4lbQNmLoyK9gdsDJ4Z19Y4UrCz3E3Sk9V6e236OwzwHnfK3Opymk6c8eang7+QHkOwQhP0Pjq7wsgGERIRxLAbwwo4gCO3xrRxYCdq5oBM0lm5X0R9RCqnai3C2D1CFuitvMfBv0hRtAHWkhqziPZDQu31pEY/7aMNq2rtCkg+3EbmCpzN9eXGOkVNySBTyiRcclgyPU44Qqa9pAQmCKDJUR3oURkBC0yxA0Jwod+g6YrZb0bHAfhLvWm39F5UCko5tqUBEzuxc=
X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en;
 SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4640.eurprd08.prod.outlook.com;
 PTR:; CAT:NONE; SFTY:;
 SFS:(4636009)(136003)(396003)(366004)(346002)(376002)(39860400002)(5660300002)(71200400001)(186003)(7696005)(2906002)(478600001)(83380400001)(52536014)(76116006)(86362001)(45080400002)(33656002)(66946007)(66476007)(66556008)(64756008)(66446008)(26005)(8936002)(4326008)(54906003)(53546011)(6506007)(316002)(55016002)(9686003)(966005)(83080400001)(110136005);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: bSxZ1HoXqzckzzsS59DBrwvSOmg7CDetFRcigHFUpU8ltSouc/d8I9VF0UMIu65NbTaX1N5Wu762Fi/ULvf6yZIclUMUL3Bachmhij3inZ1MDQWd5injeMyibsD4EqxztKSEmuA2UIkYBZQhLum0QrwnuWIcAYqBsTkFo0P48u8RyrfN8hnBSVaMzl9oJRWvYzquB2oNyGLP9d3K2DqbQaiGfRrlqb9Celi6eAhAvp1GwBQN4fCfraIYCro+R30+5ECYhoDbyGStdGaFFFJ1mbUYT1cLsH/5UL/Tmzzxr872wY5qiIUd+pGI5VmIVo6HaWrXc7iALwSJdJ6LqFysw8T8Z1jXfyw7AMk8LwKDO+3+YJdtP0HqH/5tVfWcdoZuVFmx1RJMZTr9ILah3j9hqgRCay+PnGEcuT2MULeukDoe5cT1dlc6mwteZ8Iw634cWIpQiGlaSG/64/0CfwhJCh1pUlbed+7sDUCm5rFJOtU=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4909
Original-Authentication-Results: mellanox.com; dkim=none (message not signed)
 header.d=none; mellanox.com;
 dmarc=none action=none header.from=arm.com; 
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com
X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:;
 IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com;
 PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:;
 SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966005)(33656002)(52536014)(81166007)(55016002)(186003)(86362001)(83080400001)(82310400002)(7696005)(356005)(26005)(47076004)(966005)(478600001)(82740400003)(8936002)(70586007)(70206006)(5660300002)(45080400002)(6506007)(4326008)(336012)(36906005)(2906002)(110136005)(54906003)(83380400001)(9686003)(316002)(53546011);
 DIR:OUT; SFP:1101; 
X-MS-Office365-Filtering-Correlation-Id-Prvs: 60818dfc-fda7-4862-ebef-08d82d191c50
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: pGDrGEMj4WLhK2QpeOnD2Sgm7CkgO4+ncwdccPFU5W0nlXZpPesWP/wiBgq54qAtvxCgd8+MFDFaFVomBjanZPHgQHC3nkVOnH8EFezQ7Tq7W7b9km6jMDMCY1GQMPoPs77hSTKCuXQIuEdaThVlzXc6YsX5emZ1dy0v+uwOexCBEvbtjpV8EOG3TB9dYowxV6pM9EwrLrrvxYBErcd5KxI8I/PgeZwR4RAFX5y6sRstm+eR0WhcTKpgOMUr1mV9+Iw6U/pMQoT8R2bigs4NnlGcCeqTPIkUc2Q6cZh/TglqUYAxEs7wn8W1ZRKIHbQc519xHGaLlqdjP79i3yoXnQlSW4sYLGcRo1Owbxh9rCdVbZ93Sz5TAoxmdp7EazrtcJ35WpEm8J0VJUw/A3ZyLcK/W8O8e7yac1rErtV2XjwLNuv1GGxcLCOvi5SO7M5UE5yzSy6eBphcQo7/nPyo4GMZrNfzXBC1y2viIPpS8l+N4SwampGpaZi4RGqnYiXewGFcaNKFQoQK5zYRSUz0m/L1cO5Qltwqo+PaylkBQmg=
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 01:55:23.9159 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 2c48e78d-96c2-43df-7874-08d82d1921f8
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-AuthSource: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3967
Subject: Re: [dpdk-dev] [PATCH v3] net/mlx5: relaxed ordering
	for	multi-packet	RQ buffer refcnt
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Alexander Kozyrev <akozyrev@mellanox.com> writes:

<...>
> Subject: RE: [dpdk-dev] [PATCH v3] net/mlx5: relaxed ordering for multi-
> packet RQ buffer refcnt
>=20
> Hi Phil Yang, we noticed that this patch gives us 10% of performance
> degradation on ARM.
> x86 seems to be unaffected though. Do you know what may be the reason
> of this behavior?

Hi Alexander,

Thanks for your feedback.=20
This patch removed some expensive memory barriers on aarch64, it should get=
 better performance.=20
I am not sure the root cause of this degradation now, I will start the inve=
stigation. We can profiling this issue together.
Could you share your test case(including your testbed configuration) with u=
s?=20

Thanks,
Phil
>=20
> Regards,
> Alex
>=20
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Phil Yang
> > Sent: Sunday, July 12, 2020 23:02
> > To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> > <shahafs@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> > Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> > drc@linux.vnet.ibm.com; nd <nd@arm.com>; Phil Yang
> <Phil.Yang@arm.com>;
> > dev@dpdk.org; nd <nd@arm.com>
> > Subject: Re: [dpdk-dev] [PATCH v3] net/mlx5: relaxed ordering for multi=
-
> packet
> > RQ buffer refcnt
> >
> > Hi,
> >
> > We are also doing C11 atomics converting for other components.
> > Your insight would be much appreciated.
> >
> > Thanks,
> > Phil Yang
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Phil Yang
> > > Sent: Tuesday, June 23, 2020 4:27 PM
> > > To: dev@dpdk.org
> > > Cc: matan@mellanox.com; shahafs@mellanox.com;
> > > viacheslavo@mellanox.com; Honnappa Nagarahalli
> > > <Honnappa.Nagarahalli@arm.com>; drc@linux.vnet.ibm.com; nd
> > > <nd@arm.com>
> > > Subject: [dpdk-dev] [PATCH v3] net/mlx5: relaxed ordering for
> > > multi-packet RQ buffer refcnt
> > >
> > > Use c11 atomics with explicit ordering instead of the rte_atomic ops
> > > which enforce unnecessary barriers on aarch64.
> > >
> > > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > > ---
> > > v3:
> > > Split from the patchset:
> > >
> https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fpatch
> > >
> >
> work.dpdk.org%2Fcover%2F68159%2F&amp;data=3D02%7C01%7Cakozyrev%40
> m
> > ellano
> > >
> >
> x.com%7C1e3dc839a3604924fdf208d826d934ad%7Ca652971c7d2e4d9ba6a4d
> 1
> > 49256
> > >
> >
> f461b%7C0%7C0%7C637302061620808255&amp;sdata=3DmRXbgPi6HyrVtP04Vl
> 7
> > Bx8lD0
> > > trVP7noQlpOD7gBoTQ%3D&amp;reserved=3D0
> > >
> > >  drivers/net/mlx5/mlx5_rxq.c  |  2 +-
> > >  drivers/net/mlx5/mlx5_rxtx.c | 16 +++++++++-------
> > > drivers/net/mlx5/mlx5_rxtx.h |  2 +-
> > >  3 files changed, 11 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.=
c
> > > index dda0073..7f487f1 100644
> > > --- a/drivers/net/mlx5/mlx5_rxq.c
> > > +++ b/drivers/net/mlx5/mlx5_rxq.c
> > > @@ -1545,7 +1545,7 @@ mlx5_mprq_buf_init(struct rte_mempool *mp,
> void
> > > *opaque_arg,
> > >
> > >  	memset(_m, 0, sizeof(*buf));
> > >  	buf->mp =3D mp;
> > > -	rte_atomic16_set(&buf->refcnt, 1);
> > > +	__atomic_store_n(&buf->refcnt, 1, __ATOMIC_RELAXED);
> > >  	for (j =3D 0; j !=3D strd_n; ++j) {
> > >  		shinfo =3D &buf->shinfos[j];
> > >  		shinfo->free_cb =3D mlx5_mprq_buf_free_cb; diff --git
> > > a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index
> > > e4106bf..f0eda88 100644
> > > --- a/drivers/net/mlx5/mlx5_rxtx.c
> > > +++ b/drivers/net/mlx5/mlx5_rxtx.c
> > > @@ -1595,10 +1595,11 @@ mlx5_mprq_buf_free_cb(void *addr
> > __rte_unused,
> > > void *opaque)  {
> > >  	struct mlx5_mprq_buf *buf =3D opaque;
> > >
> > > -	if (rte_atomic16_read(&buf->refcnt) =3D=3D 1) {
> > > +	if (__atomic_load_n(&buf->refcnt, __ATOMIC_RELAXED) =3D=3D 1) {
> > >  		rte_mempool_put(buf->mp, buf);
> > > -	} else if (rte_atomic16_add_return(&buf->refcnt, -1) =3D=3D 0) {
> > > -		rte_atomic16_set(&buf->refcnt, 1);
> > > +	} else if (unlikely(__atomic_sub_fetch(&buf->refcnt, 1,
> > > +					       __ATOMIC_RELAXED) =3D=3D 0)) {
> > > +		__atomic_store_n(&buf->refcnt, 1, __ATOMIC_RELAXED);
> > >  		rte_mempool_put(buf->mp, buf);
> > >  	}
> > >  }
> > > @@ -1678,7 +1679,8 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct
> > > rte_mbuf **pkts, uint16_t pkts_n)
> > >
> > >  		if (consumed_strd =3D=3D strd_n) {
> > >  			/* Replace WQE only if the buffer is still in use. */
> > > -			if (rte_atomic16_read(&buf->refcnt) > 1) {
> > > +			if (__atomic_load_n(&buf->refcnt,
> > > +					    __ATOMIC_RELAXED) > 1) {
> > >  				mprq_buf_replace(rxq, rq_ci & wq_mask,
> > strd_n);
> > >  				/* Release the old buffer. */
> > >  				mlx5_mprq_buf_free(buf);
> > > @@ -1790,9 +1792,9 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct
> > > rte_mbuf **pkts, uint16_t pkts_n)
> > >  			void *buf_addr;
> > >
> > >  			/* Increment the refcnt of the whole chunk. */
> > > -			rte_atomic16_add_return(&buf->refcnt, 1);
> > > -			MLX5_ASSERT((uint16_t)rte_atomic16_read(&buf-
> > > >refcnt) <=3D
> > > -				    strd_n + 1);
> > > +			__atomic_add_fetch(&buf->refcnt, 1,
> > > __ATOMIC_ACQUIRE);
> > > +			MLX5_ASSERT(__atomic_load_n(&buf->refcnt,
> > > +				    __ATOMIC_RELAXED) <=3D strd_n + 1);
> > >  			buf_addr =3D RTE_PTR_SUB(addr,
> > > RTE_PKTMBUF_HEADROOM);
> > >  			/*
> > >  			 * MLX5 device doesn't use iova but it is necessary in
> a
> > diff
> > > --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
> > > index 26621ff..0fc15f3 100644
> > > --- a/drivers/net/mlx5/mlx5_rxtx.h
> > > +++ b/drivers/net/mlx5/mlx5_rxtx.h
> > > @@ -78,7 +78,7 @@ struct rxq_zip {
> > >  /* Multi-Packet RQ buffer header. */
> > >  struct mlx5_mprq_buf {
> > >  	struct rte_mempool *mp;
> > > -	rte_atomic16_t refcnt; /* Atomically accessed refcnt. */
> > > +	uint16_t refcnt; /* Atomically accessed refcnt. */
> > >  	uint8_t pad[RTE_PKTMBUF_HEADROOM]; /* Headroom for the first
> > packet.
> > > */
> > >  	struct rte_mbuf_ext_shared_info shinfos[];
> > >  	/*
> > > --
> > > 2.7.4