All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	Andrew Lunn <andrew@lunn.ch>, Conor Dooley <conor+dt@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	devicetree@vger.kernel.org, netdev@vger.kernel.org,
	openbmc@lists.ozlabs.org,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Rob Herring <robh+dt@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Eric Dumazet <edumazet@google.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org,
	Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: [PATCH net-next 06/16] net: pcs: xpcs: Avoid creating dummy XPCS MDIO device
Date: Tue, 19 Dec 2023 18:28:03 +0200	[thread overview]
Message-ID: <20231219162803.kmb3jb6aevef3kj3@skbuf> (raw)
In-Reply-To: <jlcyqvcw5hsjtmvf77sm7qni6tzihxudo6baoq7wi7zgqx3lvs@ykbsxgmjkvnf>

On Tue, Dec 19, 2023 at 06:48:09PM +0300, Serge Semin wrote:
> > > Sorry, because the commit log lost me at the "context presentation" stage,
> > > I failed to understand the "what"s and the "why"s.
> > > 
> > > Are you basically trying to add xpcs support on top of an mdio_device
> > > where the mdio_device_create() call was made externally to the xpcs code,
> > > through mdiobus_register_board_info() and mdiobus_setup_mdiodev_from_board_info()?
> > 
> > Basically yes, but there is more of it. The main idea is to convert
> > the XPCS driver to using the already created non-PHY MDIO-devices
> > instead of manually creating a 'dummy'/'redundant' one. From my point
> > of view there are several reasons of doing so:
> > 
> > 1. mdiobus_register_board_info() provides a way to assign the device
> > platform data to being registered afterwards device. Thus we can pass
> > some custom data to the XPCS-device driver (whether it's just an
> > xpcs_create_*() call or a fully functional MDIO-device driver
> > registered by the mdio_driver_register() method). For instance it can
> > be utilized to drop the fake PHYSIDs implementation from
> > drivers/net/dsa/sja1105/sja1105_mdio.c .

Ok. Seeing an alternative to the NXP_SJA1110_XPCS_ID hack will be interesting.

FWIW, I'm looking at reworking the dsa_loop probing to use software nodes.
Since dsa_loop is the only current user of mdiobus_register_board_info(),
maybe that will lead to its deletion. It appears a matter of timing, but
the mechanism looks promising.

Maybe we can also use it somehow to add compatibility with existing
lynx-pcs device trees where there is no compatible string, so a struct
phy_device gets created. Device tree breakage was the fundamental reason
why Sean Anderson's patch set couldn't make forward progress.
https://patchwork.kernel.org/project/netdevbpf/cover/20221103210650.2325784-1-sean.anderson@seco.com/

> > 2. The MDIO-devices actually registered on the MDIO-bus will be
> > visible in sysfs with for instance useful IO statistics provided by
> > the MDIO-bus. Potentially (if it is required) at some point we'll be
> > able to convert the DW XPCS driver to being true MDIO-device driver
> > (bindable to the DW XPCS device) with less efforts.

Ok.

> > 3. Having an MDIO-device registered that way would make the DW XPCS
> > IO-device implementation unified after the fwnode-based XPCS
> > descriptor creation support is added in one of the subsequent patches.

Unified how? You mean that "XPCS will always operate as a driver bound
to an mdio_device"?

You're not planning to unify the mdio_device and MMIO register handling
by using regmap, right?

> > So based on the listed above I've got a question. Do you think all of
> > that is worth to be implemented? Andrew, Russell?
> > 
> > I am asking because the patchset advance depends on your answers. If
> > you do I'll need to fix the problem described in my first message,
> > implement some new mdiobus_register_board_info()-like but
> > MDIO-bus-specific interface function (so MDIO-device infos would be
> > attached to the allocated MDIO-bus and then used to register the
> > respective MDIO-devices on the MDIO-bus registration), then convert
> > the sja1105 and wangxun txgbe drivers to using it. If you don't I'll
> > get back the xpcs_create_mdiodev() implementation and just provide a
> > fwnode-based version of one.
> 
> Folks, this is the only issue left to settle so I could move on with
> the series fixing up. So the question is: taking my comment above into
> account is it worth to convert the xpcs_create_mdiodev() method to
> re-using the already registered MDIO-device instance instead of
> always creating a stub-like MDIO-device?

