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 C5793A0561; Sun, 19 Apr 2020 21:13:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6CE71C221; Sun, 19 Apr 2020 21:13:04 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 8D7141C21E for ; Sun, 19 Apr 2020 21:13:02 +0200 (CEST) IronPort-SDR: lBwA0u6RuiFnKqv5E4G05cFe2GqzAEaG6MSZFs7FtHj1SABPjBtDV78sYK3UFo7sHP56QhZwco Gdaf5G1+2xwQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2020 12:13:00 -0700 IronPort-SDR: fBuSi/u+tSHHrL8RwukhHYW+z8Z/qBKoaVe5Yxa0mNNrQI5odlCUfXbezD8O/hVztngmQErTzi ymBaDILJ+RiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,404,1580803200"; d="scan'208";a="254737230" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 19 Apr 2020 12:13:00 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Apr 2020 12:13:00 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.58) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Apr 2020 12:13:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ky7WJUUe/LXsR1kyQdFZc9damvripuj3Zi8o9HEY/S/jmwfwSkhXrrq+ArhxbiZlezcauY7HeVikJwITzU6Z+hH9MmDkA6t3FlFFlmwqgvS0jTlq7CaWhmQ5XsFVPCWURY2gCT289Tmjt0t34RvDmPGO4/XHMxwqpV+MVu8UvFF/ejzqIZ7dqcW5V5gbVUv+IRt0rNiE1kmlDlAL1SkbW6Hc538okh7BJVVImPxSF5dgD47GhI6Nkted0C6uY6X2fzylFJRI0IvJ215eMJGAhw52+k0BueWbz6PYgvOXXLOIkdAO08nNphIzRKHrIQ46rFQeNXZ0A73hFnz06DK4BQ== 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=xIxBLlCl/q9TMfJk8Yjk5jMdpznc8LFJJtbc2OBEFK4=; b=YknGSHvyTlTstwHSifuIuHSSrTQpZi7IaCFDfQ4OFXQcm8M+kb+MTDRoHxTCc3b42kvqbl5psaC++8EihFR/rw0jWYv4fP/OWUVUkzGJE6ShZvjtQxo0dTLIVDLWBDf070FtKlD3ocy1CUKN5BWxNC/Ek9x2cF/l6Ao2mMq9WEGNe6h3zW3zJ+D0OB/pUMj80DexJPZB8IPXQwCTqMblzehHNPx8u5ZHltQHeIUoIViLNUH9z1F6d1KbYqbr9E+cce8FVUHX3At9Q8hxDC6gn9nDqMeSoNhcWHmSrUOQ/WOHIqzDSdDINBbLYLwx80taOGt3wnY5u3gtgKfY8cbfTw== 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=xIxBLlCl/q9TMfJk8Yjk5jMdpznc8LFJJtbc2OBEFK4=; b=BsFosyC5W+naAE50ALH1jZC5K2wjn8mEkoej5OmnTzDDlHyb3NkNMhSkLoRIsyTN+ub/mjMNtj9B7M6zFt/6jsXBDzl5jnTE2lEPVxJFCBo9VY1EsjBoHoKXf240QhVRvIoQu15BdQV6Fms0U3OdYA40Ad18F6hDpv8S1nAABTA= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) 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 19:12:59 +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.2921.027; Sun, 19 Apr 2020 19:12:59 +0000 From: "Ananyev, Konstantin" To: "Ananyev, Konstantin" , Honnappa Nagarahalli , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "jielong.zjl@antfin.com" , nd Thread-Topic: [PATCH v5 7/9] ring: introduce peek style API Thread-Index: AQHWFZ8RvvbCVWB3qU658ll+ytGiJqh/uiOAgAEMLjCAAAsFYA== Date: Sun, 19 Apr 2020 19:12:58 +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-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.164] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 713c8b35-9125-476c-f9e5-08d7e495ac83 x-ms-traffictypediagnostic: BYAPR11MB3799: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0378F1E47A 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)(39860400002)(346002)(366004)(396003)(136003)(376002)(4326008)(9686003)(52536014)(26005)(66446008)(55016002)(186003)(478600001)(76116006)(66946007)(66476007)(66556008)(64756008)(86362001)(7696005)(110136005)(54906003)(81156014)(71200400001)(8676002)(2940100002)(8936002)(5660300002)(316002)(6506007)(2906002)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RTEZZDtOftOkQ0EORYmPhl2n6UYDy5YWnxRkapHv7BhwabyxuZ2iiGUMbqYm0qOWPJ20uCmacgq3iDvlsjO0sXRgsb8rmSF+GBtNIYyUHgFwMovXSJsFiqeQsuJWW05uOK5cNFjuTxKwn0c024f7RtBOluchjwL2QB4pN1pxyOoTqOV79XL+6rfXV+IyqlZfBDd6dRcPi3ELPwPetc+zHSitadnoAA0a5Dce3R6tt3cUAuILhJMLFSK8MvFq3gpQ6f4ds2gbDDNapQhh5QLdhRNqxI/xHkj6D2kl69+188HKIGA1QrtkI2yl1RVoj6H5cT7YtIYpG7HjhmgEmKjcEP4TAQ14bZznAMSIVHFcLSk4D+Ah6omUKRXhwYN+bpfPBa1z1p/ApzneH/BD6Ir6zcJiWzJ4UDV3Jkw23ZTpiAdoExrzEGQEa7eVIdJ1n8dW x-ms-exchange-antispam-messagedata: hTWC6AS8OOOQ4AMIk7yNtvy9nhc9vtQALuD31Y+j3v6lq76CXjAEvLGYRGXN5R98LZlHu0mX7fMCv8MWrEkkm1kMoKMlN5VZdyXmk60aUn/AWuPefgKal/zK+LrT/SxXxd0s1dKqtuMlwIu3taOnXA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 713c8b35-9125-476c-f9e5-08d7e495ac83 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2020 19:12:58.8087 (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: PTI75DL+QmDE2D/J4A6IPsp7zSEFL0TVyMZKpjQF7jH1I1EQ/G6DwgNctwiinfnau8C+0HalkvApvo/jNE+vxNmfLyFnZ3iC2bQ7EAFEHIU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3799 X-OriginatorOrg: intel.com 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 > > > 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 C1= 1 for new features. >=20 > Right, will remove. Actually no, spoke too early before thinking properly We do need these functions in rte_ring_generic.h for SP/SC _start_/_finish_= . Konstantin >=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/cons= umer. > > > + * 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/cons= umer. > > > + * 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 t= ail, > > > + 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_ri= ng_peek.h > > > new file mode 100644 index 000000000..2d06888b6 > > > --- /dev/null