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 95AEFA0540; Mon, 13 Jul 2020 18:29:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CB6241D61D; Mon, 13 Jul 2020 18:29:43 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B301D1D618 for ; Mon, 13 Jul 2020 18:29:41 +0200 (CEST) IronPort-SDR: iCxXBd/Murh1L5b9hBPLGqHCMvmFBjm9aoCBuSj8LJPESZMn+6m1itDIM5mUSAxya8WXXX+bex WI/91RY9lIzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="150106609" X-IronPort-AV: E=Sophos;i="5.75,348,1589266800"; d="scan'208";a="150106609" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 09:29:39 -0700 IronPort-SDR: yis8Ge3MGHENyP0bxp/u5p9eRejL3Ou5dFw4ubczFAHACi9hT+IKziDDA8PSigZIyBaY9aLWOX RxitUnZtIn4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,348,1589266800"; d="scan'208";a="285454270" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga006.jf.intel.com with ESMTP; 13 Jul 2020 09:29:39 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 13 Jul 2020 09:29:38 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 13 Jul 2020 09:29:38 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.174) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jul 2020 09:29:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DQlk3uUFuQGy4qlCLzTjkJBGJK/e5afYN5rD0mJW5kysa+MQQhwVjMKwqA3130T7Yjk0HKsCtVelnbj72MZpdwK5h2SLmcsmDLJoLZCntpVpkAyMix0077Vv2f0O+dv3Jb2QyDkW1SAKdtRzgEf7BjNCDC5Us7JpyhsIBNGldwHWEZ8ahRvpfe/WyRr7pj8YUE8NKU7wtxqi0ahV6NKRSc4cQM3vKuo43MIYOXL59YfXQc6DAm4NYv5mV8lMdiM3FiRrvTz1C3UJs3JGu92jaIVRwcbOs4P3EY1+yOvJPmajki/vqp0JIvfsopepRhkdUiUgEwThyOkqvahngUz6ew== 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=ptd9ShAkw4/AtJJFmWhZNLCFPOwkRzZY4FQyeiRjFII=; b=Jkh5Y4gE2KY3KFlvHD9UH1P2hLZ2GPgjUxVLMY7SH275GSKCl2pWpKJEuO+fB7/wHmMjJ3OTIbK8tFQoPZK2YUexQrFcUHAyJgBtcOEmqnC1/tl7vTsul9XCt5wFKAnSZluVXNmKA0WryRMeJvWGbIaq3YDQmsifOyyeGb+TMvJRSmSITe9p7jf/KQQQRYTBuW1/QJf0ZpacMZ84hKm654Ip+iu1SE1EFb0OZaO78oR83oJtlkEC1VGVTsS81oxcg7Nv6e1qoTYAVn2tVDC01ccI9BZ97hqwzlQZCgL3xL4fw6/9HU7xHefFWghxNazmj4Hw/fTSbCnSt5G4JuUzaA== 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=ptd9ShAkw4/AtJJFmWhZNLCFPOwkRzZY4FQyeiRjFII=; b=cvEL7doFQOWYhoQLYgzLGOxwHp6F+YdP/xvUwsOnnRGe2qj/ZnmZEn5bAje+SsMo6hvDShyu9zg4GWi1u7zkR/iCJ8cmfqvOH8jyRPzTmyGkuH74un2xCRRPJSDhcmopvmuOleTbgyOHhTpL0uvkILlOLaPPkrZheysNq7K9qyg= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB3720.namprd11.prod.outlook.com (2603:10b6:a03:fc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.23; Mon, 13 Jul 2020 16:29:32 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f160:29ab:b8f9:4189]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f160:29ab:b8f9:4189%6]) with mapi id 15.20.3174.025; Mon, 13 Jul 2020 16:29:32 +0000 From: "Ananyev, Konstantin" To: Olivier Matz CC: "dev@dpdk.org" , "arybchenko@solarflare.com" , "jielong.zjl@antfin.com" , "Eads, Gage" Thread-Topic: [PATCH v2] mempool/ring: add support for new ring sync modes Thread-Index: AQHWTi/h8GtyGouqIUabQ46ZzlWz+aj/fMmAgAAHuBCAAVEngIAAJyIggAABBlCABJl6AIAACghggAAPF4CAABcf0A== Date: Mon, 13 Jul 2020 16:29:32 +0000 Message-ID: References: <20200521132027.28219-1-konstantin.ananyev@intel.com> <20200629161024.29059-1-konstantin.ananyev@intel.com> <20200709161829.GV5869@platinum> <20200710125249.GZ5869@platinum> <20200713133054.GN5869@platinum> <20200713150049.GR5869@platinum> In-Reply-To: <20200713150049.GR5869@platinum> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTA3MGZhMTctOThiZS00ZjQ4LWI4YzYtZWE3ZmVjMTI0MDZmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMWxzOUduc215SGZHOXV4ZWVmamZjNERwVHY4QXIyaEY4dVc4OXJTZyttVlVqVVMwVDVRcVwvTlo2c2EyWjM4dEoifQ== dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.38.224] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1ea4add1-7635-46d6-905b-08d82749ec96 x-ms-traffictypediagnostic: BYAPR11MB3720: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: puKwkzF2namkVF6F11kqlw5XudN+WwApVCUOhsYzYHVWcfiBn8XEABnLVoCnADJyDJnUaCntZdPOIksKIRqhkOZFhaXmkoFDJR0UV8Gs1eYrmOF+zpPMVFO+unfhaTiItcvVA249X0Nj247DUhneVWyhkEYangXHGPUzHjdps3EbNPyVK0qxpI58Y5XC70OGHi9vKdFwbtIw7LctLNMAb3oBJQTIoCx/NcO5ko/jtYCIks9gKm0UDGKdPivfWgxwk9Ryvcpu4Nz3RBo8TLHEyAE3kw08dcd38EV7swlnujDsM3SndpQan0rjfNcQAnRl5FlUrArXBWW4f6xFyHn79g== 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:(4636009)(396003)(136003)(346002)(39860400002)(376002)(366004)(4326008)(83380400001)(8936002)(107886003)(5660300002)(30864003)(33656002)(6916009)(9686003)(52536014)(55016002)(86362001)(186003)(8676002)(2906002)(7696005)(54906003)(26005)(66946007)(76116006)(64756008)(66556008)(66446008)(478600001)(71200400001)(316002)(6506007)(66476007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: xLeXOBxDfQbuieFexSq7ePyqYkSDwtvnXEaPJ5vZDU2U0z7hxUgdPa+qhnZx5nVFjTUF2TGWjMmJF6+XErK6tgHE9yCV7Wtu0fAeS9oebBHWnN5q24aFBLrJyWMCYw0V5bmy5oVJI5eZr0rL25iD2RgaZ5xo416KOK9R8iA2CxmBChXtnlXR5lb9+iRWgqrAH9iT6UgbF4gqlepu/hBp4thPCdXcv1D5fLlP7iR0CNcn6+K1yR0Sxh4p0jdEoAtgDJYdpxVAPv0m/XQpdLLHlK62EH9JdCCE0Iq7yxWeXZy0T0alWaz3307K/27CTN/FtjTwqDwze9BmSDUS0LOO/BW8fw341e4W0Vu6X+W3YcraV0lEshQyVjuF0qSQWMCKSQQfy0F+21YK8C4EVLYWfBp4kppAWmaHLpjzhyyroDY4R0yt7K5ZX/EecI1n40GqPC5vdS/Z3SOxyGTkzhUNSeTxUXKCS7DOYe3hAJmsS8U= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ea4add1-7635-46d6-905b-08d82749ec96 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jul 2020 16:29:32.6922 (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: xSfY0Vdq2WzDV7i3FvBNx46XWuRREUEmoYyy7RiyNjYyi575wv3EOr584DI3d4GJoH6oAet/WDzdXlNw2i73/apmtgXW+RC0xRSHZhF+rHE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3720 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] mempool/ring: add support for new ring sync modes 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" > On Mon, Jul 13, 2020 at 02:46:35PM +0000, Ananyev, Konstantin wrote: > > Hi Olivier, > > > > > Hi Konstantin, > > > > > > On Fri, Jul 10, 2020 at 03:20:12PM +0000, Ananyev, Konstantin wrote: > > > > > > > > > > > > > > > > > > Hi Olivier, > > > > > > > > > > > Hi Konstantin, > > > > > > > > > > > > On Thu, Jul 09, 2020 at 05:55:30PM +0000, Ananyev, Konstantin w= rote: > > > > > > > Hi Olivier, > > > > > > > > > > > > > > > Hi Konstantin, > > > > > > > > > > > > > > > > On Mon, Jun 29, 2020 at 05:10:24PM +0100, Konstantin Ananye= v wrote: > > > > > > > > > v2: > > > > > > > > > - update Release Notes (as per comments) > > > > > > > > > > > > > > > > > > Two new sync modes were introduced into rte_ring: > > > > > > > > > relaxed tail sync (RTS) and head/tail sync (HTS). > > > > > > > > > This change provides user with ability to select these > > > > > > > > > modes for ring based mempool via mempool ops API. > > > > > > > > > > > > > > > > > > Signed-off-by: Konstantin Ananyev > > > > > > > > > Acked-by: Gage Eads > > > > > > > > > --- > > > > > > > > > doc/guides/rel_notes/release_20_08.rst | 6 ++ > > > > > > > > > drivers/mempool/ring/rte_mempool_ring.c | 97 +++++++++++= +++++++++++--- > > > > > > > > > 2 files changed, 94 insertions(+), 9 deletions(-) > > > > > > > > > > > > > > > > > > diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc= /guides/rel_notes/release_20_08.rst > > > > > > > > > index eaaf11c37..7bdcf3aac 100644 > > > > > > > > > --- a/doc/guides/rel_notes/release_20_08.rst > > > > > > > > > +++ b/doc/guides/rel_notes/release_20_08.rst > > > > > > > > > @@ -84,6 +84,12 @@ New Features > > > > > > > > > * Dump ``rte_flow`` memory consumption. > > > > > > > > > * Measure packet per second forwarding. > > > > > > > > > > > > > > > > > > +* **Added support for new sync modes into mempool ring d= river.** > > > > > > > > > + > > > > > > > > > + Added ability to select new ring synchronisation modes= : > > > > > > > > > + ``relaxed tail sync (ring_mt_rts)`` and ``head/tail sy= nc (ring_mt_hts)`` > > > > > > > > > + via mempool ops API. > > > > > > > > > + > > > > > > > > > > > > > > > > > > Removed Items > > > > > > > > > ------------- > > > > > > > > > diff --git a/drivers/mempool/ring/rte_mempool_ring.c b/dr= ivers/mempool/ring/rte_mempool_ring.c > > > > > > > > > index bc123fc52..15ec7dee7 100644 > > > > > > > > > --- a/drivers/mempool/ring/rte_mempool_ring.c > > > > > > > > > +++ b/drivers/mempool/ring/rte_mempool_ring.c > > > > > > > > > @@ -25,6 +25,22 @@ common_ring_sp_enqueue(struct rte_memp= ool *mp, void * const *obj_table, > > > > > > > > > obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > } > > > > > > > > > > > > > > > > > > +static int > > > > > > > > > +rts_ring_mp_enqueue(struct rte_mempool *mp, void * const= *obj_table, > > > > > > > > > + unsigned int n) > > > > > > > > > +{ > > > > > > > > > + return rte_ring_mp_rts_enqueue_bulk(mp->pool_data, > > > > > > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > +} > > > > > > > > > + > > > > > > > > > +static int > > > > > > > > > +hts_ring_mp_enqueue(struct rte_mempool *mp, void * const= *obj_table, > > > > > > > > > + unsigned int n) > > > > > > > > > +{ > > > > > > > > > + return rte_ring_mp_hts_enqueue_bulk(mp->pool_data, > > > > > > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > +} > > > > > > > > > + > > > > > > > > > static int > > > > > > > > > common_ring_mc_dequeue(struct rte_mempool *mp, void **ob= j_table, unsigned n) > > > > > > > > > { > > > > > > > > > @@ -39,17 +55,30 @@ common_ring_sc_dequeue(struct rte_mem= pool *mp, void **obj_table, unsigned n) > > > > > > > > > obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > } > > > > > > > > > > > > > > > > > > +static int > > > > > > > > > +rts_ring_mc_dequeue(struct rte_mempool *mp, void **obj_t= able, unsigned int n) > > > > > > > > > +{ > > > > > > > > > + return rte_ring_mc_rts_dequeue_bulk(mp->pool_data, > > > > > > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > +} > > > > > > > > > + > > > > > > > > > +static int > > > > > > > > > +hts_ring_mc_dequeue(struct rte_mempool *mp, void **obj_t= able, unsigned int n) > > > > > > > > > +{ > > > > > > > > > + return rte_ring_mc_hts_dequeue_bulk(mp->pool_data, > > > > > > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > > > > > > +} > > > > > > > > > + > > > > > > > > > static unsigned > > > > > > > > > common_ring_get_count(const struct rte_mempool *mp) > > > > > > > > > { > > > > > > > > > return rte_ring_count(mp->pool_data); > > > > > > > > > } > > > > > > > > > > > > > > > > > > - > > > > > > > > > static int > > > > > > > > > -common_ring_alloc(struct rte_mempool *mp) > > > > > > > > > +ring_alloc(struct rte_mempool *mp, uint32_t rg_flags) > > > > > > > > > { > > > > > > > > > - int rg_flags =3D 0, ret; > > > > > > > > > + int ret; > > > > > > > > > char rg_name[RTE_RING_NAMESIZE]; > > > > > > > > > struct rte_ring *r; > > > > > > > > > > > > > > > > > > @@ -60,12 +89,6 @@ common_ring_alloc(struct rte_mempool *= mp) > > > > > > > > > return -rte_errno; > > > > > > > > > } > > > > > > > > > > > > > > > > > > - /* ring flags */ > > > > > > > > > - if (mp->flags & MEMPOOL_F_SP_PUT) > > > > > > > > > - rg_flags |=3D RING_F_SP_ENQ; > > > > > > > > > - if (mp->flags & MEMPOOL_F_SC_GET) > > > > > > > > > - rg_flags |=3D RING_F_SC_DEQ; > > > > > > > > > - > > > > > > > > > /* > > > > > > > > > * Allocate the ring that will be used to store objects= . > > > > > > > > > * Ring functions will return appropriate errors if we = are > > > > > > > > > @@ -82,6 +105,40 @@ common_ring_alloc(struct rte_mempool = *mp) > > > > > > > > > return 0; > > > > > > > > > } > > > > > > > > > > > > > > > > > > +static int > > > > > > > > > +common_ring_alloc(struct rte_mempool *mp) > > > > > > > > > +{ > > > > > > > > > + uint32_t rg_flags; > > > > > > > > > + > > > > > > > > > + rg_flags =3D 0; > > > > > > > > > > > > > > > > Maybe it could go on the same line > > > > > > > > > > > > > > > > > + > > > > > > > > > + /* ring flags */ > > > > > > > > > > > > > > > > Not sure we need to keep this comment > > > > > > > > > > > > > > > > > + if (mp->flags & MEMPOOL_F_SP_PUT) > > > > > > > > > + rg_flags |=3D RING_F_SP_ENQ; > > > > > > > > > + if (mp->flags & MEMPOOL_F_SC_GET) > > > > > > > > > + rg_flags |=3D RING_F_SC_DEQ; > > > > > > > > > + > > > > > > > > > + return ring_alloc(mp, rg_flags); > > > > > > > > > +} > > > > > > > > > + > > > > > > > > > +static int > > > > > > > > > +rts_ring_alloc(struct rte_mempool *mp) > > > > > > > > > +{ > > > > > > > > > + if ((mp->flags & (MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET))= !=3D 0) > > > > > > > > > + return -EINVAL; > > > > > > > > > > > > > > > > Why do we need this? It is a problem to allow sc/sp in this= mode (even > > > > > > > > if it's not optimal)? > > > > > > > > > > > > > > These new sync modes (RTS, HTS) are for MT. > > > > > > > For SP/SC - there is simply no point to use MT sync modes. > > > > > > > I suppose there are few choices: > > > > > > > 1. Make F_SP_PUT/F_SC_GET flags silently override expected op= s behaviour > > > > > > > and create actual ring with ST sync mode for prod/cons. > > > > > > > 2. Report an error. > > > > > > > 3. Silently ignore these flags. > > > > > > > > > > > > > > As I can see for "ring_mp_mc" ops, we doing #1, > > > > > > > while for "stack" we are doing #3. > > > > > > > For RTS/HTS I chosoe #2, as it seems cleaner to me. > > > > > > > Any thoughts from your side what preferable behaviour should = be? > > > > > > > > > > > > The F_SP_PUT/F_SC_GET are only used in rte_mempool_create() to = select > > > > > > the default ops among (ring_sp_sc, ring_mp_sc, ring_sp_mc, > > > > > > ring_mp_mc). > > > > > > > > > > As I understand, nothing prevents user from doing: > > > > > > > > > > mp =3D rte_mempool_create_empty(name, n, elt_size, cache_size, > > > > > sizeof(struct rte_pktmbuf_pool_private), socket_= id, 0); > > > > > > > > Apologies, hit send accidently. > > > > I meant user can do: > > > > > > > > mp =3D rte_mempool_create_empty(..., F_SP_PUT | F_SC_GET); > > > > rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); > > > > > > > > An in that case, he'll get SP/SC ring underneath. > > > > > > It looks it's not the case. Since commit 449c49b93a6b ("mempool: supp= ort > > > handler operations"), the flags SP_PUT/SC_GET are converted into a ca= ll > > > to rte_mempool_set_ops_byname() in rte_mempool_create() only. > > > > > > In rte_mempool_create_empty(), these flags are ignored. It is expecte= d > > > that the user calls rte_mempool_set_ops_byname() by itself. > > > > As I understand the code - not exactly. > > rte_mempool_create_empty() doesn't make any specific actions based on '= flags' value, > > but it does store it's value inside mp->flags. > > Later, when mempool_ops_alloc_once() is called these flags will be used= by > > common_ring_alloc() and might override selected by ops ring behaviour. > > > > > > > > I don't think it is a good behavior: > > > > > > 1/ The documentation of rte_mempool_create_empty() does not say that = the > > > flags are ignored, and a user can expect that F_SP_PUT | F_SC_GET > > > sets the default ops like rte_mempool_create(). > > > > > > 2/ If rte_mempool_set_ops_byname() is not called after > > > rte_mempool_create_empty() (and it looks it happens in dpdk's code= ), > > > the default ops are the ones registered at index 0. This depends o= n > > > the link order. > > > > > > So I propose to move the following code in > > > rte_mempool_create_empty(). > > > > > > if ((flags & MEMPOOL_F_SP_PUT) && (flags & MEMPOOL_F_SC_GET)) > > > ret =3D rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL); > > > else if (flags & MEMPOOL_F_SP_PUT) > > > ret =3D rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL); > > > else if (flags & MEMPOOL_F_SC_GET) > > > ret =3D rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL); > > > else > > > ret =3D rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); > > > > > > What do you think? > > > > I think it will be a good thing - as in that case we'll always have > > "ring_mp_mc" selected as default one. > > As another thought, it porbably would be good to deprecate and later re= move > > MEMPOOL_F_SP_PUT and MEMPOOL_F_SC_GET completely. > > These days user can select this behaviour via mempool ops and such dual= ism > > just makes things more error-prone and harder to maintain. > > Especially as we don't have clear policy what should be the higher prio= rity > > for sync mode selection: mempool ops or flags. > > >=20 > I'll tend to agree, however it would mean deprecate rte_mempool_create() > too, because we wouldn't be able to set ops with it. Or we would have to > add a 12th (!) argument to the function, to set the ops name. >=20 > I don't like having that many arguments to this function, but it seems > it is widely used, probably because it is just one function call (vs > create_empty + set_ops + populate). So adding a "ops_name" argument is > maybe the right thing to do, given we can keep abi compat. My thought was - just keep rte_mempool_create() parameter list as it is, and always set ops to "ring_mp_mc" for it. Users who'd like some other ops would force to use create_empty+set_ops+populate. That's pretty much the same what we have right now, the only diff will be ring with SP/SC mode.