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 EF4A2A0561; Sun, 19 Apr 2020 23:14:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7D441C2A9; Sun, 19 Apr 2020 23:14:39 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by dpdk.org (Postfix) with ESMTP id 918F31C25E for ; Sun, 19 Apr 2020 23:14:38 +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=5puJ/LGLWTqKfWD5rk3U4vCtkaIRvs+pmyIdBQtof/0=; b=3rvPhFT8uO+uf3Asxjsqvj2S83GP8cTb5XeAGIAwkL7BoygzUDcyw0L6RDbyMyHlhg1dke/JC1AHA7KXTO/ABCt5s5zKh0CONQHUQlwsBD1HjCpvBB1i/wB2Do2QMAmI8PTaM8PAdGsDAcn+hb79MbWC5mBvMBs5qxlgg2Y7EG8= Received: from AM6P191CA0048.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::25) by DB6PR08MB2808.eurprd08.prod.outlook.com (2603:10a6:6:1d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Sun, 19 Apr 2020 21:14:36 +0000 Received: from VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::cd) by AM6P191CA0048.outlook.office365.com (2603:10a6:209:7f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Sun, 19 Apr 2020 21:14:36 +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 VE1EUR03FT061.mail.protection.outlook.com (10.152.19.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.18 via Frontend Transport; Sun, 19 Apr 2020 21:14:35 +0000 Received: ("Tessian outbound 3a3e6dcbad0e:v53"); Sun, 19 Apr 2020 21:14:35 +0000 X-CR-MTA-TID: 64aa7808 Received: from 678b2754627f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2B14E39C-1DC1-41AE-B09F-CE7C2AD8A0E4.1; Sun, 19 Apr 2020 21:14:29 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 678b2754627f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sun, 19 Apr 2020 21:14:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DWrt2zWeoJb8nNlTeIenn9lPfchGBpqq0FNVvlSi+4Kr20LErNYv/3P+z9XeNAwm0pLJP3wX+0URKkhPlv1mkOSksqV8b0M3aGC/J10SNcf5auI6xVrdh5PTGGbY4eDNwBib1j9avHgLW2ncr2glD3lGuLvpSDug4Jl7TVmhrH+v3cGnQOi5pfJKX+e5p2RfkaH6AyLf10pycG2ZQmbKzB+dK7MHIrCd/nnkP51/x+CgXUR8uclG28PhzGFOQXlS1tXEVzmdoGb4ppSiixrv29zVUMfF7DUZIHca0gAOmHJpaZHq32IOWpLKMKAOifBV405LGLXx5937+v9lEtcnCg== 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=5puJ/LGLWTqKfWD5rk3U4vCtkaIRvs+pmyIdBQtof/0=; b=HK0CgQWaG+0KB0VmCWFTktaVoll8ek2Slc+mVPj5DNs9ftT9sOnSqq6qlo5rH6HXzIM7zPQWQ8cWs5nDqoi+f3WE1SzBArkfbJ9f0LsKdjbBUsmzBprUSRPT0iDjZPZ6INbw+IBHIq8tfMHg6QZ44XoPXANmopwUjA6m0oFZrFELAm4cRE4z2bvEkQ0vmedWD8ey1aU8IcTDcYE36Ju6dvUuYAfdjCL+9KbOu2J4D8YruF90nbHB51l4lw+lhz3GB7/loC8shYIMf5xTWCw5lr/w8WOxoC+r4q0VRJxLdkcZHRH27j3IvDwzN2TITMjimlun0pFqB+6LtOudaoYgbg== 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=5puJ/LGLWTqKfWD5rk3U4vCtkaIRvs+pmyIdBQtof/0=; b=3rvPhFT8uO+uf3Asxjsqvj2S83GP8cTb5XeAGIAwkL7BoygzUDcyw0L6RDbyMyHlhg1dke/JC1AHA7KXTO/ABCt5s5zKh0CONQHUQlwsBD1HjCpvBB1i/wB2Do2QMAmI8PTaM8PAdGsDAcn+hb79MbWC5mBvMBs5qxlgg2Y7EG8= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBPR08MB4711.eurprd08.prod.outlook.com (2603:10a6:10:d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Sun, 19 Apr 2020 21:14:27 +0000 Received: from DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d]) by DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d%5]) with mapi id 15.20.2921.027; Sun, 19 Apr 2020 21:14:27 +0000 From: Honnappa Nagarahalli To: "Ananyev, Konstantin" , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "jielong.zjl@antfin.com" , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v5 7/9] ring: introduce peek style API Thread-Index: AQHWFZ8HmxXr54d4HEOmuyexwRZkVqh/jNQAgAE50oCAAAsuAIAAEhTw Date: Sun, 19 Apr 2020 21:14:26 +0000 Message-ID: References: <20200417133639.14019-1-konstantin.ananyev@intel.com> <20200418163225.17635-1-konstantin.ananyev@intel.com> <20200418163225.17635-8-konstantin.ananyev@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1089fd12-652b-43d3-89ad-ba14e3bb98d3.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: 3dd760c8-7038-40c7-004a-08d7e4a6a97c x-ms-traffictypediagnostic: DBBPR08MB4711:|DBBPR08MB4711:|DB6PR08MB2808: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; x-forefront-prvs: 0378F1E47A X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB4646.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(366004)(396003)(376002)(39850400004)(136003)(6506007)(71200400001)(86362001)(2906002)(33656002)(186003)(4326008)(26005)(316002)(9686003)(5660300002)(66556008)(478600001)(76116006)(7696005)(66446008)(64756008)(66946007)(66476007)(55016002)(54906003)(81156014)(8936002)(8676002)(110136005)(52536014); 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: bLrihswO5cecPRuidkKYdFZD7Yi3hzH7IxrnSskrf3xm58ziurTNnkRvdGHZgKGzu1PopYxGAuD1ML/9HZeN7i4IOxW4UMcfe/B4oblllnhCFbqOeL9e643O9EcL0igtSVf+SqJZV1KpwS4G+1BDLnG3syhHu+WKLsrTm6QcM2L8qW62cCaWMw1fiUAayAOHM01h48qa9Ihm6engd4OMvoEbPQZtvxZiAD2sE6+I9dBy0MoqTjG8/HmN9HHIq/ugVg7N8vps0lrnQBnfMd+izpjwx5PPQ80QV/amWIKK27y9bxGqzpmvwejpWc/DAGGtAIKxLfPryfe73brRJ5tndWUQ9XilFGXf7xdmDkSgiV6NM88BNChE87duYhf8bZ5um2SDRc65PP+DKFw3sZQb545XPQI7IiftPPuPYmtqnIECmlPbFRkd3evftKXe2mf4 x-ms-exchange-antispam-messagedata: zo67WFBeg04SJvk3nKOuneHWzuPuGnwUEVstaEGi3qh4u4ONJ7NS3qBAP1k3QNgl6vQWvy7OvXMSOYxN/Ng8zOoMUO4RoF3au1pan+UdQtxtFmRZ0RPqOFQd6U1RiFIInNvgB2Ahd7eZJiJMcNcNMA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4711 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT061.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:(10009020)(4636009)(396003)(39850400004)(376002)(346002)(136003)(46966005)(8936002)(5660300002)(8676002)(70586007)(70206006)(52536014)(478600001)(81156014)(33656002)(55016002)(2906002)(4326008)(7696005)(26005)(36906005)(82740400003)(47076004)(9686003)(86362001)(356005)(336012)(186003)(110136005)(81166007)(6506007)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a28a8940-d55c-497b-6591-08d7e4a6a4ae X-Forefront-PRVS: 0378F1E47A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4se9QNu42AwlHYee9fWrjR/AdYbpIXtK4yhPSMFH6TSJzkardVFMm+jKxzXSabWZE5p1ssEpswlZcXL9+zQ9xRO6ILEPt7CaY3FbSmBDmJaiseaZM9J06desKhdtWAt8KKuT0AoNerMJM1fRO8AF3BP1oRxHqdDiD6OWqRmCW5nJCoIL1R0PRq+FRjlbx9L4TdCkMp24QgyOwTz71y0Cs81RyfpYlR/CqNQaJiQJXc/CjrRyCyA8Hc/WUMDRp9QCHML1CFBVx8D0Ew63tTP/jF6wr5bD8QiyxlFZ32LZ0KuSbSAazMuox8SPqXFWOlqh9//VeQ+Yo7JojdtKgsh8HZMb8oUbbhYSGC8Cj6efkQHFNKtfswGLVIvTKERcqTaLGGOotHkcp3t56AS2rIZ3q0w16vb93IHczwuz9Li1PGJdYpdA0f11JjPbvuJf/6AHwtvTli3KKbH4V2eSkUtOaGtUk0YutguTrA1pee2A4hYAYI5l5tEUwQQhcsoQtcCM/pSvNPE2PEPvOlZLQR9q8A== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2020 21:14:35.4333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dd760c8-7038-40c7-004a-08d7e4a6a97c 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: DB6PR08MB2808 Subject: Re: [dpdk-dev] [PATCH v5 7/9] ring: introduce peek style API 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 >=20 > > > > > > diff --git a/lib/librte_ring/rte_ring_generic.h > > > > b/lib/librte_ring/rte_ring_generic.h > > > > index 953cdbbd5..9f5fdf13b 100644 > > > > --- a/lib/librte_ring/rte_ring_generic.h > > > > +++ b/lib/librte_ring/rte_ring_generic.h > > > Changes in this file are not required as we agreed to implement only = C11 > for new features. > > > > Right, will remove. >=20 > Actually no, spoke too early before thinking properly We do need these > functions in rte_ring_generic.h for SP/SC _start_/_finish_. > Konstantin The peek APIs are new functionality. So the peek APIs in legacy format shou= ld be wrappers around _elem_ APIs. That is what I see in the code as well: rte_ring_peek.h has this: static __rte_always_inline void rte_ring_dequeue_finish(struct rte_ring *r, unsigned int n) { rte_ring_dequeue_elem_finish(r, n); } I think, I gave you incomplete feedback earlier. Actually, __rte_ring_st_get_tail and __rte_ring_st_set_head_tail should be = in a new file named rte_ring_peek_c11_mem.h. This file should be included i= n rte_ring_peek.h (same way you have done for RTS and HTS). Then remove bot= h these functions from rte_ring_generic.h and rte_ring_c11_mem.h. >=20 > > > > > > > > > @@ -10,6 +10,54 @@ > > > > #ifndef _RTE_RING_GENERIC_H_ > > > > #define _RTE_RING_GENERIC_H_ > > > > > > > > +/** > > > > + * @internal get current tail value. > > > > + * This function should be used only for single thread > producer/consumer. > > > > + * Check that user didn't request to move tail above the head. > > > > + * In that situation: > > > > + * - return zero, that will cause abort any pending changes and > > > > + * return head to its previous position. > > > > + * - throw an assert in debug mode. > > > > + */ > > > > +static __rte_always_inline uint32_t __rte_ring_st_get_tail(struct > > > > +rte_ring_headtail *ht, uint32_t *tail, > > > > + uint32_t num) > > > > +{ > > > > + uint32_t h, n, t; > > > > + > > > > + h =3D ht->head; > > > > + t =3D ht->tail; > > > > + n =3D h - t; > > > > + > > > > + RTE_ASSERT(n >=3D num); > > > > + num =3D (n >=3D num) ? num : 0; > > > > + > > > > + *tail =3D h; > > > > + return num; > > > > +} > > > > + > > > > +/** > > > > + * @internal set new values for head and tail. > > > > + * This function should be used only for single thread > producer/consumer. > > > > + * Should be used only in conjunction with __rte_ring_st_get_tail. > > > > + */ > > > > +static __rte_always_inline void > > > > +__rte_ring_st_set_head_tail(struct rte_ring_headtail *ht, uint32_t= tail, > > > > + uint32_t num, uint32_t enqueue) > > > > +{ > > > > + uint32_t pos; > > > > + > > > > + pos =3D tail + num; > > > > + > > > > + if (enqueue) > > > > + rte_smp_wmb(); > > > > + else > > > > + rte_smp_rmb(); > > > > + > > > > + ht->head =3D pos; > > > > + ht->tail =3D pos; > > > > +} > > > > + > > > > static __rte_always_inline void > > > > update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32= _t > new_val, > > > > uint32_t single, uint32_t enqueue) diff --git > > > > a/lib/librte_ring/rte_ring_peek.h > > > > b/lib/librte_ring/rte_ring_peek.h new file mode 100644 index > > > > 000000000..2d06888b6 > > > > --- /dev/null