I can't exactly say "yes, this is worth it", because it also depends on
what the phylib/phylink maintainers say. So I haven't said anything.
But I also don't have any objection, as long as the conversion doesn't
break existing setups (in new ways; see the "unbind MDIO bus driver"
case which is already problematic).

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Oltean <olteanv@gmail.com>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Russell King <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	openbmc@lists.ozlabs.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 06/16] net: pcs: xpcs: Avoid creating dummy XPCS MDIO device
Date: Tue, 19 Dec 2023 18:28:03 +0200	[thread overview]
Message-ID: <20231219162803.kmb3jb6aevef3kj3@skbuf> (raw)
In-Reply-To: <jlcyqvcw5hsjtmvf77sm7qni6tzihxudo6baoq7wi7zgqx3lvs@ykbsxgmjkvnf>

On Tue, Dec 19, 2023 at 06:48:09PM +0300, Serge Semin wrote:
> > > Sorry, because the commit log lost me at the "context presentation" stage,
> > > I failed to understand the "what"s and the "why"s.
> > > 
> > > Are you basically trying to add xpcs support on top of an mdio_device
> > > where the mdio_device_create() call was made externally to the xpcs code,
> > > through mdiobus_register_board_info() and mdiobus_setup_mdiodev_from_board_info()?
> > 
> > Basically yes, but there is more of it. The main idea is to convert
> > the XPCS driver to using the already created non-PHY MDIO-devices
> > instead of manually creating a 'dummy'/'redundant' one. From my point
> > of view there are several reasons of doing so:
> > 
> > 1. mdiobus_register_board_info() provides a way to assign the device
> > platform data to being registered afterwards device. Thus we can pass
> > some custom data to the XPCS-device driver (whether it's just an
> > xpcs_create_*() call or a fully functional MDIO-device driver
> > registered by the mdio_driver_register() method). For instance it can
> > be utilized to drop the fake PHYSIDs implementation from
> > drivers/net/dsa/sja1105/sja1105_mdio.c .

Ok. Seeing an alternative to the NXP_SJA1110_XPCS_ID hack will be interesting.

FWIW, I'm looking at reworking the dsa_loop probing to use software nodes.
Since dsa_loop is the only current user of mdiobus_register_board_info(),
maybe that will lead to its deletion. It appears a matter of timing, but
the mechanism looks promising.

Maybe we can also use it somehow to add compatibility with existing
lynx-pcs device trees where there is no compatible string, so a struct
phy_device gets created. Device tree breakage was the fundamental reason
why Sean Anderson's patch set couldn't make forward progress.
https://patchwork.kernel.org/project/netdevbpf/cover/20221103210650.2325784-1-sean.anderson@seco.com/

> > 2. The MDIO-devices actually registered on the MDIO-bus will be
> > visible in sysfs with for instance useful IO statistics provided by
> > the MDIO-bus. Potentially (if it is required) at some point we'll be
> > able to convert the DW XPCS driver to being true MDIO-device driver
> > (bindable to the DW XPCS device) with less efforts.

Ok.

> > 3. Having an MDIO-device registered that way would make the DW XPCS
> > IO-device implementation unified after the fwnode-based XPCS
> > descriptor creation support is added in one of the subsequent patches.

Unified how? You mean that "XPCS will always operate as a driver bound
to an mdio_device"?

You're not planning to unify the mdio_device and MMIO register handling
by using regmap, right?

