mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	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>,
	"Russell King" <linux@armlinux.org.uk>,
	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>
Subject: [RFC PATCH net-next v2 00/10] Introduce PHY listing and link_topology tracking
Date: Fri, 17 Nov 2023 17:23:11 +0100	[thread overview]
Message-ID: <20231117162323.626979-1-maxime.chevallier@bootlin.com> (raw)

Hello everyone,

As part of the ongoing effort to better describe the ethernet link
topology, this series introduces the first step by allowing to maintain
a list of all the ethernet PHYs that are connected to a given netdevice.

For now, this can happen when using a PHY as a media converter :

   MAC - PHYa - SFP - PHYb (in SFP module)

The issue with the above is that from userspace, we can only interact
with PHYa, as it's referenced by netdev->phydev, used in PHY-specific
netlink commands. This series therefore proposes to keep track of all
PHYs, through the struct link_topology, owned by struct
net_device. Phylib is therefore registering all PHYs and information on
their parent device, through direct attachment to a MAC or as part of an
SFP bus. This is done by patches 1 to 3.

Patches 4 to 6 introduce a new netlink command to get/dump the PHYs on a
given interface, with enough information to reconstruct the whole
topology, especially if we have chained PHYs.

Patches 7 to 10 are a proposition to extend the PLCA, PSE-PD, Cabletest
and stats reporting commands to take the PHY index into account, however
I only did minimal testing on these, and I'd like feedback on the idea.

Although more complete, this is still RFC, but I have some followup
series for a better port representation that depends on it, which I can
include for next revisions, but I don't want to make the series too big.

The first RFC was much less compete, but can be found here [1].

The overall topic was presented at Netdev 0x17 [2]

Best regards,

Maxime

[1] : https://lore.kernel.org/netdev/20230907092407.647139-1-maxime.chevallier@bootlin.com/
[2] : https://bootlin.com/pub/conferences/2023/netdev/multi-port-multi-phy-interfaces.pdf

Maxime Chevallier (10):
  net: phy: Introduce ethernet link topology representation
  net: sfp: pass the phy_device when disconnecting an sfp module's PHY
  net: phy: add helpers to handle sfp phy connect/disconnect
  net: sfp: Add helper to return the SFP bus name
  net: ethtool: Allow passing a phy index for some commands
  net: ethtool: Introduce a command to list PHYs on an interface
  net: ethtool: plca: Target the command to the requested PHY
  net: ethtool: pse-pd: Target the command to the requested PHY
  net: ethtool: cable-test: Target the command to the requested PHY
  net: ethtool: strset: Allow querying phy stats by index

 Documentation/netlink/specs/ethtool.yaml     |  69 ++++-
 Documentation/networking/ethtool-netlink.rst |  51 ++++
 MAINTAINERS                                  |   1 +
 drivers/net/phy/Makefile                     |   2 +-
 drivers/net/phy/at803x.c                     |   2 +
 drivers/net/phy/link_topology.c              |  78 ++++++
 drivers/net/phy/marvell-88x2222.c            |   2 +
 drivers/net/phy/marvell.c                    |   2 +
 drivers/net/phy/marvell10g.c                 |   2 +
 drivers/net/phy/phy_device.c                 |  54 ++++
 drivers/net/phy/phylink.c                    |   3 +-
 drivers/net/phy/sfp-bus.c                    |  13 +-
 include/linux/ethtool_netlink.h              |   5 +
 include/linux/link_topology.h                |  59 ++++
 include/linux/link_topology_core.h           |  17 ++
 include/linux/netdevice.h                    |   3 +-
 include/linux/phy.h                          |   5 +
 include/linux/sfp.h                          |   8 +-
 include/uapi/linux/ethtool.h                 |   7 +
 include/uapi/linux/ethtool_netlink.h         |  30 ++
 net/core/dev.c                               |   4 +
 net/ethtool/Makefile                         |   2 +-
 net/ethtool/cabletest.c                      |  12 +-
 net/ethtool/netlink.c                        |  30 ++
 net/ethtool/netlink.h                        |  11 +-
 net/ethtool/phy.c                            | 279 +++++++++++++++++++
 net/ethtool/plca.c                           |  13 +-
 net/ethtool/pse-pd.c                         |  14 +-
 net/ethtool/strset.c                         |  15 +-
 29 files changed, 752 insertions(+), 41 deletions(-)
 create mode 100644 drivers/net/phy/link_topology.c
 create mode 100644 include/linux/link_topology.h
 create mode 100644 include/linux/link_topology_core.h
 create mode 100644 net/ethtool/phy.c

-- 
2.41.0


             reply	other threads:[~2023-11-17 15:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 16:23 Maxime Chevallier [this message]
2023-11-17 16:23 ` [RFC PATCH net-next v2 01/10] net: phy: Introduce ethernet link topology representation Maxime Chevallier
2023-11-21  0:24   ` Andrew Lunn
2023-11-23 13:34     ` Maxime Chevallier
2023-11-23 13:44     ` Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 02/10] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 03/10] net: phy: add helpers to handle sfp phy connect/disconnect Maxime Chevallier
2023-11-21  0:57   ` Andrew Lunn
2023-11-21 10:08     ` Russell King (Oracle)
2023-11-21 14:35       ` Andrew Lunn
2023-11-17 16:23 ` [RFC PATCH net-next v2 04/10] net: sfp: Add helper to return the SFP bus name Maxime Chevallier
2023-11-21  1:00   ` Andrew Lunn
2023-11-21 10:20     ` Russell King (Oracle)
2023-11-23 13:35       ` Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 05/10] net: ethtool: Allow passing a phy index for some commands Maxime Chevallier
2023-11-21  1:08   ` Andrew Lunn
2023-11-23 13:36     ` Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 06/10] net: ethtool: Introduce a command to list PHYs on an interface Maxime Chevallier
2023-11-21  1:34   ` Andrew Lunn
2023-11-21  1:40   ` Andrew Lunn
2023-11-23 13:40     ` Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 07/10] net: ethtool: plca: Target the command to the requested PHY Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 08/10] net: ethtool: pse-pd: " Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 09/10] net: ethtool: cable-test: " Maxime Chevallier
2023-11-17 16:23 ` [RFC PATCH net-next v2 10/10] net: ethtool: strset: Allow querying phy stats by index 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=20231117162323.626979-1-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®