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 6D51CA0598; Fri, 10 Apr 2020 22:15:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 821F81D533; Fri, 10 Apr 2020 22:15:13 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70084.outbound.protection.outlook.com [40.107.7.84]) by dpdk.org (Postfix) with ESMTP id A71C01D530 for ; Fri, 10 Apr 2020 22:15:11 +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=2BaForc3YToDhJxc8IgYFU/0cEBfzh/HeNjvdIrZAtA=; b=himGJapyNx34wRWn1FAC3PWO4JnQawSyn/JSBHye6Hj+AVIGC9aKIMK3pXuff7qmiF9tsGsO9ZPHv7U/TtlDTHaP2ZbbCKmlhn7de7sLnbT0b0+cmtnZdBvsDe31twjRoKKYpFVen/pLCI5bYZMFr3dLumcfkNnGV5WuP7aSI2E= Received: from DB6PR0802CA0045.eurprd08.prod.outlook.com (2603:10a6:4:a3::31) by DBBPR08MB4507.eurprd08.prod.outlook.com (2603:10a6:10:d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.19; Fri, 10 Apr 2020 20:15:09 +0000 Received: from DB5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a3:cafe::23) by DB6PR0802CA0045.outlook.office365.com (2603:10a6:4:a3::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Fri, 10 Apr 2020 20:15:09 +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 DB5EUR03FT035.mail.protection.outlook.com (10.152.20.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Fri, 10 Apr 2020 20:15:09 +0000 Received: ("Tessian outbound 9e48e1321951:v50"); Fri, 10 Apr 2020 20:15:09 +0000 X-CR-MTA-TID: 64aa7808 Received: from 4437fd1bb059.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7E42A69B-D93E-45DA-AB22-000B0CAB90C0.1; Fri, 10 Apr 2020 20:15:04 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4437fd1bb059.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 10 Apr 2020 20:15:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d1DPjftPYy7BAHCrqLlrLq/8/OSROY9+RFVIn2SPI7DtoA3H1rKH5McDulxXuDvp9oJOVNeWtfQeHUsZ3Jq6mwi33dr6p7fbdClRIhZHHTJ7pYT+DTQRKADTMF6A+WLd5NS2adD8Cjtu9/ekDntYSonDXBviDjF/au2zqOix5+hgMeOqJJfM0Z2HEbCa3G1MMjurtcTjta4V5aNFOrtf6t5U6XenAw0wRBN3q7wlF8jSqwfJUsbpb2m2jJG7aRIp1ExygCTLEz4hdf8n+3nH0SJO9M4yrxtZTIGe4Ts/BYCFdmhyMqPdrWXkjr5hY0mtSgA/sC90pDblNbWZ4JMtHQ== 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=2BaForc3YToDhJxc8IgYFU/0cEBfzh/HeNjvdIrZAtA=; b=ZLIrbNzo+uPm/1sogmI7PGZG8A74Pv8unPbQmYc3UNkDo5T6aVAofXU6a/40Rn7lt+I0KkbZJ7HSlc+wRc4rF96fhBSgtwWpxZYs4wjh6wEXk40vNtFMPhpk8ersMaVlOKovb1+nNH0sb6M0WQR8QaMmycLW2d6/2kZ6JwH6HkU7svmWOGv9gAvlXide0gVeYpIIp4sktxJL/zRliRZL32FiTexSjemoe3AxtCzBfTppfZV9F7YZIHXz73FUO5FsNvHU+LpCRYykeI1VSS03ogx5QHSpp6027r05W6/0KQ5jqCCZ3A6E4drWXeRLQhAuxns9gHoWz17od/rK0GGyXA== 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=2BaForc3YToDhJxc8IgYFU/0cEBfzh/HeNjvdIrZAtA=; b=himGJapyNx34wRWn1FAC3PWO4JnQawSyn/JSBHye6Hj+AVIGC9aKIMK3pXuff7qmiF9tsGsO9ZPHv7U/TtlDTHaP2ZbbCKmlhn7de7sLnbT0b0+cmtnZdBvsDe31twjRoKKYpFVen/pLCI5bYZMFr3dLumcfkNnGV5WuP7aSI2E= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBPR08MB4396.eurprd08.prod.outlook.com (2603:10a6:10:ca::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Fri, 10 Apr 2020 20:15:01 +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.2878.023; Fri, 10 Apr 2020 20:15:01 +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 v3 2/9] ring: prepare ring to allow new sync schemes Thread-Index: AQHWCd9SGR0FDhbGHEiK+87+US4gIahuWbqwgAJ6+4CAAf07EA== Date: Fri, 10 Apr 2020 20:15:01 +0000 Message-ID: References: <20200402220959.29885-1-konstantin.ananyev@intel.com> <20200403174235.23308-1-konstantin.ananyev@intel.com> <20200403174235.23308-3-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: 9ed49688-fb66-430f-a880-376120bad205.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: ee9e2087-4890-4045-d9ce-08d7dd8bde70 x-ms-traffictypediagnostic: DBBPR08MB4396:|DBBPR08MB4396:|DBBPR08MB4507: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3513;OLM:3513; x-forefront-prvs: 0369E8196C 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)(396003)(136003)(366004)(376002)(39860400002)(346002)(66476007)(66446008)(64756008)(66556008)(76116006)(71200400001)(186003)(478600001)(30864003)(4326008)(5660300002)(86362001)(52536014)(66946007)(26005)(6506007)(33656002)(7696005)(81156014)(9686003)(8936002)(54906003)(55016002)(110136005)(2906002)(316002)(8676002); 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: zWeT/TmATPm6iv7qHtDJGSOziuSszLYnWnstx7PT4YEiEdS7nxYnsx57pBc4gZkUZKepeO44k8Uv6lr4hGwVTj2aX2tc+W5C3wdkJY0U9937OEYNi7vS6VhJdaFJcRR/2yTMEXtKZ1eMo1xX547o9dUPq6TBvcCSEh+BwHIYTRCXwdyUVKfj2nMxNuQo1OBHxthN4NJ4i4LkGGVO6IL8yeb4nMf3NcWdnGIyfZG2fKnQlrQDXKn5zdGsswhqVrdVDl5xh+oi6GeAVSgV4FLD49TCgYKcK0ps2jTFOOPO3DLxkUbS5HWT3BCpf8eco1857gGdrDts/4rdlmdHQbmRX006CBvKYac+ZFb/hn+f5eHGobY5W3JCRLzVtl6RTg4ucjEECZmqEr9mgcqPMYAwkLep3xHYmj6a1QJ6J/RG9gYA7Av8JSZNZWu+kG05Gpq9 x-ms-exchange-antispam-messagedata: qQlseN80CTCX8rr/F8upKwRYsIfoKmABYk9ukYrI6FTpVZEavVFTgEue8XCJ/8FBdGXZOlWy5lQLWtmZSLdydTPW8Yek3lqIIhOr0uqa+YE+fl83vFJapfReTqMmLBQdokihTcNjINy+lxW4i6b1KA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4396 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT035.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)(346002)(376002)(136003)(39860400002)(396003)(46966005)(356005)(6506007)(478600001)(2906002)(4326008)(26826003)(186003)(316002)(81166007)(8936002)(30864003)(47076004)(9686003)(82740400003)(26005)(8676002)(33656002)(110136005)(70206006)(70586007)(7696005)(81156014)(336012)(86362001)(5660300002)(55016002)(52536014)(54906003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: fd4c3e97-0608-4377-4e3b-08d7dd8bd96c X-Forefront-PRVS: 0369E8196C X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K4lJcmk/EQxZlTmtKWbROTmtdsp7I9JQTb9w26ctKvbi7nn0V/VblG0guP0+SeNLZY35SkYGjWWy4BHSHvsVpOBpd8i1MVUVFAogMe2GvRJk3wWlV87Ybt9BWiqS1zB6Q5uNtowexz4e9+RGvbP+S1gt5ss5KbHE1o3L5nSuNd5rWUKeBQzvOlXaLY5nktOC8hkHZZZSHNjkiEQJWWFPgleQ7ybVPDuIr1zQrhEBmhh/+iSsfDsgi5NIq+OT8F6YIpv8FjXIsPktyGPNoRqiBWeraE/6CmXi3S4iSK95MO11spnkTPU2KqlrKKZW7rZ8Bg6K+Q19aXEnVkgfaX/KtlnogAqyOp3ydnVgWdocOh9GsGTvUOmPGbNry/lySEbhDris9xtFV0BSEJZGeJPcSRPu0gEE7fMXeQ+6rmyM07xG+4AfUfUh/2iPq9nfVkfAW1tmWY3csCiyC8vX8EJPjC783xVpxQn0cu2IDS9GM2Lv3ini5/ju2CEWwSnkiiBZ2npACThuwoD6NAW7fJG9GQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2020 20:15:09.8134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee9e2087-4890-4045-d9ce-08d7dd8bde70 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: DBBPR08MB4507 Subject: Re: [dpdk-dev] [PATCH v3 2/9] ring: prepare ring to allow new sync schemes 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 > > > Subject: [PATCH v3 2/9] ring: prepare ring to allow new sync schemes > > > > > > Change from *single* to *sync_type* to allow different > > > synchronisation schemes to be applied. > > > Mark *single* as deprecated in comments. > > > Add new functions to allow user to query ring sync types. > > > Replace direct access to *single* with appopriate function call. > > > > > > Signed-off-by: Konstantin Ananyev > > > --- > > > app/test/test_pdump.c | 6 +- > > > lib/librte_pdump/rte_pdump.c | 2 +- > > > lib/librte_port/rte_port_ring.c | 12 ++-- > > > lib/librte_ring/rte_ring.c | 6 +- > > > lib/librte_ring/rte_ring.h | 113 ++++++++++++++++++++++++++----= -- > > > lib/librte_ring/rte_ring_elem.h | 8 +-- > > > 6 files changed, 108 insertions(+), 39 deletions(-) > > > > > > diff --git a/app/test/test_pdump.c b/app/test/test_pdump.c index > > > ad183184c..6a1180bcb 100644 > > > --- a/app/test/test_pdump.c > > > +++ b/app/test/test_pdump.c > > > @@ -57,8 +57,7 @@ run_pdump_client_tests(void) > > > if (ret < 0) > > > return -1; > > > mp->flags =3D 0x0000; > > > - ring_client =3D rte_ring_create("SR0", RING_SIZE, rte_socket_id(), > > > - RING_F_SP_ENQ | RING_F_SC_DEQ); > > > + ring_client =3D rte_ring_create("SR0", RING_SIZE, rte_socket_id(), > > > +0); > > Are you saying to get SP and SC behavior we now have to set the flags t= o 0? >=20 > No. > What the original cause does: > creates SP/SC ring: > ring_client =3D rte_ring_create("SR0", RING_SIZE, rte_socket_id(), > RING_F_SP_ENQ | RING_F_SC_DEQ); Then > manually makes it MP/MC by: > ring_client->prod.single =3D 0; > ring_client->cons.single =3D 0; >=20 > Instead it should just create MP/MC ring straightway, as the patch does: > ring_client =3D rte_ring_create("SR0", RING_SIZE, rte_socket_id(), 0); >=20 > >Isn't that a ABI break? > I don't see any. Ack >=20 > > > > > if (ring_client =3D=3D NULL) { > > > printf("rte_ring_create SR0 failed"); > > > return -1; > > > @@ -71,9 +70,6 @@ run_pdump_client_tests(void) > > > } > > > rte_eth_dev_probing_finish(eth_dev); > > > > > > - ring_client->prod.single =3D 0; > > > - ring_client->cons.single =3D 0; > > Just wondering if users outside of DPDK have done the same. I hope not, > otherwise, we have an API break? >=20 > I think no. While it is completely wrong practise, it would keep working = even > with these changes. Ack >=20 > > > > > - > > > printf("\n***** flags =3D RTE_PDUMP_FLAG_TX *****\n"); > > > > > > for (itr =3D 0; itr < NUM_ITR; itr++) { diff --git > > > a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index > > > 8a01ac510..65364f2c5 100644 > > > --- a/lib/librte_pdump/rte_pdump.c > > > +++ b/lib/librte_pdump/rte_pdump.c > > > @@ -380,7 +380,7 @@ pdump_validate_ring_mp(struct rte_ring *ring, > > > struct rte_mempool *mp) > > > rte_errno =3D EINVAL; > > > return -1; > > > } > > > - if (ring->prod.single || ring->cons.single) { > > > + if (rte_ring_prod_single(ring) || rte_ring_cons_single(ring)) { > > > PDUMP_LOG(ERR, "ring with either SP or SC settings" > > > " is not valid for pdump, should have MP and MC settings\n"); > > > rte_errno =3D EINVAL; > > > diff --git a/lib/librte_port/rte_port_ring.c > > > b/lib/librte_port/rte_port_ring.c index 47fcdd06a..2f6c050fa 100644 > > > --- a/lib/librte_port/rte_port_ring.c > > > +++ b/lib/librte_port/rte_port_ring.c > > > @@ -44,8 +44,8 @@ rte_port_ring_reader_create_internal(void *params, > > > int socket_id, > > > /* Check input parameters */ > > > if ((conf =3D=3D NULL) || > > > (conf->ring =3D=3D NULL) || > > > - (conf->ring->cons.single && is_multi) || > > > - (!(conf->ring->cons.single) && !is_multi)) { > > > + (rte_ring_cons_single(conf->ring) && is_multi) || > > > + (!rte_ring_cons_single(conf->ring) && !is_multi)) { > > > RTE_LOG(ERR, PORT, "%s: Invalid Parameters\n", __func__); > > > return NULL; > > > } > > > @@ -171,8 +171,8 @@ rte_port_ring_writer_create_internal(void > > > *params, int socket_id, > > > /* Check input parameters */ > > > if ((conf =3D=3D NULL) || > > > (conf->ring =3D=3D NULL) || > > > - (conf->ring->prod.single && is_multi) || > > > - (!(conf->ring->prod.single) && !is_multi) || > > > + (rte_ring_prod_single(conf->ring) && is_multi) || > > > + (!rte_ring_prod_single(conf->ring) && !is_multi) || > > > (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) { > > > RTE_LOG(ERR, PORT, "%s: Invalid Parameters\n", __func__); > > > return NULL; > > > @@ -440,8 +440,8 @@ > rte_port_ring_writer_nodrop_create_internal(void > > > *params, int socket_id, > > > /* Check input parameters */ > > > if ((conf =3D=3D NULL) || > > > (conf->ring =3D=3D NULL) || > > > - (conf->ring->prod.single && is_multi) || > > > - (!(conf->ring->prod.single) && !is_multi) || > > > + (rte_ring_prod_single(conf->ring) && is_multi) || > > > + (!rte_ring_prod_single(conf->ring) && !is_multi) || > > > (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) { > > > RTE_LOG(ERR, PORT, "%s: Invalid Parameters\n", __func__); > > > return NULL; > > > diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c > > > index > > > 77e5de099..fa5733907 100644 > > > --- a/lib/librte_ring/rte_ring.c > > > +++ b/lib/librte_ring/rte_ring.c > > > @@ -106,8 +106,10 @@ rte_ring_init(struct rte_ring *r, const char > > > *name, unsigned count, > > > if (ret < 0 || ret >=3D (int)sizeof(r->name)) > > > return -ENAMETOOLONG; > > > r->flags =3D flags; > > > - r->prod.single =3D (flags & RING_F_SP_ENQ) ? __IS_SP : __IS_MP; > > > - r->cons.single =3D (flags & RING_F_SC_DEQ) ? __IS_SC : __IS_MC; > > > + r->prod.sync_type =3D (flags & RING_F_SP_ENQ) ? > > > + RTE_RING_SYNC_ST : RTE_RING_SYNC_MT; > > > + r->cons.sync_type =3D (flags & RING_F_SC_DEQ) ? > > > + RTE_RING_SYNC_ST : RTE_RING_SYNC_MT; > > > > > > if (flags & RING_F_EXACT_SZ) { > > > r->size =3D rte_align32pow2(count + 1); diff --git > > > a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index > > > 18fc5d845..d4775a063 100644 > > > --- a/lib/librte_ring/rte_ring.h > > > +++ b/lib/librte_ring/rte_ring.h > > > @@ -61,11 +61,27 @@ enum rte_ring_queue_behavior { #define > > > RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \ > > > sizeof(RTE_RING_MZ_PREFIX) + 1) > > > > > > -/* structure to hold a pair of head/tail values and other metadata > > > */ > > > +/** prod/cons sync types */ > > > +enum rte_ring_sync_type { > > > + RTE_RING_SYNC_MT, /**< multi-thread safe (default mode) */ > > > + RTE_RING_SYNC_ST, /**< single thread only */ > > > +}; > > > + > > > +/** > > > + * structure to hold a pair of head/tail values and other metadata. > > > + * Depending on sync_type format of that structure might be > > > +different, > > > + * but offset for *sync_type* and *tail* values should remain the sa= me. > > > + */ > > > struct rte_ring_headtail { > > > - volatile uint32_t head; /**< Prod/consumer head. */ > > > - volatile uint32_t tail; /**< Prod/consumer tail. */ > > > - uint32_t single; /**< True if single prod/cons */ > > > + volatile uint32_t head; /**< prod/consumer head. */ > > > + volatile uint32_t tail; /**< prod/consumer tail. */ > > > + RTE_STD_C11 > > > + union { > > > + /** sync type of prod/cons */ > > > + enum rte_ring_sync_type sync_type; > > > + /** deprecated - True if single prod/cons */ > > > + uint32_t single; > > > + }; > > > }; > > > > > > /** > > > @@ -116,11 +132,10 @@ struct rte_ring { #define RING_F_EXACT_SZ > > > 0x0004 #define RTE_RING_SZ_MASK (0x7fffffffU) /**< Ring size mask > > > */ > > > > > > -/* @internal defines for passing to the enqueue dequeue worker > > > functions */ -#define __IS_SP 1 -#define __IS_MP 0 -#define __IS_SC > > > 1 -#define __IS_MC 0 > > > +#define __IS_SP RTE_RING_SYNC_ST > > > +#define __IS_MP RTE_RING_SYNC_MT > > > +#define __IS_SC RTE_RING_SYNC_ST > > > +#define __IS_MC RTE_RING_SYNC_MT > > I think we can remove these #defines and use the new SYNC types >=20 > Wouldn't that introduce an API breakage? > Or we are ok here, as they are marked as internal? > I think I can for sure mark them as deprecated. I think they are internal.=20 Although it does not apply to your patch, rte_ring_queue_behavior also shou= ld be internal. >=20 > > > > > > /** > > > * Calculate the memory size needed for a ring @@ -420,7 +435,7 @@ > > > rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, > > > unsigned int n, unsigned int *free_space) { > > > return __rte_ring_do_enqueue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - __IS_MP, free_space); > > > + RTE_RING_SYNC_MT, free_space); > > > } > > > > > > /** > > > @@ -443,7 +458,7 @@ rte_ring_sp_enqueue_bulk(struct rte_ring *r, > > > void * const *obj_table, > > > unsigned int n, unsigned int *free_space) { > > > return __rte_ring_do_enqueue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - __IS_SP, free_space); > > > + RTE_RING_SYNC_ST, free_space); > > > } > > > > > > /** > > > @@ -470,7 +485,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * > > > const *obj_table, > > > unsigned int n, unsigned int *free_space) { > > > return __rte_ring_do_enqueue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - r->prod.single, free_space); > > > + r->prod.sync_type, free_space); > > > } > > > > > > /** > > > @@ -554,7 +569,7 @@ rte_ring_mc_dequeue_bulk(struct rte_ring *r, > > > void **obj_table, > > > unsigned int n, unsigned int *available) { > > > return __rte_ring_do_dequeue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - __IS_MC, available); > > > + RTE_RING_SYNC_MT, available); > > > } > > > > > > /** > > > @@ -578,7 +593,7 @@ rte_ring_sc_dequeue_bulk(struct rte_ring *r, > > > void **obj_table, > > > unsigned int n, unsigned int *available) { > > > return __rte_ring_do_dequeue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - __IS_SC, available); > > > + RTE_RING_SYNC_ST, available); > > > } > > > > > > /** > > > @@ -605,7 +620,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void > > > **obj_table, unsigned int n, > > > unsigned int *available) > > > { > > > return __rte_ring_do_dequeue(r, obj_table, n, > > > RTE_RING_QUEUE_FIXED, > > > - r->cons.single, available); > > > + r->cons.sync_type, available); > > > } > > > > > > /** > > > @@ -777,6 +792,62 @@ rte_ring_get_capacity(const struct rte_ring *r) > > > return r->capacity; > > > } > > > > > > +/** > > > + * Return sync type used by producer in the ring. > > > + * > > > + * @param r > > > + * A pointer to the ring structure. > > > + * @return > > > + * Producer sync type value. > > > + */ > > > +static inline enum rte_ring_sync_type > > > +rte_ring_get_prod_sync_type(const struct rte_ring *r) { > > > + return r->prod.sync_type; > > > +} > > > + > > > +/** > > > + * Check is the ring for single producer. > > ^^ if > > > + * > > > + * @param r > > > + * A pointer to the ring structure. > > > + * @return > > > + * true if ring is SP, zero otherwise. > > > + */ > > > +static inline int > > > +rte_ring_prod_single(const struct rte_ring *r) { > > would rte_ring_is_prod_single better? >=20 > Ok, can rename. >=20 > > > > > + return (rte_ring_get_prod_sync_type(r) =3D=3D RTE_RING_SYNC_ST); } > > > + > > > +/** > > > + * Return sync type used by consumer in the ring. > > > + * > > > + * @param r > > > + * A pointer to the ring structure. > > > + * @return > > > + * Consumer sync type value. > > > + */ > > > +static inline enum rte_ring_sync_type > > > +rte_ring_get_cons_sync_type(const struct rte_ring *r) { > > > + return r->cons.sync_type; > > > +} > > > + > > > +/** > > > + * Check is the ring for single consumer. > > > + * > > > + * @param r > > > + * A pointer to the ring structure. > > > + * @return > > > + * true if ring is SC, zero otherwise. > > > + */ > > > +static inline int > > > +rte_ring_cons_single(const struct rte_ring *r) { > > > + return (rte_ring_get_cons_sync_type(r) =3D=3D RTE_RING_SYNC_ST); } > > > + > > All these new functions are not required to be called in the data path= . They > can be made non-inline. >=20 > Well, all these functions are introduced to encourage people not to acces= s > ring fields sync_type/single directly but use functions instead. > I don't know do people access ring.single directly at data-path or not, b= ut > assuming that they do - making these functions not-inline would force the= m > to ignore these functions and keep accessing it directly. > That was my thoughts besides making them inline. > I think we have the same for get_size/get_capacity(). Ack=20