From: Jakub Kicinski <kuba@kernel.org>
To: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Cc: netdev@vger.kernel.org,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Jacob Keller <jacob.e.keller@intel.com>,
Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>, Gal Pressman <gal@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Carolina Jubran <cjubran@nvidia.com>,
Cosmin Ratiu <cratiu@nvidia.com>,
Michal Kubecek <mkubecek@suse.cz>
Subject: Re: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
Date: Tue, 16 Apr 2024 17:07:42 -0700 [thread overview]
Message-ID: <20240416170742.4ebbb130@kernel.org> (raw)
In-Reply-To: <20240416203723.104062-3-rrameshbabu@nvidia.com>
On Tue, 16 Apr 2024 13:37:17 -0700 Rahul Rameshbabu wrote:
> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
> + is_u64 = true;
> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
> + fprintf(stderr, "malformed netlink message (statistic)\n");
> + goto err_close_stats;
> + }
> + }
possibly cleaner:
__u64 val;
if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
val = mnl_attr_get_u32(tb[stats[i].attr]);
} else if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
val = mnl_attr_get_u64(tb[stats[i].attr]);
} else {
fprintf(stderr, "malformed netlink message (statistic)\n");
goto err_close_stats;
}
next prev parent reply other threads:[~2024-04-17 0:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 20:37 [PATCH ethtool-next 0/2] Userspace code for ethtool HW TS statistics Rahul Rameshbabu
2024-04-16 20:37 ` [PATCH ethtool-next 1/2] update UAPI header copies Rahul Rameshbabu
2024-04-17 7:55 ` Alexandra Winter
2024-04-17 17:53 ` Rahul Rameshbabu
2024-04-17 18:31 ` Keller, Jacob E
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
2024-04-16 22:08 ` Keller, Jacob E
2024-04-17 0:07 ` Jakub Kicinski [this message]
2024-04-17 1:25 ` Rahul Rameshbabu
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=20240416170742.4ebbb130@kernel.org \
--to=kuba@kernel.org \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jacob.e.keller@intel.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rrameshbabu@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=vadim.fedorenko@linux.dev \
/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).