netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Michael Guralnik <michaelgur@nvidia.com>
Cc: <dsahern@gmail.com>, <leonro@nvidia.com>, <jgg@nvidia.com>,
	<linux-rdma@vger.kernel.org>, <netdev@vger.kernel.org>,
	Chiara Meiohas <cmeiohas@nvidia.com>
Subject: Re: [RFC iproute2-next 2/4] rdma: Add support for rdma monitor
Date: Sun, 1 Sep 2024 08:44:31 -0700	[thread overview]
Message-ID: <20240901084431.1639ff75@hermes.local> (raw)
In-Reply-To: <20240901005456.25275-3-michaelgur@nvidia.com>

On Sun, 1 Sep 2024 03:54:54 +0300
Michael Guralnik <michaelgur@nvidia.com> wrote:


Suggest these minor changes.

> +static const char *event_type_to_str(uint8_t etype)
> +{
> +	static const char *const event_types_str[] = { "[REGISTER]",
> +						       "[UNREGISTER]",
> +						       "[NETDEV_ATTACH]",
> +						       "[NETDEV_DETACH]" };

Break array initialization into:

	static const char *const event_types_str[] = {
			"[REGISTER]",
			"[UNREGISTER]"

> +	if (etype < ARRAY_SIZE(event_types_str))
> +		return event_types_str[etype];
> +
> +	return "[UNKNOWN]";

Might be useful to use snprintf to static buffer and print the hex value
for unknown events.

> +}

  reply	other threads:[~2024-09-01 15:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01  0:54 [RFC iproute2-next 0/4] Add RDMA monitor support Michael Guralnik
2024-09-01  0:54 ` [RFC iproute2-next 1/4] rdma: Update uapi header Michael Guralnik
2024-09-01  0:54 ` [RFC iproute2-next 2/4] rdma: Add support for rdma monitor Michael Guralnik
2024-09-01 15:44   ` Stephen Hemminger [this message]
2024-09-02  2:22   ` David Ahern
2024-09-02  7:54     ` Leon Romanovsky
2024-09-02 16:55       ` David Ahern
2024-09-02 18:12         ` Leon Romanovsky
2024-09-04 15:54           ` Jason Gunthorpe
2024-09-01  0:54 ` [RFC iproute2-next 3/4] rdma: Expose whether RDMA monitoring is supported Michael Guralnik
2024-09-01  0:54 ` [RFC iproute2-next 4/4] rdma: Fix typo in rdma-link man page Michael Guralnik

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=20240901084431.1639ff75@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=cmeiohas@nvidia.com \
    --cc=dsahern@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@nvidia.com \
    --cc=netdev@vger.kernel.org \
    /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).