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@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>
Subject: Re: [PATCH net-next v1 7/7] ethtool: add interface to interact with Ethernet Power Equipment
Date: Sun, 21 Aug 2022 06:39:32 +0200	[thread overview]
Message-ID: <20220821043932.GJ10138@pengutronix.de> (raw)
In-Reply-To: <YwEk8h9C9XhT6Yyc@lunn.ch>

On Sat, Aug 20, 2022 at 08:16:18PM +0200, Andrew Lunn wrote:
> On Fri, Aug 19, 2022 at 02:01:09PM +0200, Oleksij Rempel wrote:
> > Add interface to support Power Sourcing Equipment. At current step it
> > provides generic way to address all variants of PSE devices as defined
> > in IEEE 802.3-2018 but support only objects specified for IEEE 802.3-2018 104.4
> > PoDL Power Sourcing Equipment (PSE).
> > 
> > Currently supported and mandatory objects are:
> > IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus
> > IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
> > IEEE 802.3-2018 30.15.1.2.1 acPoDLPSEAdminControl
> > 
> > This is minimal interface needed to control PSE on each separate
> > ethernet port but it provides not all mandatory objects specified in
> > IEEE 802.3-2018.
> 
> > +static int pse_get_pse_attributs(struct net_device *dev,
> > +				 struct pse_reply_data *data)
> > +{
> > +	struct phy_device *phydev = dev->phydev;
> > +	int ret;
> > +
> > +	if (!phydev)
> > +		return -EOPNOTSUPP;
> > +
> > +	mutex_lock(&phydev->lock);
> > +	if (!phydev->psec) {
> > +		ret = -EOPNOTSUPP;
> > +		goto error_unlock;
> > +	}
> > +
> > +	ret = pse_podl_get_admin_sate(phydev->psec);
> > +	if (ret < 0)
> > +		goto error_unlock;
> > +
> > +	data->podl_pse_admin_state = ret;
> > +
> > +	ret = pse_podl_get_pw_d_status(phydev->psec);
> > +	if (ret < 0)
> > +		goto error_unlock;
> > +
> > +	data->podl_pse_pw_d_status = ret;
> 
> I'm wondering how this is going to scale. At some point, i expect
> there will be an implementation that follows C45.2.9. I see 14 values
> which could be returned. I don't think 14 ops in the driver structure
> makes sense. Plus c30.15.1 defines other values.
> 
> The nice thing about netlink is you can have as many or are little
> attributes in the message as you want. For cable testing, i made use
> of this. There is no standardisation, different PHYs offer different
> sorts of results. So i made the API flexible. The PHY puts whatever
> results it has into the message, and ethtool(1) just walks the message
> and prints what is in it.
> 
> I'm wondering if we want a similar sort of API here?
> net/ethtool/pse-pd.c allocates the netlink messages, adds the header,
> and then passes it to the driver. The driver then uses helpers from
> ethtool to add whatever attributes it wants to the message. pse-pd
> then completes the message, and returns it to user space? This seems
> like it will scale better.

Yes. Sounds good. I'll make a new version.

Regards,
Oleksij
-- 
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-21  4:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 12:01 [PATCH net-next v1 0/7] add generic PSE support Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 1/7] dt-bindings: net: pse-dt: add bindings for generic PSE controller Oleksij Rempel
2022-08-22 18:41   ` Rob Herring
2022-08-23 16:22     ` Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 2/7] dt-bindings: net: phy: add PoDL PSE property Oleksij Rempel
2022-08-22 18:45   ` Rob Herring
2022-08-22 19:34     ` Andrew Lunn
2022-08-23 14:44       ` Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 3/7] net: add framework to support Ethernet PSE and PDs devices Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 4/7] net: pse-pd: add generic PSE driver Oleksij Rempel
2022-08-19 20:54   ` Andrew Lunn
2022-08-20 12:00     ` Oleksij Rempel
2022-08-19 21:32   ` Andrew Lunn
2022-08-20 12:10     ` Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 5/7] net: mdiobus: fwnode_mdiobus_register_phy() rework error handling Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 6/7] net: mdiobus: search for PSE nodes by parsing PHY nodes Oleksij Rempel
2022-08-19 12:01 ` [PATCH net-next v1 7/7] ethtool: add interface to interact with Ethernet Power Equipment Oleksij Rempel
2022-08-19 16:44   ` kernel test robot
2022-08-19 18:37   ` kernel test robot
2022-08-19 21:15   ` Andrew Lunn
2022-08-20 12:31     ` Oleksij Rempel
2022-08-20  3:08   ` Bagas Sanjaya
2022-08-20 18:16   ` Andrew Lunn
2022-08-21  4:39     ` Oleksij Rempel [this message]
2022-08-20 18:48   ` Andrew Lunn

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=20220821043932.GJ10138@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=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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).