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 3ED95A00C2; Thu, 23 Apr 2020 20:10:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB7481C07D; Thu, 23 Apr 2020 20:10:55 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 7CBA91C02D for ; Thu, 23 Apr 2020 20:10:54 +0200 (CEST) IronPort-SDR: OAdFex/BTd9p+kD3Zw6f6EmH2UwfL00/jjGPYGWPAKZDc8yR6X3TJ56CejUhbCPf9gySuonal0 Nb6fYhiRHBPg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 11:10:52 -0700 IronPort-SDR: ASlvFTu0WVZ4cB3bvFADT6MTHsVKocDGIR/1FAqVPNy3VJBCQ+/F60/2OFllzcF0nxGLR3BDMS NCnHQv1J3lwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,307,1583222400"; d="scan'208";a="291265257" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga002.fm.intel.com with ESMTP; 23 Apr 2020 11:10:51 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Apr 2020 11:10:51 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Apr 2020 11:10:51 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Apr 2020 11:10:51 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.55) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Apr 2020 11:10:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VS/JOLaWR4G7/iCAoUYkV1TuQminUIX74M5gMaEI4B6oxzJk+neJW+uM6EzHAHtNvlm7iUE/3muteJRtoWEjlqBw7DwNUDSHt5Ha/qOX23vX799jbj6dhsRvsXZAUxNLMXgLS/KgtI+HS4jKBIon5ixyiWrYUq6YrKNhjHqklQR8pPg/9aBYTY2jrMHP9VCCV4m7jU0GaYbUc/zXHtIPUohYQPI6sRapCCS5bgKJ0US+nsDMGNHFr70AQhVwUn7x6i9fyYEVpsNVD8MDZCSHu775FvylQYzPwoJdASmoG7syd9mYm6ErA6mLtb+Sy33B7glx1TzsubdeTmgHb14LWA== 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=SuBdXtKrnSOd0dLCMHO8vajIgNRjn0QLfvKCB8EDIkU=; b=Gl99nZtUh15g2jysm+6ydmjlOXK9L48byhCZOerpf69r6pm9y48mMjRQG1q6HhvrA9O93LH18Z66OLgGOlSSv622CpNm7vnVPFJvcbAMwPr+DETVVxMgps9002fZwRg5iodTtf1TDXf6oE20/VZjCRNozJBDL69tccWE+oyCn9B+m3b5oXrJukdLKfTyfCkx+9yjbJdUUWq03X2/SdcE7Hz5Gfpv8qDeVVDY3ekyXa0znOnpLzAU6Kjf07nvFssKSHydmPZGn4/c7WDjrdZSRfNJpl/J3hBkaVl+QZm3Xm+y8n4wAFwQFg+uVjKtysGtJdL0zA6cP6zbi7jSTAi3kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SuBdXtKrnSOd0dLCMHO8vajIgNRjn0QLfvKCB8EDIkU=; b=UX+aOGttGuaFPv9eTEeRngD8CLySX+yzZc9af9Dk/i7/kbVwSZ5NSeOIYk/wH87KwNOR4mnmhnZm0F+iYz3sN+llaRsuUTLEvwsrWpUnBcvW3hweIRQWdpTfVAXm2/9oMk+ENspbZSVBGqHIcBw3SYvg9msER7eW4OBDHH+XBpQ= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2808.namprd11.prod.outlook.com (2603:10b6:a02:c8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Thu, 23 Apr 2020 18:10:45 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4%6]) with mapi id 15.20.2937.020; Thu, 23 Apr 2020 18:10:45 +0000 From: "Ananyev, Konstantin" To: Phil Yang , "dev@dpdk.org" CC: "thomas@monjalon.net" , "Iremonger, Bernard" , "Medvedkin, Vladimir" , "Honnappa.Nagarahalli@arm.com" , "gavin.hu@arm.com" , "ruifeng.wang@arm.com" , "nd@arm.com" Thread-Topic: [PATCH v2] ipsec: optimize with c11 atomic for sa outbound sqn update Thread-Index: AQHWGZMhoqUG+RO5R0iozjJ2SQkYNqiHAFNg Date: Thu, 23 Apr 2020 18:10:45 +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: <1587662187-28193-1-git-send-email-phil.yang@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.169] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d5c36200-bd60-4684-5576-08d7e7b1a4ff x-ms-traffictypediagnostic: BYAPR11MB2808: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 03827AF76E x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(136003)(346002)(366004)(376002)(396003)(39860400002)(66476007)(66556008)(5660300002)(55016002)(316002)(54906003)(110136005)(4326008)(2906002)(66446008)(15650500001)(66946007)(76116006)(26005)(7696005)(71200400001)(86362001)(9686003)(64756008)(6506007)(186003)(8676002)(8936002)(478600001)(81156014)(33656002)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fuQJ0PwPttZOiZL1MdNjyvSO454WDd5apWCp+moh9zs+fHggQ48I429DIofADx9ZtVnCHJYkdNoMmxIcSz+umnqb4FjEzzEThJqlx5TIGTZvOmp2TIYTSRIZJkm7uDsaD5WuNhi3CIMdpf/Kelier52qfh4NIyIjCv+okAxlsGc3FDmiMdPZiU24eiXuOML5tQZfgIOJdu0fXpCK8h5poOl3/bRYA69mA5bJ2EyLk91/8GM/pOD+98k8F6eoZxRQWM58rwoVcUkznfx+i+KjMLO2IXQcQmYZn7jY0FCIsau+wwNwNAiQ0VIrTrBd15geEVBPb7RfL2XTpfnZ0K4LePjQ35nu6wnSz5bZ/mfFMwh5STNgV1kneN4oH8cY1sAN0L0T03HU5RW02xGfulcJ86bLUhB7v0kyVYnqHY9QpsFEMKP5Fk4PEHX+0JVjseBp x-ms-exchange-antispam-messagedata: NBksPrOZNEA+1wclqNjC3EgMtABn0YP6FDr5cOOSx7JEvCjCBzTH23rJ6bBBg1ZPEvRHjyMdv3QhRtbYUWCrVTPucUrD+5Ct3RhcEO4c/J5lns5mlq0Cr3ozKEcuEwnbJZAKSJ5XDhoNZPmxM1XfaA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d5c36200-bd60-4684-5576-08d7e7b1a4ff X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2020 18:10:45.6041 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: agTdMoZpiI2LdUihX0fOtPuedGGxifxp28ZrjOcpD5V/08cvIa2KzekNI+23Vwod3nwiiGsolSjQbrcYArp+96B5fwQgPg/nkCVIbn7EdIY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2808 X-OriginatorOrg: intel.com 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" >=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. >=20 > Signed-off-by: Phil Yang > Reviewed-by: Ruifeng Wang > Reviewed-by: Gavin Hu > --- > v2: > split from the "generic rte atomic APIs deprecate proposal" patchset. >=20 >=20 > 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(-) >=20 > 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) >=20 > 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.build > 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', 'ses= .c', 'ipsec_sad.c') > headers =3D files('rte_ipsec.h', 'rte_ipsec_group.h', 'rte_ipsec_sa.h', = 'rte_ipsec_sad.h') >=20 > 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 fa= lse > + 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 { Seems you missed my comments for previous version, so I put here: If we don't need rte_atomic64 here anymore, then I think we can collapse the union to just: uint64_t outb; Konstantin