From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C47F142AA0; Tue, 9 May 2023 08:50:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DDBE410D7; Tue, 9 May 2023 08:50:32 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 35DFB400EF for ; Tue, 9 May 2023 08:50:31 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id EDB12222A0; Tue, 9 May 2023 08:50:30 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH v5 3/3] ring: add telemetry cmd for ring info X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Tue, 9 May 2023 08:50:27 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D878EE@smartserver.smartshare.dk> In-Reply-To: <20230509012907.3817-4-haijie1@huawei.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v5 3/3] ring: add telemetry cmd for ring info Thread-Index: AdmCFftz2O+ddpCmRs21VJmi23zWawAK64Pg References: <20230210024835.33804-1-haijie1@huawei.com> <20230509012907.3817-1-haijie1@huawei.com> <20230509012907.3817-4-haijie1@huawei.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Jie Hai" , "Honnappa Nagarahalli" , "Konstantin Ananyev" Cc: , X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Jie Hai [mailto:haijie1@huawei.com] > Sent: Tuesday, 9 May 2023 03.29 >=20 > This patch supports dump of ring information by its name. > An example using this command is shown below: >=20 > --> /ring/info,MP_mb_pool_0 > { > "/ring/info": { > "name": "MP_mb_pool_0", > "socket": 0, > "flags": "0x0", > "producer_type": "MP", > "consumer_type": "MC", > "size": 262144, > "mask": "0x3ffff", > "capacity": 262143, > "used_count": 153197, > "consumer_tail": 2259, > "consumer_head": 2259, > "producer_tail": 155456, > "producer_head": 155456, > "mz_name": "RG_MP_mb_pool_0", > "mz_len": 2097536, > "mz_hugepage_sz": 1073741824, > "mz_socket_id": 0, > "mz_flags": "0x0" > } > } >=20 > Signed-off-by: Jie Hai > Reviewed-by: Honnappa Nagarahalli > Acked-by: Konstantin Ananyev > Acked-by: Huisong Li > Acked-by: Chengwen Feng > --- > lib/ring/rte_ring.c | 99 = +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 99 insertions(+) >=20 > diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c > index 0e83d0099363..26c8f2a2e6a2 100644 > --- a/lib/ring/rte_ring.c > +++ b/lib/ring/rte_ring.c > @@ -455,8 +455,107 @@ ring_handle_list(const char *cmd __rte_unused, > return 0; > } >=20 > +static const char * > +ring_prod_sync_type_to_name(struct rte_ring *r) > +{ > + switch (r->prod.sync_type) { > + case RTE_RING_SYNC_MT: > + return "MP"; > + case RTE_RING_SYNC_ST: > + return "SP"; > + case RTE_RING_SYNC_MT_RTS: > + return "MP_RTS"; > + case RTE_RING_SYNC_MT_HTS: > + return "MP_HTS"; > + default: > + return "Unknown"; > + } > +} > + > +static const char * > +ring_cons_sync_type_to_name(struct rte_ring *r) > +{ > + switch (r->cons.sync_type) { > + case RTE_RING_SYNC_MT: > + return "MC"; > + case RTE_RING_SYNC_ST: > + return "SC"; > + case RTE_RING_SYNC_MT_RTS: > + return "MC_RTS"; > + case RTE_RING_SYNC_MT_HTS: > + return "MC_HTS"; > + default: > + return "Unknown"; > + } > +} I considered if these two functions should be replaced by one, returning = e.g. "MT" instead of "MP"/"MC"; however, the ring flags describe the = sync types as e.g. "MP" and "MP RTS", so I eventually came to agree = with the approach in the patch. The structure documentation requires that the sync_type field must be in = the same position, regardless which of the union's types are being used. = So this is also correct. Series-Acked-by: Morten Br=F8rup