linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Herve Codina" <herve.codina@bootlin.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Köry Maincent" <kory.maincent@bootlin.com>,
	"Jesse Brandeburg" <jesse.brandeburg@intel.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Piergiorgio Beruto" <piergiorgio.beruto@gmail.com>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Nicolò Veronese" <nicveronese@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	mwojtas@chromium.org, "Nathan Chancellor" <nathan@kernel.org>,
	"Antoine Tenart" <atenart@kernel.org>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Dan Carpenter" <dan.carpenter@linaro.org>
Subject: Re: [PATCH net-next v15 07/14] net: ethtool: Introduce a command to list PHYs on an interface
Date: Wed, 3 Jul 2024 15:52:12 +0100	[thread overview]
Message-ID: <ZoVlnLkXuJ0J/da3@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240703140806.271938-8-maxime.chevallier@bootlin.com>

On Wed, Jul 03, 2024 at 04:07:57PM +0200, Maxime Chevallier wrote:
> +static int
> +ethnl_phy_fill_reply(const struct ethnl_req_info *req_base, struct sk_buff *skb)
> +{
> +	struct phy_req_info *req_info = PHY_REQINFO(req_base);
> +	struct phy_device_node *pdn = req_info->pdn;
> +	struct phy_device *phydev = pdn->phy;
> +	enum phy_upstream ptype;
> +
> +	ptype = pdn->upstream_type;
> +
> +	if (nla_put_u32(skb, ETHTOOL_A_PHY_INDEX, phydev->phyindex) ||
> +	    nla_put_string(skb, ETHTOOL_A_PHY_NAME, dev_name(&phydev->mdio.dev)) ||
> +	    nla_put_u32(skb, ETHTOOL_A_PHY_UPSTREAM_TYPE, ptype) ||
> +	    nla_put_u32(skb, ETHTOOL_A_PHY_ID, phydev->phy_id))
> +		return -EMSGSIZE;

I'm really not sure that it is a good idea to export phydev->phy_id
through this API.

Clause 45-only PHYs don't have a phy_id, they have a whole bunch of
IDs (actually, two per MMD - a device ID and a package ID. I think
the package ID is supposed to be the same for all MMDs, but in
practice it isn't.

For example, 88x3310 uses:

MMD	devid		pkgid
1	002b09aa	002b09aa
3	002b09aa	002b09aa
4	01410daa	01410daa
7	002b09aa	002b09aa

So, if we want to report the ID of the PHY, then really we need to
report the clause 22 ID, and at least all the devids of each MMD in
a clause 45 PHY. Alternatively, we may decide it isn't worth the
effort of reporting any of these IDs.

However, reporting just the clause 22 ID would be a design error
IMHO.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


  reply	other threads:[~2024-07-03 14:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 14:07 [PATCH net-next v15 00/14] Introduce PHY listing and link_topology tracking Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 01/14] net: phy: Introduce ethernet link topology representation Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 02/14] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 03/14] net: phy: add helpers to handle sfp phy connect/disconnect Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 04/14] net: sfp: Add helper to return the SFP bus name Maxime Chevallier
2024-07-03 15:36   ` Russell King (Oracle)
2024-07-04  8:04     ` Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 05/14] net: ethtool: Allow passing a phy index for some commands Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 06/14] netlink: specs: add phy-index as a header parameter Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 07/14] net: ethtool: Introduce a command to list PHYs on an interface Maxime Chevallier
2024-07-03 14:52   ` Russell King (Oracle) [this message]
2024-07-04  8:03     ` Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 08/14] netlink: specs: add ethnl PHY_GET command set Maxime Chevallier
2024-07-03 14:07 ` [PATCH net-next v15 09/14] net: ethtool: plca: Target the command to the requested PHY Maxime Chevallier
2024-07-03 14:08 ` [PATCH net-next v15 10/14] net: ethtool: pse-pd: " Maxime Chevallier
2024-07-03 14:08 ` [PATCH net-next v15 11/14] net: ethtool: cable-test: " Maxime Chevallier
2024-07-03 14:08 ` [PATCH net-next v15 12/14] net: ethtool: strset: Remove unnecessary check on genl_info Maxime Chevallier
2024-07-03 14:08 ` [PATCH net-next v15 13/14] net: ethtool: strset: Allow querying phy stats by index Maxime Chevallier
2024-07-03 14:08 ` [PATCH net-next v15 14/14] Documentation: networking: document phy_link_topology Maxime Chevallier

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=ZoVlnLkXuJ0J/da3@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=atenart@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kabel@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mkl@pengutronix.de \
    --cc=mwojtas@chromium.org \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=piergiorgio.beruto@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.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;
as well as URLs for NNTP newsgroup(s).