From: Bruce Richardson <bruce.richardson@intel.com>
To: Robin Jarry <rjarry@redhat.com>
Cc: <dev@dpdk.org>, <david.marchand@redhat.com>, <ktraynor@redhat.com>
Subject: Re: [PATCH dpdk v2 1/2] telemetry: add api to register command with private argument
Date: Thu, 3 Oct 2024 12:39:11 +0100 [thread overview]
Message-ID: <Zv6CX27KLfx4uADf@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20241003112438.902397-6-rjarry@redhat.com>
On Thu, Oct 03, 2024 at 01:24:41PM +0200, Robin Jarry wrote:
> Add a new rte_telemetry_register_cmd_arg public function to register
> a telemetry endpoint with a callback that takes an additional private
> argument.
>
> This will be used in the next commit to protect ethdev endpoints with
> a lock.
>
> Update perform_command() to take a struct callback object copied from
> the list of callbacks and invoke the correct function pointer.
>
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
I like this solution, and seems a good general addition to telemetry also.
Couple of minor comments inline below.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> lib/telemetry/rte_telemetry.h | 46 +++++++++++++++++++++++++++++++++++
> lib/telemetry/telemetry.c | 38 +++++++++++++++++++++++------
> lib/telemetry/version.map | 3 +++
> 3 files changed, 79 insertions(+), 8 deletions(-)
>
> diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h
> index cab9daa6fed6..3fbfda138b16 100644
> --- a/lib/telemetry/rte_telemetry.h
> +++ b/lib/telemetry/rte_telemetry.h
> @@ -336,6 +336,30 @@ rte_tel_data_add_dict_uint_hex(struct rte_tel_data *d, const char *name,
> typedef int (*telemetry_cb)(const char *cmd, const char *params,
> struct rte_tel_data *info);
>
> +/**
> + * This telemetry callback is used when registering a telemetry command with
> + * rte_telemetry_register_cmd_arg().
> + *
> + * It handles getting and formatting information to be returned to telemetry
> + * when requested.
> + *
> + * @param cmd
> + * The cmd that was requested by the client.
> + * @param params
> + * Contains data required by the callback function.
> + * @param info
> + * The information to be returned to the caller.
> + * @param arg
> + * The opaque value that was passed to rte_telemetry_register_cmd_arg().
> + *
I think we tend to slightly indent the text on the line after the @param,
as in:
* @param arg
* The opaque value...
> + * @return
> + * Length of buffer used on success.
> + * @return
> + * Negative integer on error.
> + */
> +typedef int (*telemetry_arg_cb)(const char *cmd, const char *params,
> + struct rte_tel_data *info, void *arg);
> +
Not sure about this, but I'd tend to have the arg parameter as second
parameter, to keep the "info" as the final parameter. My suggested order
would be: (cmd, arg, params, info)
> /**
> * Used for handling data received over a telemetry socket.
> *
> @@ -367,6 +391,28 @@ typedef void * (*handler)(void *sock_id);
> int
> rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
>
<snip>
next prev parent reply other threads:[~2024-10-03 11:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 15:57 [PATCH 0/2] Fix race in ethdev telemetry David Marchand
2024-10-02 15:57 ` [PATCH 1/2] ethdev: expose telemetry dump command for Windows David Marchand
2024-10-02 15:57 ` [PATCH 2/2] ethdev: fix race on ports for telemetry commands David Marchand
2024-10-02 16:27 ` Bruce Richardson
2024-10-02 19:06 ` David Marchand
2024-10-02 19:09 ` Robin Jarry
2024-10-02 19:18 ` David Marchand
2024-10-02 19:26 ` Robin Jarry
2024-10-03 9:46 ` Bruce Richardson
2024-10-03 9:58 ` David Marchand
2024-10-03 11:24 ` [PATCH dpdk v2 0/2] Fix race in ethdev telemetry Robin Jarry
2024-10-03 11:24 ` [PATCH dpdk v2 1/2] telemetry: add api to register command with private argument Robin Jarry
2024-10-03 11:39 ` Bruce Richardson [this message]
2024-10-03 12:36 ` Robin Jarry
2024-10-03 12:43 ` Robin Jarry
2024-10-03 11:24 ` [PATCH dpdk v2 2/2] ethdev: fix potential race in telemetry endpoints Robin Jarry
2024-10-03 11:39 ` Bruce Richardson
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=Zv6CX27KLfx4uADf@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ktraynor@redhat.com \
--cc=rjarry@redhat.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).