[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d40cc960-f12e-4177-83d5-b573de41ed4c@gmail.com>
Date: Sat, 9 Nov 2024 10:34:55 -0700
From: David Ahern <dsahern@...il.com>
To: Chiara Meiohas <cmeioahs@...dia.com>, leonro@...dia.com
Cc: linux-rdma@...r.kernel.org, netdev@...r.kernel.org, jgg@...dia.com,
stephen@...workplumber.org, Chiara Meiohas <cmeiohas@...dia.com>,
Mark Bloch <mbloch@...dia.com>
Subject: Re: [PATCH v2 iproute2-next 1/5] rdma: Add support for rdma monitor
On 11/7/24 1:02 AM, Chiara Meiohas wrote:
> diff --git a/rdma/monitor.c b/rdma/monitor.c
> new file mode 100644
> index 00000000..0a2d3053
> --- /dev/null
> +++ b/rdma/monitor.c
> @@ -0,0 +1,169 @@
> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> +/*
> + * monitor.c RDMA tool
> + * Authors: Chiara Meiohas <cmeiohas@...dia.com>
> + */
> +
> +#include "rdma.h"
> +
> +/* Global utils flags */
> +extern int json;
use include utils.h instead
> +
> +static void mon_print_event_type(struct nlattr **tb)
> +{
> + static const char *const event_types_str[] = {
> + "[REGISTER]",
> + "[UNREGISTER]",
> + "[NETDEV_ATTACH]",
> + "[NETDEV_DETACH]",
> + };
> + enum rdma_nl_notify_event_type etype;
> + static char unknown_type[32];
why static?
> +
> + if (!tb[RDMA_NLDEV_ATTR_EVENT_TYPE])
> + return;
> +
> + etype = mnl_attr_get_u8(tb[RDMA_NLDEV_ATTR_EVENT_TYPE]);
> + if (etype < ARRAY_SIZE(event_types_str)) {
> + print_string(PRINT_ANY, "event_type", "%s\t",
> + event_types_str[etype]);
> + } else {
> + snprintf(unknown_type, sizeof(unknown_type), "[UNKNOWN 0x%02x]", etype);
wrap at about 80 columns; in this case etype should go on the next line
Powered by blists - more mailing lists