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 4DA86A0C55; Wed, 13 Oct 2021 17:21:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 356FC411EE; Wed, 13 Oct 2021 17:21:39 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 6EB72411EC for ; Wed, 13 Oct 2021 17:21:37 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0CA055C00E4; Wed, 13 Oct 2021 11:21:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 13 Oct 2021 11:21:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= c/EcqWGDLp20af1m95PAiPH+DMrxDl1wYej50jud9Zc=; b=Yyj1dQ8r6Tn0rw+8 iMIkIAvzOuVCBO9i+DzbxuisbCFBC5UscIeh9CffDYvMgsCM5dcQSNJ7qFjXiLbz WOVegGLQ6ZIub9XtnTMvmYZ0QAtRu3fhBHZ8fSZQuqB7+xrgBI8nrzF07/0YBYAr 4sX1URpst6U+OxNhe2H8AeSkFLT2cKE6B0NONx1CWwx04WStc/L2BDSfPPo1329t 5OXQqvIyTsN0yoCpa3gIkBffcsbFrKpi+92X0cfh+1OX51iRvphj4WIiRshMh64k HlZ8lWbjRr56cXkxd+/tmkalfZRQ379JUEhvwGJH9QpZm6fUp2RI2HtJmcDWW3qh 0SbuLg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=c/EcqWGDLp20af1m95PAiPH+DMrxDl1wYej50jud9 Zc=; b=AtB6mkt9J4JKR4mJBpnmtliZ11XWDDNP7yuXC90AcyVZFEmnsO67/C6+d 7rmkG8Z1oWNAxUE6gCDYvoN+2Ee51WzpQRM9QatPrjpj7vKbHaLteYRdIPx6yunl 3ND/cFWbBO5J3QIntQD6YzS2Yu1i5BKizFddBnzxEKyGhsO60cqxKctcg7iuSdQW MrjOYUlnEuYm8hdoluvifDW2ddEXcVatbt1PEvLJftuAyxtRMBGLpp448s7DI0oS cbQhO6FRcYGIYaGeDFBWdPy7/Zrp90HvLsGoHnyPlrGv3GdzENofAdOlzEFYvjno 54dV5Iic0mGpRZDeXB/SKNAdnV0+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddutddgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Oct 2021 11:21:34 -0400 (EDT) From: Thomas Monjalon To: Olivier Matz , Andrew Rybchenko , Gowrishankar Muthukrishnan Cc: dev@dpdk.org, jerinj@marvell.com, ciara.power@intel.com, kevin.laatz@intel.com, bruce.richardson@intel.com Date: Wed, 13 Oct 2021 17:21:32 +0200 Message-ID: <3091340.QZWd2UBH1p@thomas> In-Reply-To: References: <27322d9f3916f0a0ec19b4367c1a6f7e599af0a5.1632219073.git.gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [v1] mempool: add telemetry endpoint for mempool info 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 Sender: "dev" Not sure review from who we should wait. Cc'ing telemetry people 29/09/2021 08:40, Gowrishankar Muthukrishnan: > Add telemetry endpoint for mempool info. > > Signed-off-by: Gowrishankar Muthukrishnan > --- > lib/mempool/rte_mempool.c | 84 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 84 insertions(+) > > diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c > index 59a588425b..b8dad2997a 100644 > --- a/lib/mempool/rte_mempool.c > +++ b/lib/mempool/rte_mempool.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include "rte_mempool.h" > #include "rte_mempool_trace.h" > @@ -1343,3 +1344,86 @@ void rte_mempool_walk(void (*func)(struct rte_mempool *, void *), > > rte_mcfg_mempool_read_unlock(); > } > + > +static void > +mempool_list_cb(struct rte_mempool *mp, void *arg) > +{ > + struct rte_tel_data *d = (struct rte_tel_data *)arg; > + > + rte_tel_data_add_array_string(d, mp->name); > +} > + > +static int > +mempool_handle_list(const char *cmd __rte_unused, > + const char *params __rte_unused, struct rte_tel_data *d) > +{ > + rte_tel_data_start_array(d, RTE_TEL_STRING_VAL); > + rte_mempool_walk(mempool_list_cb, d); > + return 0; > +} > + > +struct mempool_info_cb_arg { > + char *pool_name; > + struct rte_tel_data *d; > +}; > + > +static void > +mempool_info_cb(struct rte_mempool *mp, void *arg) > +{ > + struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg; > + const struct rte_memzone *mz; > + > + if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE)) > + return; > + > + rte_tel_data_add_dict_string(info->d, "name", mp->name); > + rte_tel_data_add_dict_int(info->d, "pool_id", mp->pool_id); > + rte_tel_data_add_dict_int(info->d, "flags", mp->flags); > + rte_tel_data_add_dict_int(info->d, "socket_id", mp->socket_id); > + rte_tel_data_add_dict_int(info->d, "size", mp->size); > + rte_tel_data_add_dict_int(info->d, "cache_size", mp->cache_size); > + rte_tel_data_add_dict_int(info->d, "elt_size", mp->elt_size); > + rte_tel_data_add_dict_int(info->d, "header_size", mp->header_size); > + rte_tel_data_add_dict_int(info->d, "trailer_size", mp->trailer_size); > + rte_tel_data_add_dict_int(info->d, "private_data_size", > + mp->private_data_size); > + rte_tel_data_add_dict_int(info->d, "ops_index", mp->ops_index); > + rte_tel_data_add_dict_int(info->d, "populated_size", > + mp->populated_size); > + > + mz = mp->mz; > + rte_tel_data_add_dict_string(info->d, "mz_name", mz->name); > + rte_tel_data_add_dict_int(info->d, "mz_len", mz->len); > + rte_tel_data_add_dict_int(info->d, "mz_hugepage_sz", > + mz->hugepage_sz); > + rte_tel_data_add_dict_int(info->d, "mz_socket_id", mz->socket_id); > + rte_tel_data_add_dict_int(info->d, "mz_flags", mz->flags); > +} > + > +static int > +mempool_handle_info(const char *cmd __rte_unused, const char *params, > + struct rte_tel_data *d) > +{ > + struct mempool_info_cb_arg mp_arg; > + char name[RTE_MEMZONE_NAMESIZE]; > + > + if (params == NULL || strlen(params) == 0) > + return -EINVAL; > + > + rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE); > + > + rte_tel_data_start_dict(d); > + mp_arg.pool_name = name; > + mp_arg.d = d; > + rte_mempool_walk(mempool_info_cb, &mp_arg); > + > + return 0; > +} > + > +RTE_INIT(mempool_init_telemetry) > +{ > + rte_telemetry_register_cmd("/mempool/list", mempool_handle_list, > + "Returns list of available mempool. Takes no parameters"); > + rte_telemetry_register_cmd("/mempool/info", mempool_handle_info, > + "Returns mempool info. Parameters: pool_name"); > +} >