> > So based on the listed above I've got a question. Do you think all of
> > that is worth to be implemented? Andrew, Russell?
> > 
> > I am asking because the patchset advance depends on your answers. If
> > you do I'll need to fix the problem described in my first message,
> > implement some new mdiobus_register_board_info()-like but
> > MDIO-bus-specific interface function (so MDIO-device infos would be
> > attached to the allocated MDIO-bus and then used to register the
> > respective MDIO-devices on the MDIO-bus registration), then convert
> > the sja1105 and wangxun txgbe drivers to using it. If you don't I'll
> > get back the xpcs_create_mdiodev() implementation and just provide a
> > fwnode-based version of one.
> 
> Folks, this is the only issue left to settle so I could move on with
> the series fixing up. So the question is: taking my comment above into
> account is it worth to convert the xpcs_create_mdiodev() method to
> re-using the already registered MDIO-device instance instead of
> always creating a stub-like MDIO-device?

I can't exactly say "yes, this is worth it", because it also depends on
what the phylib/phylink maintainers say. So I haven't said anything.
But I also don't have any objection, as long as the conversion doesn't
break existing setups (in new ways; see the "unbind MDIO bus driver"
case which is already problematic).

  reply	other threads:[~2023-12-19 16:29 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 10:35 [PATCH net-next 00/16] net: pcs: xpcs: Add memory-based management iface support Serge Semin
2023-12-05 10:35 ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 01/16] net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 11:24   ` Vladimir Oltean
2023-12-05 11:24     ` Vladimir Oltean
2023-12-05 11:39     ` Serge Semin
2023-12-05 11:39       ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 02/16] net: pcs: xpcs: Drop redundant workqueue.h include directive Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 13:34   ` Andrew Lunn
2023-12-05 13:34     ` Andrew Lunn
2023-12-05 10:35 ` [PATCH net-next 03/16] net: pcs: xpcs: Return EINVAL in the internal methods Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 13:34   ` Andrew Lunn
2023-12-05 13:34     ` Andrew Lunn
2023-12-05 10:35 ` [PATCH net-next 04/16] net: pcs: xpcs: Explicitly return error on caps validation Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 05/16] net: pcs: xpcs: Move native device ID macro to linux/pcs/pcs-xpcs.h Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:45   ` Russell King (Oracle)
2023-12-05 10:45     ` Russell King (Oracle)
2023-12-05 11:14     ` Serge Semin
2023-12-05 11:14       ` Serge Semin
2023-12-05 11:22       ` Russell King (Oracle)
2023-12-05 11:22         ` Russell King (Oracle)
2023-12-05 11:48         ` Serge Semin
2023-12-05 11:48           ` Serge Semin
2023-12-05 11:27   ` Vladimir Oltean
2023-12-05 11:27     ` Vladimir Oltean
2023-12-05 11:49     ` Serge Semin
2023-12-05 11:49       ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 06/16] net: pcs: xpcs: Avoid creating dummy XPCS MDIO device Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:49   ` Russell King (Oracle)
2023-12-05 10:49     ` Russell King (Oracle)
2023-12-05 11:31     ` Serge Semin
2023-12-05 11:31       ` Serge Semin
2023-12-05 13:31       ` Russell King (Oracle)
2023-12-05 13:31         ` Russell King (Oracle)
2023-12-05 13:52       ` Andrew Lunn
2023-12-05 13:52         ` Andrew Lunn
2023-12-05 14:50         ` Russell King (Oracle)
2023-12-05 14:50           ` Russell King (Oracle)
2023-12-12 13:52           ` Serge Semin
2023-12-12 13:52             ` Serge Semin
2023-12-05 11:52   ` Vladimir Oltean
2023-12-05 11:52     ` Vladimir Oltean
2023-12-13 15:27     ` Serge Semin
2023-12-13 15:27       ` Serge Semin
2023-12-19 15:48       ` Serge Semin
2023-12-19 15:48         ` Serge Semin
2023-12-19 16:28         ` Vladimir Oltean [this message]
2023-12-19 16:28           ` Vladimir Oltean
2023-12-19 21:48           ` Serge Semin
2023-12-19 21:48             ` Serge Semin
2023-12-05 13:46   ` Russell King (Oracle)
2023-12-05 13:46     ` Russell King (Oracle)
2023-12-05 14:54     ` Russell King (Oracle)
2023-12-05 14:54       ` Russell King (Oracle)
2023-12-12 15:26       ` Serge Semin
2023-12-12 15:26         ` Serge Semin
2023-12-12 19:06         ` Russell King (Oracle)
2023-12-12 19:06           ` Russell King (Oracle)
2023-12-13 15:47           ` Serge Semin
2023-12-13 15:47             ` Serge Semin
2023-12-13  0:01     ` Serge Semin
2023-12-13  0:01       ` Serge Semin
2023-12-13 16:32       ` Russell King (Oracle)
2023-12-13 16:32         ` Russell King (Oracle)
2023-12-14 14:19         ` Serge Semin
2023-12-14 14:19           ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 07/16] net: pcs: xpcs: Split up xpcs_create() content to sub-functions Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 08/16] dt-bindings: net: Add Synopsys DW xPCS bindings Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-14 17:40   ` Rob Herring
2023-12-14 17:40     ` Rob Herring
2023-12-14 21:27     ` Serge Semin
2023-12-14 21:27       ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 09/16] net: mdio: Add Synopsys DW XPCS management interface support Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 12:32   ` Maxime Chevallier
2023-12-05 12:32     ` Maxime Chevallier
2023-12-06 16:48     ` Serge Semin
2023-12-06 16:48       ` Serge Semin
2023-12-06 17:01       ` Andrew Lunn
2023-12-06 17:01         ` Andrew Lunn
2023-12-07 13:35         ` Serge Semin
2023-12-07 13:35           ` Serge Semin
2023-12-07 14:02           ` Russell King (Oracle)
2023-12-07 14:02             ` Russell King (Oracle)
2023-12-07 14:54           ` Andrew Lunn
2023-12-07 14:54             ` Andrew Lunn
2023-12-08 16:07             ` Serge Semin
2023-12-08 16:07               ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 10/16] net: pcs: xpcs: Add generic DW XPCS MDIO-device support Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 11:13   ` Vladimir Oltean
2023-12-05 11:13     ` Vladimir Oltean
2023-12-05 11:35     ` Serge Semin
2023-12-05 11:35       ` Serge Semin
2023-12-05 12:23       ` Vladimir Oltean
2023-12-05 12:23         ` Vladimir Oltean
2023-12-08 14:11         ` Serge Semin
2023-12-08 14:11           ` Serge Semin
2023-12-08 16:33           ` Vladimir Oltean
2023-12-08 16:33             ` Vladimir Oltean
2023-12-14 11:54             ` Serge Semin
2023-12-14 11:54               ` Serge Semin
2023-12-14 12:00               ` Vladimir Oltean
2023-12-14 12:00                 ` Vladimir Oltean
2023-12-14 12:28                 ` Serge Semin
2023-12-14 12:28                   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 11/16] net: pcs: xpcs: Change xpcs_create_mdiodev() suffix to "byaddr" Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 23:03   ` kernel test robot
2023-12-05 23:03     ` kernel test robot
2023-12-05 23:03     ` kernel test robot
2023-12-07 14:37     ` Serge Semin
2023-12-07 14:37       ` Serge Semin
2023-12-07 14:37       ` Serge Semin
2023-12-06  0:29   ` kernel test robot
2023-12-06  0:29     ` kernel test robot
2023-12-06  0:29     ` kernel test robot
2023-12-05 10:35 ` [PATCH net-next 12/16] net: pcs: xpcs: Add xpcs_create_bynode() method Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 13/16] net: stmmac: intel: Register generic MDIO device Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-06  0:19   ` kernel test robot
2023-12-06  0:19     ` kernel test robot
2023-12-06  0:19     ` kernel test robot
2023-12-07 14:47     ` Serge Semin
2023-12-07 14:47       ` Serge Semin
2023-12-07 14:47       ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 14/16] net: stmmac: Pass netdev to XPCS setup function Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 15/16] net: stmmac: Add dedicated XPCS cleanup method Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 16/16] net: stmmac: Add externally detected DW XPCS support Serge Semin
2023-12-05 10:35   ` Serge Semin
2023-12-05 10:35   ` Serge Semin

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=20231219162803.kmb3jb6aevef3kj3@skbuf \
    --to=olteanv@gmail.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=fancer.lancer@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=tmaimon77@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.