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 25259A057B; Mon, 23 Mar 2020 20:08:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C5961C08E; Mon, 23 Mar 2020 20:08:01 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150075.outbound.protection.outlook.com [40.107.15.75]) by dpdk.org (Postfix) with ESMTP id A68811C02E for ; Mon, 23 Mar 2020 20:08:00 +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=Tr3YzrxSOGeHazK66RYg94mEEFisP0zdOO8oxcsqHYw=; b=tXGATR3CkCwmHCw2z+JXRoKD7un0rUt9sxGGjAtlWjhMaO/3esby7zhB6VDMzzryZCc21lNZxbTtYASSYrjwVVz69AZZwCR0y+b4iymAMOjBgRsbE7cupVlr4i1Ra2o0t5W18nvjtzJZ16bpOQnK29qhfse8qyEToiyWURS+obk= Received: from VI1PR08CA0097.eurprd08.prod.outlook.com (2603:10a6:800:d3::23) by AM4PR08MB2884.eurprd08.prod.outlook.com (2603:10a6:205:e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Mon, 23 Mar 2020 19:07:58 +0000 Received: from VE1EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:800:d3:cafe::6f) by VI1PR08CA0097.outlook.office365.com (2603:10a6:800:d3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Mon, 23 Mar 2020 19:07:58 +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 VE1EUR03FT023.mail.protection.outlook.com (10.152.18.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13 via Frontend Transport; Mon, 23 Mar 2020 19:07:58 +0000 Received: ("Tessian outbound f88013e987c7:v48"); Mon, 23 Mar 2020 19:07:58 +0000 X-CR-MTA-TID: 64aa7808 Received: from e408a1a9ae00.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E684232C-2A96-40C3-8DAF-1DCDD33A1E3F.1; Mon, 23 Mar 2020 19:07:53 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e408a1a9ae00.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 23 Mar 2020 19:07:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BLN6bifDZyuiS4RBRz54qTfmhY5/KhPisgDAYNNyw7IP09uneCRMOBlyVJ2uTwN8xJ0i6Ce+A7aH9bKh0Yo5rQHP26BYSLPZkoqOVvdo4CxiThRSDBKKrTwTbaEWJH6DVvMnQUMwEFmDektI8BTpLV4YCG9uzrKj9jl+ZorvIwxffw/RxMmGrIg+XGByNeRLLI7Juohpp4fp93UPmfo1vZTbEZY7tDfdxQ3klryQSCAEiHz+5B19m8OSFNpJuhT3s1N9MYYwRmmoV7P9zf0vt+Otnr/JGFwc2U7hc42sXijBSFsGLm1EEs+Itb1PIGSLK1Mxoy6hiIVEh3f28hHHlQ== 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=Tr3YzrxSOGeHazK66RYg94mEEFisP0zdOO8oxcsqHYw=; b=MTUOOaHgLsMCv6ePr7DIlpAcHB74FMQ1W6eIgHA+fagJlVxQYNW61rqG5MNMwt3FsDGleB/k7UhcjFCQrU82TR/qp4jt7dF6Kql7zYS2XqAv4MFFva5rC/8LvAFmfBc7cw0w8cwCP1Sjz4UJYF+wWYB1TxXMFaj/LtXcYNqIwxMrNWT8zXRknWvlz7IMpMkxNevz8BEWIeMcPxSvDkFq6YxzlbEAuXTywNjvROxFARVECmupxFF3AARdpRFIRsDKC+/U50xz/unq3LbuzpkWwQ+PMZ41JfjQ5/Abm5pdR8HS6w/b1SmDR/bwXmlRf1TvePmEQH/CUCGkTDrjpFjZdA== 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=Tr3YzrxSOGeHazK66RYg94mEEFisP0zdOO8oxcsqHYw=; b=tXGATR3CkCwmHCw2z+JXRoKD7un0rUt9sxGGjAtlWjhMaO/3esby7zhB6VDMzzryZCc21lNZxbTtYASSYrjwVVz69AZZwCR0y+b4iymAMOjBgRsbE7cupVlr4i1Ra2o0t5W18nvjtzJZ16bpOQnK29qhfse8qyEToiyWURS+obk= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB4944.eurprd08.prod.outlook.com (10.255.159.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Mon, 23 Mar 2020 19:07:50 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::2573:103b:ed96:90bd]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::2573:103b:ed96:90bd%6]) with mapi id 15.20.2835.021; Mon, 23 Mar 2020 19:07:50 +0000 From: Honnappa Nagarahalli To: "Ananyev, Konstantin" , Phil Yang , "thomas@monjalon.net" , "Van Haaren, Harry" , "stephen@networkplumber.org" , "maxime.coquelin@redhat.com" , "dev@dpdk.org" , "Richardson, Bruce" CC: "david.marchand@redhat.com" , "jerinj@marvell.com" , "hemant.agrawal@nxp.com" , Gavin Hu , Ruifeng Wang , Joyce Kong , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3 06/12] ipsec: optimize with c11 atomic for sa outbound sqn update Thread-Index: AQHWAUOue6jXFGs70EiwlKEAhkoL0qhWiT7w Date: Mon, 23 Mar 2020 19:07:50 +0000 Message-ID: References: <1583999071-22872-1-git-send-email-phil.yang@arm.com> <1584407863-774-1-git-send-email-phil.yang@arm.com> <1584407863-774-7-git-send-email-phil.yang@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 58ce701a-3403-4d79-a2ae-f49202e29c1d.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [70.113.25.165] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 129afb05-31f9-465c-c56b-08d7cf5d8041 x-ms-traffictypediagnostic: VE1PR08MB4944:|VE1PR08MB4944:|AM4PR08MB2884: 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:9508;OLM:9508; x-forefront-prvs: 0351D213B3 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(346002)(39860400002)(376002)(396003)(136003)(199004)(76116006)(66946007)(66446008)(64756008)(66556008)(66476007)(8676002)(81166006)(81156014)(4326008)(7696005)(2906002)(52536014)(316002)(6506007)(26005)(478600001)(5660300002)(15650500001)(186003)(9686003)(8936002)(86362001)(54906003)(33656002)(110136005)(55016002)(71200400001)(7416002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4944; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; 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: g4BEYdo12KdAHI41pwfvUwZEYL29G7WPCRJ3LP9vZAQKmjWQH2IKFjAtM8pGCvRY6c8474PCJJcfptB+LZs8qmCkXDyb6IhJLJbEaXShdHwdu/WF9n99+8Yd1NEWlBOM1Cd+J/TnxEYqOsvhAX6g+56AdyIVkd6KlH6WTJoVh1e0djCPEm8DIZ0UJ6r2bmGeMj3NaM5YZ4gmH62RUAYniJzslwIr3BbqzNQN9q758c92zsk65ip0rXiZ2G/sDX9Yz2zJM7GVF74mtVq/XaU45k32LOlJG76wy+y2KbTD3S1CCP9rjxC1KLL/Qlx7kR0mYXqvzKleyuhuheJAQBmNosba3GFMfV+8RcGVo2o6YVLpnKd4+Ge3m5PDBr3/MsRntRCdxvybvbJ/Zn+byphvEJTc+h42mawMZLWrpO8TEBSwyaqBLrH2HiDZHt2fMp3nwbcsnjmmvEAjmDgHGDP7gJHVLD1+22OavMfoG9ChEB+oQYUMsqQ4kAqNXXyfDFOU x-ms-exchange-antispam-messagedata: rL6SG3m5AUYHuFFLHaefjWk4gUgkD2uPDVvlxhvEGKZhw8RlK+NJPnhh3hIHccvKcFHLY+pK/XHaHEuUgjJwEiCRqsYZYYemzvj2nECFIYKuAhd1wcOlg68LczYA2XiHgVfdYXXkfv8bVVCcb0aiLw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4944 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT023.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)(39860400002)(376002)(396003)(346002)(136003)(199004)(46966005)(2906002)(4326008)(186003)(70206006)(81156014)(15650500001)(336012)(81166006)(478600001)(26005)(26826003)(33656002)(36906005)(5660300002)(316002)(70586007)(6506007)(55016002)(9686003)(47076004)(8676002)(86362001)(54906003)(110136005)(8936002)(52536014)(7696005)(356004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB2884; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 110c47d2-470b-4d93-7c3a-08d7cf5d7b49 X-Forefront-PRVS: 0351D213B3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TO1TiiSiQMgzttVdgmPJjMKfo/8lZkcYRn1/lGWrBwMpotvr/ZzOH6ifikzCgPiWd/Tk6ysvIB5b/eVvCkXj0nSzH/mma6UzFvWLIlrwBvAutpjNZYqPdZa3zX+zB4p9HhHkuYjYvuK+m1XcladubJ4qsoPfCGNweLGYdMbr9H7OpITsbrr/HhHeLw6shPkbsAHOW+cMQVLNiGLAEl85CyRASr8NV5Q6j4A0QB2MooUqHdloevta0wEqM9PSFoCgbScGekytoJemVGnZsmkmTusL0RocUcwetKDP0+H98XvOUM7uBSiduy8m2TDMb+0BhNaJadA7jXMbisCT60Sec2gKSrzuRVY9g1KXhDu9eGIw02hBqxt+obLQ0njUiXXIoYw6eKpaPMJzPoSSPtPCt6feQlUM0kg4C7PSyYyNM+7eycvWbn3QqNumd708MXoowBlOuFKov5LpxesuvyYf2x9h7ySD8u1Z6N266qicqA0R46EF3XalWZQh3eFSbZqotjm1r+ZCWjUSMEdHIknyzap4SLXerIRHZUQmjdkdeFRVg75ovBXrhPIMv8z12N8B X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2020 19:07:58.5745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 129afb05-31f9-465c-c56b-08d7cf5d8041 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: AM4PR08MB2884 Subject: Re: [dpdk-dev] [PATCH v3 06/12] 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" > Subject: RE: [PATCH v3 06/12] ipsec: optimize with c11 atomic for sa outb= ound > sqn update >=20 > Hi Phil, >=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 > > --- > > lib/librte_ipsec/ipsec_sqn.h | 3 ++- > > lib/librte_ipsec/sa.h | 2 +- > > 2 files changed, 3 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); >=20 > One generic thing to note: > clang for i686 in some cases will generate a proper function call for 64-= bit > __atomic builtins (gcc seems to always generate cmpxchng8b for such cases= ). > Does anyone consider it as a potential problem? > It probably not a big deal, but would like to know broader opinion. I had looked at this some time back for GCC. The function call is generated= only if the underlying platform does not support the atomic instructions f= or the operand size. Otherwise, gcc generates the instructions directly. I would think the behavior would be the same for clang. >=20 > > else { > > sqn =3D sa->sqn.outb.raw + n; > > sa->sqn.outb.raw =3D sqn; > > 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; >=20 > If we don't need rte_atomic64 here anymore, then I think we can collapse = the > union to just: > uint64_t outb; >=20 > > struct { > > -- > > 2.7.4