From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Jie Hai <haijie1@huawei.com>,
"konstantin.v.ananyev@yandex.ru" <konstantin.v.ananyev@yandex.ru>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "liudongdong3@huawei.com" <liudongdong3@huawei.com>,
nd <nd@arm.com>, nd <nd@arm.com>
Subject: RE: [PATCH v3 2/2] ring: add ring info telemetry cmd
Date: Tue, 31 Jan 2023 16:44:03 +0000 [thread overview]
Message-ID: <DBAPR08MB581415F0FD82DD7AFA7B2B2498D09@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20230131022841.10775-3-haijie1@huawei.com>
Few minor nits. Otherwise,
Reviewed-by: Honnappa Nagarahalli <Honnappa.nagarahalli@arm.com>
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Monday, January 30, 2023 8:29 PM
> To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> konstantin.v.ananyev@yandex.ru; dev@dpdk.org
> Cc: liudongdong3@huawei.com; haijie1@huawei.com
> Subject: [PATCH v3 2/2] ring: add ring info telemetry cmd
"ring: add telemetry cmd for ring info"
>
> This patch supports dump of the info of ring by its name.
This patch supports dump of ring information by its name.
> An example using this command is shown below:
>
> --> /ring/info,MP_mb_pool_0
> {
> "/ring/info": {
> "name": "MP_mb_pool_0",
> "socket": 0,
> "flags": 0,
> "producer_type": "MP",
> "consumer_type": "MC",
> "size": 262144,
> "mask": 262143,
> "capacity": 262143,
> "used_count": 147173,
> "consumer_tail": 8283,
> "consumer_head": 8283,
> "producer_tail": 155456,
> "producer_head": 155456,
Sometimes it is much easier to understand these numbers if they are in hexadecimal. Is it possible to add the hexadecimal format in brackets? Something like:
"size": 262144 (0x40000)
> "mz_name": "RG_MP_mb_pool_0",
> "mz_len": 2097920,
> "mz_hugepage_sz": 1073741824,
> "mz_socket_id": 0,
> "mz_flags": 0
> }
> }
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> lib/ring/rte_ring.c | 83 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 83 insertions(+)
>
> diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c index
> e6aac332d88f..2e57aa653339 100644
> --- a/lib/ring/rte_ring.c
> +++ b/lib/ring/rte_ring.c
> @@ -454,8 +454,91 @@ ring_handle_list(const char *cmd __rte_unused,
> return 0;
> }
>
> +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";
> + }
> +}
> +
> +static int
> +ring_handle_info(const char *cmd __rte_unused, const char *params,
> + struct rte_tel_data *d)
> +{
> + const struct rte_memzone *mz;
> + struct rte_ring *r;
> +
> + if (params == NULL || strlen(params) == 0 ||
> + strlen(params) >= RTE_RING_NAMESIZE)
> + return -EINVAL;
> +
> + r = rte_ring_lookup(params);
> + if (r == NULL)
> + return -EINVAL;
> +
> + rte_mcfg_tailq_read_lock();
> +
> + rte_tel_data_start_dict(d);
> + rte_tel_data_add_dict_string(d, "name", r->name);
> + rte_tel_data_add_dict_int(d, "socket", r->memzone->socket_id);
> + rte_tel_data_add_dict_int(d, "flags", r->flags);
> + rte_tel_data_add_dict_string(d, "producer_type",
> + ring_prod_sync_type_to_name(r));
> + rte_tel_data_add_dict_string(d, "consumer_type",
> + ring_cons_sync_type_to_name(r));
> + rte_tel_data_add_dict_u64(d, "size", r->size);
> + rte_tel_data_add_dict_u64(d, "mask", r->mask);
> + rte_tel_data_add_dict_u64(d, "capacity", r->capacity);
> + rte_tel_data_add_dict_u64(d, "used_count", rte_ring_count(r));
> + rte_tel_data_add_dict_u64(d, "consumer_tail", r->cons.tail);
> + rte_tel_data_add_dict_u64(d, "consumer_head", r->cons.head);
> + rte_tel_data_add_dict_u64(d, "producer_tail", r->prod.tail);
> + rte_tel_data_add_dict_u64(d, "producer_head", r->prod.head);
> +
> + mz = r->memzone;
> + if (mz == NULL)
> + return 0;
> + rte_tel_data_add_dict_string(d, "mz_name", mz->name);
> + rte_tel_data_add_dict_int(d, "mz_len", mz->len);
> + rte_tel_data_add_dict_int(d, "mz_hugepage_sz", mz->hugepage_sz);
> + rte_tel_data_add_dict_int(d, "mz_socket_id", mz->socket_id);
> + rte_tel_data_add_dict_int(d, "mz_flags", mz->flags);
> +
> + rte_mcfg_tailq_read_unlock();
> + return 0;
> +}
> +
> RTE_INIT(ring_init_telemetry)
> {
> rte_telemetry_register_cmd("/ring/list", ring_handle_list,
> "Returns list of available ring. Takes no parameters");
> + rte_telemetry_register_cmd("/ring/info", ring_handle_info,
> + "Returns ring info. Parameters: ring_name.");
> }
> --
> 2.33.0
next prev parent reply other threads:[~2023-01-31 16:44 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 9:10 [PATCH 0/2] add ring telemetry cmds Jie Hai
2023-01-17 9:10 ` [PATCH 1/2] ring: add ring list telemetry cmd Jie Hai
2023-01-17 9:10 ` [PATCH 2/2] ring: add ring info " Jie Hai
2023-01-17 13:03 ` [PATCH v2 0/2] add ring telemetry cmds Jie Hai
2023-01-17 13:03 ` [PATCH v2 1/2] ring: add ring list telemetry cmd Jie Hai
2023-01-22 16:40 ` Konstantin Ananyev
2023-01-31 3:09 ` Jie Hai
2023-01-17 13:03 ` [PATCH v2 2/2] ring: add ring info " Jie Hai
2023-01-22 17:49 ` Konstantin Ananyev
2023-01-31 3:11 ` Jie Hai
2023-01-31 2:28 ` [PATCH v3 0/2] add ring telemetry cmds Jie Hai
2023-01-31 2:28 ` [PATCH v3 1/2] ring: add ring list telemetry cmd Jie Hai
2023-01-31 16:44 ` Honnappa Nagarahalli
2023-02-03 7:20 ` Jie Hai
2023-01-31 2:28 ` [PATCH v3 2/2] ring: add ring info " Jie Hai
2023-01-31 16:44 ` Honnappa Nagarahalli [this message]
2023-02-03 7:04 ` Jie Hai
2023-02-02 13:07 ` Konstantin Ananyev
2023-02-03 7:28 ` Jie Hai
2023-02-10 2:48 ` [PATCH v4 0/3] add telemetry cmds for ring Jie Hai
2023-02-10 2:48 ` [PATCH v4 1/3] ring: fix unmatched type definition and usage Jie Hai
2023-02-10 2:48 ` [PATCH v4 2/3] ring: add telemetry cmd to list rings Jie Hai
2023-02-16 6:56 ` lihuisong (C)
2023-02-10 2:48 ` [PATCH v4 3/3] ring: add telemetry cmd for ring info Jie Hai
2023-02-14 23:13 ` Konstantin Ananyev
2023-02-16 6:54 ` lihuisong (C)
2023-02-20 12:55 ` David Marchand
2023-06-20 8:14 ` Jie Hai
2023-06-20 14:34 ` Thomas Monjalon
2023-07-04 8:04 ` Jie Hai
2023-07-04 14:11 ` Thomas Monjalon
2023-07-06 8:52 ` David Marchand
2023-07-07 2:18 ` Jie Hai
2023-02-15 3:04 ` [PATCH v4 0/3] add telemetry cmds for ring fengchengwen
2023-05-09 1:29 ` [PATCH v5 " Jie Hai
2023-05-09 1:29 ` [PATCH v5 1/3] ring: fix unmatched type definition and usage Jie Hai
2023-05-09 6:23 ` Ruifeng Wang
2023-05-09 8:15 ` Jie Hai
2023-05-09 1:29 ` [PATCH v5 2/3] ring: add telemetry cmd to list rings Jie Hai
2023-05-09 1:29 ` [PATCH v5 3/3] ring: add telemetry cmd for ring info Jie Hai
2023-05-09 6:50 ` Morten Brørup
2023-05-09 9:24 ` [PATCH v6 0/3] add telemetry cmds for ring Jie Hai
2023-05-09 9:24 ` [PATCH v6 1/3] ring: fix unmatched type definition and usage Jie Hai
2023-05-09 9:24 ` [PATCH v6 2/3] ring: add telemetry cmd to list rings Jie Hai
2023-05-09 9:24 ` [PATCH v6 3/3] ring: add telemetry cmd for ring info Jie Hai
2023-05-30 9:27 ` [PATCH v6 0/3] add telemetry cmds for ring Jie Hai
2023-06-12 14:54 ` Thomas Monjalon
2023-10-28 9:48 ` Jie Hai
2023-07-04 9:04 ` [PATCH v7 " Jie Hai
2023-07-04 9:04 ` [PATCH v7 1/3] ring: fix unmatched type definition and usage Jie Hai
2023-07-04 9:04 ` [PATCH v7 2/3] ring: add telemetry cmd to list rings Jie Hai
2023-07-04 9:04 ` [PATCH v7 3/3] ring: add telemetry cmd for ring info Jie Hai
2023-08-18 6:53 ` [PATCH v7 0/3] add telemetry cmds for ring Jie Hai
2023-09-12 1:52 ` Jie Hai
2023-10-10 2:25 ` Jie Hai
2023-10-25 1:22 ` Jie Hai
2023-10-28 9:50 ` Jie Hai
2023-11-08 2:55 ` lihuisong (C)
2023-11-09 10:20 ` [RESEND " Jie Hai
2023-11-09 10:20 ` [RESEND v7 1/3] ring: fix unmatched type definition and usage Jie Hai
2023-11-09 12:26 ` lihuisong (C)
2024-02-18 18:11 ` Thomas Monjalon
2024-02-19 8:24 ` Jie Hai
2023-11-09 10:20 ` [RESEND v7 2/3] ring: add telemetry cmd to list rings Jie Hai
2023-11-09 12:26 ` lihuisong (C)
2023-11-09 10:20 ` [RESEND v7 3/3] ring: add telemetry cmd for ring info Jie Hai
2023-11-09 12:27 ` lihuisong (C)
2024-01-27 8:33 ` [RESEND v7 0/3] add telemetry cmds for ring Jie Hai
2024-02-19 8:32 ` [PATCH v8 0/2] " Jie Hai
2024-02-19 8:32 ` [PATCH v8 1/2] ring: add telemetry cmd to list rings Jie Hai
2024-02-19 8:32 ` [PATCH v8 2/2] ring: add telemetry cmd for ring info Jie Hai
2024-02-19 10:09 ` [PATCH v8 0/2] add telemetry cmds for ring Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DBAPR08MB581415F0FD82DD7AFA7B2B2498D09@DBAPR08MB5814.eurprd08.prod.outlook.com \
--to=honnappa.nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=haijie1@huawei.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=liudongdong3@huawei.com \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).