From: Chiara Meiohas <cmeiohas@nvidia.com>
To: David Ahern <dsahern@gmail.com>,
Chiara Meiohas <cmeioahs@nvidia.com>,
leonro@nvidia.com
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
jgg@nvidia.com, stephen@networkplumber.org,
Mark Bloch <mbloch@nvidia.com>
Subject: Re: [PATCH v2 iproute2-next 1/5] rdma: Add support for rdma monitor
Date: Mon, 11 Nov 2024 10:01:41 +0200 [thread overview]
Message-ID: <f4eb75be-fefc-4a8d-96af-ea99472a54cf@nvidia.com> (raw)
In-Reply-To: <d40cc960-f12e-4177-83d5-b573de41ed4c@gmail.com>
On 09/11/2024 19:34, David Ahern wrote:
> 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@nvidia.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
I'll prepare the v3 patch with these changes.
Additionally, in the case where rdma monitor is not supported (rdma sys returns
"monitor off"), it will return an error instead of looping.
Thanks,
Chiara
next prev parent reply other threads:[~2024-11-11 8:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 8:02 [PATCH v2 iproute2-next 0/5] Add RDMA monitor support Chiara Meiohas
2024-11-07 8:02 ` [PATCH v2 iproute2-next 1/5] rdma: Add support for rdma monitor Chiara Meiohas
2024-11-09 17:34 ` David Ahern
2024-11-11 8:01 ` Chiara Meiohas [this message]
2024-11-07 8:02 ` [PATCH v2 iproute2-next 2/5] rdma: Expose whether RDMA monitoring is supported Chiara Meiohas
2024-11-07 8:02 ` [PATCH v2 iproute2-next 3/5] rdma: Fix typo in rdma-link man page Chiara Meiohas
2024-11-07 8:02 ` [PATCH v2 iproute2-next 4/5] rdma: update uapi headers Chiara Meiohas
2024-11-07 8:02 ` [PATCH v2 iproute2-next 5/5] rdma: Add IB device and net device rename events Chiara Meiohas
2024-11-07 16:24 ` [PATCH v2 iproute2-next 0/5] Add RDMA monitor support Stephen Hemminger
2024-11-07 22:37 ` Chiara Meiohas
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=f4eb75be-fefc-4a8d-96af-ea99472a54cf@nvidia.com \
--to=cmeiohas@nvidia.com \
--cc=cmeioahs@nvidia.com \
--cc=dsahern@gmail.com \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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