Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	davem@davemloft.net, Andrew Lunn <andrew@lunn.ch>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Russell King <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Herve Codina" <herve.codina@bootlin.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Köry Maincent" <kory.maincent@bootlin.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Nicolò Veronese" <nicveronese@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	mwojtas@chromium.org,
	"Romain Gantois" <romain.gantois@bootlin.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Dimitri Fedrau" <dimitri.fedrau@liebherr.com>,
	"Frank Wunderlich" <frank.wunderlich@linux.dev>
Subject: Re: [PATCH net-next v13 09/10] net: ethtool: Introduce ethtool command to list ports
Date: Tue, 7 Jul 2026 12:12:53 +0200	[thread overview]
Message-ID: <aaef7304-573a-419e-b631-30b300373a08@redhat.com> (raw)
In-Reply-To: <20260701110427.143945-10-maxime.chevallier@bootlin.com>

On 7/1/26 1:04 PM, Maxime Chevallier wrote:
> Expose the phy_port information to userspace, so that we can know how
> many ports are available on a given interface, as well as their
> capabilities. For MDI ports, we report the list of supported linkmodes
> based on what the PHY that drives this port says.
> For MII ports, i.e. empty SFP cages, we report the MII linkmodes that we
> can output on this port.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
>  MAINTAINERS           |   1 +
>  net/ethtool/Makefile  |   2 +-
>  net/ethtool/netlink.c |  25 +++
>  net/ethtool/netlink.h |   9 +
>  net/ethtool/port.c    | 373 ++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 409 insertions(+), 1 deletion(-)
>  create mode 100644 net/ethtool/port.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 15011f5752a9..d62eaafa8d53 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18794,6 +18794,7 @@ F:	Documentation/devicetree/bindings/net/ethernet-connector.yaml
>  F:	Documentation/networking/phy-port.rst
>  F:	drivers/net/phy/phy_port.c
>  F:	include/linux/phy_port.h
> +F:	net/ethtool/port.c
>  K:	struct\s+phy_port|phy_port_
>  
>  NETWORKING [GENERAL]
> diff --git a/net/ethtool/Makefile b/net/ethtool/Makefile
> index 629c10916670..9b5b09670008 100644
> --- a/net/ethtool/Makefile
> +++ b/net/ethtool/Makefile
> @@ -9,4 +9,4 @@ ethtool_nl-y	:= netlink.o bitset.o strset.o linkinfo.o linkmodes.o rss.o \
>  		   channels.o coalesce.o pause.o eee.o tsinfo.o cabletest.o \
>  		   tunnels.o fec.o eeprom.o stats.o phc_vclocks.o mm.o \
>  		   module.o cmis_fw_update.o cmis_cdb.o pse-pd.o plca.o \
> -		   phy.o tsconfig.o mse.o
> +		   phy.o tsconfig.o mse.o port.o
> diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
> index 1af395b54330..c076c07d0a08 100644
> --- a/net/ethtool/netlink.c
> +++ b/net/ethtool/netlink.c
> @@ -26,6 +26,8 @@ static u32 ethnl_bcast_seq;
>  			     ETHTOOL_FLAG_OMIT_REPLY)
>  #define ETHTOOL_FLAGS_STATS (ETHTOOL_FLAGS_BASIC | ETHTOOL_FLAG_STATS)
>  
> +char phy_interface_names[PHY_INTERFACE_MODE_MAX][ETH_GSTRING_LEN] __ro_after_init;
> +
>  const struct nla_policy ethnl_header_policy[] = {
>  	[ETHTOOL_A_HEADER_DEV_INDEX]	= { .type = NLA_U32 },
>  	[ETHTOOL_A_HEADER_DEV_NAME]	= { .type = NLA_NUL_STRING,
> @@ -431,6 +433,7 @@ ethnl_default_requests[__ETHTOOL_MSG_USER_CNT] = {
>  	[ETHTOOL_MSG_TSCONFIG_SET]	= &ethnl_tsconfig_request_ops,
>  	[ETHTOOL_MSG_PHY_GET]		= &ethnl_phy_request_ops,
>  	[ETHTOOL_MSG_MSE_GET]		= &ethnl_mse_request_ops,
> +	[ETHTOOL_MSG_PORT_GET]		= &ethnl_port_request_ops,
>  };
>  
>  static struct ethnl_dump_ctx *ethnl_dump_context(struct netlink_callback *cb)
> @@ -1572,6 +1575,15 @@ static const struct genl_ops ethtool_genl_ops[] = {
>  		.policy = ethnl_mse_get_policy,
>  		.maxattr = ARRAY_SIZE(ethnl_mse_get_policy) - 1,
>  	},
> +	{
> +		.cmd	= ETHTOOL_MSG_PORT_GET,
> +		.doit	= ethnl_default_doit,
> +		.start	= ethnl_port_dump_start,
> +		.dumpit	= ethnl_port_dumpit,
> +		.done	= ethnl_port_dump_done,
> +		.policy = ethnl_port_get_policy,
> +		.maxattr = ARRAY_SIZE(ethnl_port_get_policy) - 1,
> +	},

Both sashikos instances points to multiple races with dumps. I suspect
some explicit locking is required.

https://sashiko.dev/#/patchset/20260701110427.143945-1-maxime.chevallier%40bootlin.com
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260701110427.143945-1-maxime.chevallier%40bootlin.com

I *think* this is hopefully the last pending issue.

/P


  reply	other threads:[~2026-07-07 10:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 11:04 [PATCH net-next v13 00/10] net: phy_port: SFP modules representation and phy_port listing Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 01/10] net: phy: phy_link_topology: Add a helper for opportunistic alloc Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 02/10] net: phy: phy_link_topology: Track ports in phy_link_topology Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 03/10] net: phylink: Register a phy_port for MAC-driven SFP cages Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 04/10] net: phy: Create SFP phy_port before registering upstream Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 05/10] net: phy: Represent PHY-less SFP modules with phy_port Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 06/10] net: phy: phy_port: Store information about a port's upstream Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 07/10] net: phy: phy_link_topology: Add a helper to retrieve ports Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 08/10] netlink: specs: Add ethernet port listing with ethtool Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 09/10] net: ethtool: Introduce ethtool command to list ports Maxime Chevallier
2026-07-07 10:12   ` Paolo Abeni [this message]
2026-07-07 10:47     ` Maxime Chevallier
2026-07-07 13:46       ` Paolo Abeni
2026-07-07 14:00         ` Maxime Chevallier
2026-07-01 11:04 ` [PATCH net-next v13 10/10] Documentation: networking: Update the phy_port infrastructure description 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=aaef7304-573a-419e-b631-30b300373a08@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dimitri.fedrau@liebherr.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=frank.wunderlich@linux.dev \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kabel@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mwojtas@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=romain.gantois@bootlin.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