From: Kory Maincent <kory.maincent@bootlin.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>, Michal Kubecek <mkubecek@suse.cz>,
Dent Project <dentproject@linuxfoundation.org>,
Kyle Swenson <kyle.swenson@est.tech>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support
Date: Wed, 13 Aug 2025 15:22:40 +0200 [thread overview]
Message-ID: <20250813152240.3b6e7708@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <aJyIqz4T1MWuI-p9@pengutronix.de>
Le Wed, 13 Aug 2025 14:44:27 +0200,
Oleksij Rempel <o.rempel@pengutronix.de> a écrit :
> > +int pse_ntf_cb(const struct nlmsghdr *nlhdr, void *data)
> > +{
> > + const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {};
>
> s/ETHTOOL_A_PSE_MAX/ETHTOOL_A_PSE_NTF_MAX ?
Thanks, well spotted.
> > + struct nl_context *nlctx = data;
> > + DECLARE_ATTR_TB_INFO(tb);
> > + u64 val;
> > + int ret, i;
> > +
> > + ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info);
> > + if (ret < 0)
> > + return MNL_CB_OK;
> > +
> > + if (!tb[ETHTOOL_A_PSE_NTF_EVENTS])
> > + return MNL_CB_OK;
> > +
> > + nlctx->devname = get_dev_name(tb[ETHTOOL_A_PSE_HEADER]);
>
> s/ETHTOOL_A_PSE_HEADER/ETHTOOL_A_PSE_NTF_HEADER ?
Thanks, well spotted.
> > + if (!dev_ok(nlctx))
> > + return MNL_CB_OK;
> > +
> > + open_json_object(NULL);
> > + print_string(PRINT_ANY, "ifname", "PSE event for %s:\n",
> > + nlctx->devname);
> > + open_json_array("events", "Events:");
> > + val = attr_get_uint(tb[ETHTOOL_A_PSE_NTF_EVENTS]);
>
> we have here uint but val is u64, is it as expected?
Yes, same behavior in Linux using nla_put_uint().
> > + for (i = 0; 1 << i <= ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR; i++)
> > + if (val & 1 << i)
> > + print_string(PRINT_ANY, NULL, " %s",
> > + pse_events_name(val & 1 << i));
>
> Hm, may be it is better to not limit to ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR
> and report unknow numeric value. It will keep even old ethtool at least
> partially usable.
Ok, I will loop until UINT_MAX then.
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
prev parent reply other threads:[~2025-08-13 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 8:57 [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 1/3] update UAPI header copies Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support Kory Maincent
2025-08-13 12:25 ` Oleksij Rempel
2025-08-13 12:57 ` Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support Kory Maincent
2025-08-13 12:44 ` Oleksij Rempel
2025-08-13 13:22 ` Kory Maincent [this message]
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=20250813152240.3b6e7708@kmaincent-XPS-13-7390 \
--to=kory.maincent@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dentproject@linuxfoundation.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kyle.swenson@est.tech \
--cc=linux-kernel@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.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