devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	kernel test robot <lkp@intel.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, David Jander <david@protonic.nl>,
	Luka Perkov <luka.perkov@sartura.hr>,
	Robert Marko <robert.marko@sartura.hr>
Subject: Re: [PATCH net-next v3 6/7] ethtool: add interface to interact with Ethernet Power Equipment
Date: Sun, 28 Aug 2022 08:16:28 +0200	[thread overview]
Message-ID: <20220828061628.GA26078@pengutronix.de> (raw)
In-Reply-To: <Ywpkqt2pDmpzXWWn@lunn.ch>

On Sat, Aug 27, 2022 at 08:38:34PM +0200, Andrew Lunn wrote:
> > +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.

this values are already validate by the ethnl_pse_set_policy

> 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?

ack. changed to 0 and added comment.

> ETHTOOL_A_PODL_PSE_ADMIN_CONTROL_UNKNOWN
> however seems invalid and so should be rejected here?

yes. it is already rejected. I added comment to make it more visible

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2022-08-28  6:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-27  5:10 [PATCH net-next v3 0/7] add generic PSE support Oleksij Rempel
2022-08-27  5:10 ` [PATCH net-next v3 1/7] dt-bindings: net: pse-dt: add bindings for generic PSE controller Oleksij Rempel
2022-08-27  5:10 ` [PATCH net-next v3 2/7] dt-bindings: net: phy: add PoDL PSE property Oleksij Rempel
2022-08-27 16:38   ` Andrew Lunn
2022-08-27  5:10 ` [PATCH net-next v3 3/7] net: add framework to support Ethernet PSE and PDs devices Oleksij Rempel
2022-08-27 16:40   ` Andrew Lunn
2022-08-27  5:10 ` [PATCH net-next v3 4/7] net: mdiobus: fwnode_mdiobus_register_phy() rework error handling Oleksij Rempel
2022-08-27 16:41   ` Andrew Lunn
2022-08-27  5:10 ` [PATCH net-next v3 5/7] net: mdiobus: search for PSE nodes by parsing PHY nodes Oleksij Rempel
2022-08-27 16:46   ` Andrew Lunn
2022-08-27  5:10 ` [PATCH net-next v3 6/7] ethtool: add interface to interact with Ethernet Power Equipment Oleksij Rempel
2022-08-27 16:51   ` Andrew Lunn
2022-08-27 18:38   ` Andrew Lunn
2022-08-28  6:16     ` Oleksij Rempel [this message]
2022-08-27  5:10 ` [PATCH net-next v3 7/7] net: pse-pd: add generic PSE driver Oleksij Rempel

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=20220828061628.GA26078@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=david@protonic.nl \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lkp@intel.com \
    --cc=luka.perkov@sartura.hr \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).