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 7BD47A00C4; Fri, 24 Apr 2020 06:35:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1445A1C1F7; Fri, 24 Apr 2020 06:35:42 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) by dpdk.org (Postfix) with ESMTP id E3A731C1F6 for ; Fri, 24 Apr 2020 06:35:40 +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=RDcJubR1gG6hmRKqV76Ajaeple1lNfp+ob8y7WSyByE=; b=XIGx2kwqfO2fgdFQrvYlFBs0LHFq4DxLWf5/6y2lMHPdnBeKWo1umq6tAH0SNKVUN2AiGqwz7MYqt5u7UsXbdD2q9/eZQruAFbzp9r0DYMbP3TN1jcTKoQpgSWrmqwNHFGaBEG7esIIJx/CR/dUOQtJS8D9jkMahhaa5NdLsLC0= Received: from DB8PR04CA0018.eurprd04.prod.outlook.com (2603:10a6:10:110::28) by AM5PR0801MB1761.eurprd08.prod.outlook.com (2603:10a6:203:3a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Fri, 24 Apr 2020 04:35:39 +0000 Received: from DB5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:110:cafe::93) by DB8PR04CA0018.outlook.office365.com (2603:10a6:10:110::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Fri, 24 Apr 2020 04:35:39 +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 DB5EUR03FT054.mail.protection.outlook.com (10.152.20.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.19 via Frontend Transport; Fri, 24 Apr 2020 04:35:39 +0000 Received: ("Tessian outbound cbb03e3a1db0:v53"); Fri, 24 Apr 2020 04:35:39 +0000 X-CR-MTA-TID: 64aa7808 Received: from f543985c71d9.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4498C5F0-6423-4287-8877-93CE72674193.1; Fri, 24 Apr 2020 04:35:34 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f543985c71d9.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 24 Apr 2020 04:35:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SfKVPsKv4M0pGwqNIdo1nG/mW2X4B1sNShYgnzddFTfialZ7hwY69lr9ohENKhVvD16oWFMrr02+ASzbidMPSohqVlLzfF+IA5N3FgqEU/duMwlGRcH1oEInuOYbdSS+GCAiQ9MRl1TOeyuOzIBknlf8k8oZ8EN37nfvl+RIqt/u3vWcaRth7CyLDO2rrGkWyVu/szWZnG3/GgMZaJ2XXb70Eye6dkjm0CBJOKrrJ9bAXR8ezGWgPVUg5C4rf87Isx8mkPOYzMrlIjKFcpFABMHniGTPzWQAMNKXgcCvfzr3SncHERxsDuzaOA3YIdL7ZNJ33fFedxy7OnH5MmyDEQ== 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=RDcJubR1gG6hmRKqV76Ajaeple1lNfp+ob8y7WSyByE=; b=VroJqLdOTZy0MBiF9VwayB0a/QMhCCObHr4zT45gvbPNK+ezzSSi9zAIuac/KnMyHRhKn0/ox8ZW/01sfRs/5iYV2XuH9Z1y6uqiK2xuEVjDAtBt8KzKFkrzqbqgu9i/CiSNI/MQHNNOGtQ2wGALngoI+jjqXaMtaEISoB0i+PBr1si5Sc8qqanzzLWBSLOcpUIs4wVVDgixlpbR2D1y3iRy+ROVvcsMJBayV/8Ngj3LTzg5PVxPeiDM9cpaIEHprkOY527e3RdpgeqiI4an6Dp4VUMwhfLfx5+1kJwppoMZ7J9z88qUM4A8m7lFOY7EB2o/iufKQFom8MqKi+Zshg== 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=RDcJubR1gG6hmRKqV76Ajaeple1lNfp+ob8y7WSyByE=; b=XIGx2kwqfO2fgdFQrvYlFBs0LHFq4DxLWf5/6y2lMHPdnBeKWo1umq6tAH0SNKVUN2AiGqwz7MYqt5u7UsXbdD2q9/eZQruAFbzp9r0DYMbP3TN1jcTKoQpgSWrmqwNHFGaBEG7esIIJx/CR/dUOQtJS8D9jkMahhaa5NdLsLC0= Received: from VE1PR08MB4640.eurprd08.prod.outlook.com (2603:10a6:802:b2::11) by VE1PR08MB4831.eurprd08.prod.outlook.com (2603:10a6:802:af::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Fri, 24 Apr 2020 04:35:32 +0000 Received: from VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::785b:54ca:be80:7b66]) by VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::785b:54ca:be80:7b66%2]) with mapi id 15.20.2921.030; Fri, 24 Apr 2020 04:35:32 +0000 From: Phil Yang To: "Ananyev, Konstantin" , "dev@dpdk.org" CC: "thomas@monjalon.net" , "Iremonger, Bernard" , "Medvedkin, Vladimir" , Honnappa Nagarahalli , Gavin Hu , Ruifeng Wang , nd , nd Thread-Topic: [PATCH v2] ipsec: optimize with c11 atomic for sa outbound sqn update Thread-Index: AQHWGZqPEQKS4JpHc0uW//Jx+kOPjKiHr9Rg Date: Fri, 24 Apr 2020 04:35:32 +0000 Message-ID: References: <1584407863-774-7-git-send-email-phil.yang@arm.com> <1587662187-28193-1-git-send-email-phil.yang@arm.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: c3fb97fa-5752-4e5b-a2f0-8630c2d31157.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Phil.Yang@arm.com; x-originating-ip: [58.39.116.39] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b6129efd-e48f-4c5a-cff4-08d7e808f0b5 x-ms-traffictypediagnostic: VE1PR08MB4831:|VE1PR08MB4831:|AM5PR0801MB1761: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:5236;OLM:5236; x-forefront-prvs: 03838E948C 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)(396003)(136003)(376002)(366004)(346002)(39860400002)(5660300002)(186003)(71200400001)(26005)(6506007)(33656002)(53546011)(2906002)(9686003)(8676002)(66476007)(66556008)(64756008)(66446008)(81156014)(316002)(86362001)(15650500001)(55016002)(7696005)(4326008)(54906003)(110136005)(52536014)(66946007)(76116006)(8936002)(478600001); DIR:OUT; SFP:1101; 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: voLBf58Vyd4EgrbVsl8Yp9VYUToPfAs/wjx4t0sudr17irdwKiguFP8lx3fHSLyhltSycgDY+GuzPVjfTFIW+0If/dAMUyuKHUV8TU1WTGHWgpaYhbLQI7YB6PgLBVyEZo2WtPlBXIF5pegNq+ZtyzZI9xAnGKB+tHpwLCMHcO6P9fpcsZ8YOq5w87YawfYbNoeq7Jr9uOg3pj0CvIkL2PK6IRVRiiajA6kPTsxOuNtEvyXJwUE1AHKhbcFF388FlSTQrdpyThlutxAgaWUMpYwG/Gyu0gSgzBHyPUNhj7Qy8JXoE+/H5jBtvCEEWyCebo++Lvu+ASxEo2VEUHr/5LeziILlKSj0vzaqLfRD89loszFsFLA/XyFfIS0neLj4DJcOP1ZC4zB/AeIdxgC7D3/khoTjQBd+GstnWjBwKHXWwbPSJlFz3eUCMoU7DgSL x-ms-exchange-antispam-messagedata: Z+FBkxk98XY/Rxfb1mUt5z+FAQndDvqFEZqtBZ1ft8iK+9EI9NDu5FZW8cZ7HuyQDDhiuQds570w8ck7lcXTb4bz8dfTQu6kUP8NG80p+b8aaYnf+HVABnMpR+PagieKuL8gY209BQ1A/MuQghxHZw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4831 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Phil.Yang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT054.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)(39860400002)(136003)(396003)(346002)(376002)(46966005)(52536014)(26005)(33656002)(81166007)(82310400002)(53546011)(4326008)(5660300002)(186003)(356005)(15650500001)(478600001)(336012)(82740400003)(54906003)(316002)(86362001)(2906002)(8936002)(47076004)(8676002)(81156014)(9686003)(6506007)(70206006)(7696005)(110136005)(55016002)(70586007); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 6373d1c1-0f56-434e-0843-08d7e808ecdd X-Forefront-PRVS: 03838E948C X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TisODyiKRpF5RgkaOlzM7+OOt3tItMrWXuENKco7CVF77UEUaoDpZ+1uAHEb3kEDdUxned8W8Cw0SgmbJamXLj5KHuw4l4d0+u0a3PX1ma9Kr//h5DBgtRf4VbHabikuQFwJJR9nrh8QrQemGb9V4j+zHq3BEzUPbtOovQARwcRAZN5ch95ckJAEeT0SKt18hdBgSwWAfUfXFZXkuNraVj2WsRDL6Dr+VRsIUNRlkMGNT2skQThfh788A6KLXKBo/EPT/+xcrwkt3vlLQ3vAlPfmWKkeq0cIMJK0Po+NE4vYhxMocEf8O1KN60WvPdF5lAPdVpJlutDMg1kYvuGckeYj4qQH7gy/Mb9AMCIWb6wDplxqrKwxIHoDzqfNrYUk5+lK28AA8bvSoSBvv4EfJvTi9p7PcuDzb9abCTAZ1csAsbucr3WOCYwAKPOpkMfj7a22ooLRsjRIkVftTL2jdZk07fxGaTJWR1npbxvOmvEvIekAkd+gBfsjprYeK2WCpmzs4lyMXXs228qy6F3Iiw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2020 04:35:39.1984 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6129efd-e48f-4c5a-cff4-08d7e808f0b5 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: AM5PR0801MB1761 Subject: Re: [dpdk-dev] [PATCH v2] ipsec: optimize with c11 atomic for sa outbound sqn update 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" > -----Original Message----- > From: Ananyev, Konstantin > Sent: Friday, April 24, 2020 2:11 AM > To: Phil Yang ; dev@dpdk.org > Cc: thomas@monjalon.net; Iremonger, Bernard > ; Medvedkin, Vladimir > ; Honnappa Nagarahalli > ; Gavin Hu ; > Ruifeng Wang ; nd > Subject: RE: [PATCH v2] ipsec: optimize with c11 atomic for sa outbound s= qn > update >=20 > > > > For SA outbound packets, rte_atomic64_add_return is used to generate > > SQN atomically. This introduced an unnecessary full barrier by calling > > the '__sync' builtin implemented rte_atomic_XX API on aarch64. This > > patch optimized it with c11 atomic and eliminated the expensive barrier > > for aarch64. > > > > Signed-off-by: Phil Yang > > Reviewed-by: Ruifeng Wang > > Reviewed-by: Gavin Hu > > --- > > v2: > > split from the "generic rte atomic APIs deprecate proposal" patchset. > > > > > > lib/librte_ipsec/ipsec_sqn.h | 3 ++- > > lib/librte_ipsec/meson.build | 5 +++++ > > lib/librte_ipsec/sa.h | 2 +- > > 3 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_ipsec/ipsec_sqn.h b/lib/librte_ipsec/ipsec_sqn.= h > > index 0c2f76a..e884af7 100644 > > --- a/lib/librte_ipsec/ipsec_sqn.h > > +++ b/lib/librte_ipsec/ipsec_sqn.h > > @@ -128,7 +128,8 @@ esn_outb_update_sqn(struct rte_ipsec_sa *sa, > uint32_t *num) > > > > n =3D *num; > > if (SQN_ATOMIC(sa)) > > - sqn =3D (uint64_t)rte_atomic64_add_return(&sa- > >sqn.outb.atom, n); > > + sqn =3D __atomic_add_fetch(&sa->sqn.outb.atom, n, > > + __ATOMIC_RELAXED); > > else { > > sqn =3D sa->sqn.outb.raw + n; > > sa->sqn.outb.raw =3D sqn; > > diff --git a/lib/librte_ipsec/meson.build b/lib/librte_ipsec/meson.buil= d > > index fc69970..9335f28 100644 > > --- a/lib/librte_ipsec/meson.build > > +++ b/lib/librte_ipsec/meson.build > > @@ -6,3 +6,8 @@ sources =3D files('esp_inb.c', 'esp_outb.c', 'sa.c', 's= es.c', > 'ipsec_sad.c') > > headers =3D files('rte_ipsec.h', 'rte_ipsec_group.h', 'rte_ipsec_sa.h'= , > 'rte_ipsec_sad.h') > > > > deps +=3D ['mbuf', 'net', 'cryptodev', 'security', 'hash'] > > + > > +# for clang 32-bit compiles we need libatomic for 64-bit atomic ops > > +if cc.get_id() =3D=3D 'clang' and dpdk_conf.get('RTE_ARCH_64') =3D=3D = false > > + ext_deps +=3D cc.find_library('atomic') > > +endif > > diff --git a/lib/librte_ipsec/sa.h b/lib/librte_ipsec/sa.h > > index d22451b..cab9a2e 100644 > > --- a/lib/librte_ipsec/sa.h > > +++ b/lib/librte_ipsec/sa.h > > @@ -120,7 +120,7 @@ struct rte_ipsec_sa { > > */ > > union { > > union { > > - rte_atomic64_t atom; > > + uint64_t atom; > > uint64_t raw; > > } outb; > > struct { >=20 > Seems you missed my comments for previous version, so I put here: >=20 > If we don't need rte_atomic64 here anymore, > then I think we can collapse the union to just: > uint64_t outb; My bad, I missed this comment. Updated in v3. Please review it. Thanks, Phil >=20 > Konstantin