From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790EA2E6CD3 for ; Fri, 30 Jan 2026 13:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780187; cv=none; b=m0SGK0SLpILn2+lPg9C18irWJkva4g53hohILELcUfOSo9u/pa5pDQIiHjSwWwBHqzDABFe+F7C1Y1SFkM6CbR+L9AJT8NiSFJR/dRj4Pseg2wKYnvhypRJxWsCdbRyQql6DmD01M+e3Vbue9bp1TL8yoXhNQv62zH0/QLyuSZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780187; c=relaxed/simple; bh=fPfC3d3Zxx+RhTICVIvrYBWckYaYM0qOks46HcJDVBM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aMrocIKRaXlZj8s5ySV+WAZ+/XFhNA1VRv6T7a96PmYmZM1sS6kdZ1dhp4cZFR04uJKHuVFpX5ri7F7gaY3G475zjdKk3NWgeUXP/+ZzP2CwDDnKqNVLFBJp4PFObHpAcytU3NqQymQHWJ/S1XG2xG9PeFTBaN7fFbgUcoXnN+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=XcXUIUNC; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XcXUIUNC" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 70EA7C22F5C; Fri, 30 Jan 2026 13:36:26 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E4C1F6075A; Fri, 30 Jan 2026 13:36:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7E9FA119A885C; Fri, 30 Jan 2026 14:36:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769780181; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=9AkBeD0/m2/gh93dclxVIucwTWWcVXPrPD9ERp3+UDc=; b=XcXUIUNCjMh65rwQ8+RGYbMzPZPJq1pFiKoTZEhCjSyIG20b63vtlHafpLLDDCHEbipywO QO0Urqiv6cLjTAaMsI6CmXh71KfI2u/b4SP5yjTBnXgaJXXA0mqSN5is12OuNw2j+TrpvK kAI3cRBhZPM9kSuTg33DfmKxYkLuAPN7PbUXbXmqZyEUqPswOmGc8O64h16crBEnYaibAG eARkpOKRkX8RD923eLGvwNKq7G+Pj1Dzyr6SOgFWHpuOdXdadrO6VNKrd5h2Mv2SPQdZAl WZgQzMo9KkvyeZf2YCQ37Jn8nmIyPrgXX74IgfFWSqePtYriBww831tVa070xQ== Message-ID: <7947c611-982f-4ece-b7f4-d151f728fe6f@bootlin.com> Date: Fri, 30 Jan 2026 14:36:16 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 08/13] net: phylink: Represent PHY-less SFP modules with phy_port To: Romain Gantois , davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Heiner Kallweit Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?Q?K=C3=B6ry_Maincent?= , =?UTF-8?Q?Marek_Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?Q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Daniel Golle , Dimitri Fedrau References: <20260127134202.8208-1-maxime.chevallier@bootlin.com> <20260127134202.8208-9-maxime.chevallier@bootlin.com> <3029118.e9J7NaK4W3@fw-rgant> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <3029118.e9J7NaK4W3@fw-rgant> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 On 28/01/2026 17:01, Romain Gantois wrote: > On Tuesday, 27 January 2026 14:41:56 CET Maxime Chevallier wrote: > ... >> @@ -1786,13 +1787,31 @@ static int phylink_create_sfp_port(struct phylink >> *pl) else >> >> pl->sfp_bus_port = port; >> >> + if (pl->mod_port) { >> + ret = phy_link_topo_add_port(pl->netdev, pl->mod_port); >> + if (ret) >> + goto out_bus_port; >> + } >> + >> + return 0; >> +out_bus_port: >> + phy_link_topo_del_port(pl->netdev, port); > > This seems strange to me. Why clean up after phy_link_topo_add_port() if it > returned an error code? Presumably phy_link_topo_add_port() cleans up after > itself if it encounters an error doesn't it? Because we're not cleaning up the same port, notice the 'port' vs 'pl->mod_port' params :) > >> + phy_port_destroy(port); >> >> return ret; >> >> } >> >> static void phylink_destroy_sfp_port(struct phylink *pl) >> { >> >> - if (pl->netdev && pl->sfp_bus_port) >> - phy_link_topo_del_port(pl->netdev, pl->sfp_bus_port); >> + if (pl->netdev) { >> + if (pl->sfp_bus_port) >> + phy_link_topo_del_port(pl->netdev, pl->sfp_bus_port); >> + >> + /* Only remove it from the topology, it will be destroyed at >> + * module removal. >> + */ >> + if (pl->mod_port) >> + phy_link_topo_del_port(pl->netdev, pl->mod_port); >> + } >> >> if (pl->sfp_bus_port) >> >> phy_port_destroy(pl->sfp_bus_port); >> >> @@ -3998,6 +4017,49 @@ static void phylink_sfp_disconnect_phy(void >> *upstream, phylink_disconnect_phy(upstream); >> >> } >> >> +static int phylink_sfp_connect_nophy(void *upstream) > > I'd name this "phylink_sfp_connect_no_phy" just to keep the name formatting > consistent. having 'nophy' as a single word made it clearer that this was "phy" vs "nophy" IMO, rather than potentially interpreting "phy" as a suffix. but I see your point, I think I'll rename it :) Maxime > > Thanks, >