[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ywpkqt2pDmpzXWWn@lunn.ch>
Date: Sat, 27 Aug 2022 20:38:34 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Russell King <linux@...linux.org.uk>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jonathan Corbet <corbet@....net>,
kernel test robot <lkp@...el.com>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-doc@...r.kernel.org,
David Jander <david@...tonic.nl>,
Luka Perkov <luka.perkov@...tura.hr>,
Robert Marko <robert.marko@...tura.hr>
Subject: Re: [PATCH net-next v3 6/7] ethtool: add interface to interact with
Ethernet Power Equipment
> +static int pse_set_pse_config(struct net_device *dev,
> + struct netlink_ext_ack *extack,
> + struct nlattr **tb)
> +{
> + struct phy_device *phydev = dev->phydev;
> + struct pse_control_config config = {};
> + int ret;
> +
> + if (!tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL])
> + return -EINVAL;
I would make use of extack here, and report what is missing.
> +
> + config.admin_cotrol = nla_get_u8(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
It would be good to have some basic validation here, make sure user
space has passed a reasonable value.
You should also define what 0 and
ETHTOOL_A_PODL_PSE_ADMIN_CONTROL_UNKNOWN means here when passed in. In
future, there could be additional things which could be configured, so
struct pse_control_config gets additional members.
ETHTOOL_A_PODL_PSE_ADMIN_CONTROL appears to be mandatory, you return
-EVINAL if missing, so if you don't want to change it, but change some
other new thing, maybe 0 should be passed here? And the driver should
not consider it an error? ETHTOOL_A_PODL_PSE_ADMIN_CONTROL_UNKNOWN
however seems invalid and so should be rejected here?
Andrew
Powered by blists - more mailing lists