[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250813152240.3b6e7708@kmaincent-XPS-13-7390>
Date: Wed, 13 Aug 2025 15:22:40 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>, Michal Kubecek
<mkubecek@...e.cz>, Dent Project <dentproject@...uxfoundation.org>, Kyle
Swenson <kyle.swenson@....tech>, Thomas Petazzoni
<thomas.petazzoni@...tlin.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event
monitoring support
Le Wed, 13 Aug 2025 14:44:27 +0200,
Oleksij Rempel <o.rempel@...gutronix.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
Powered by blists - more mailing lists