From patchwork Mon Mar 4 15:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 209572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1484019dyc; Mon, 4 Mar 2024 07:12:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHJevNsUsZ2C27h7vzy8aZn7vGHOt/mQWtEAr3l6O8QGG8FZTjFGHbRHZtgm/Wi6esbtE5RRCcFLtt1Xjdm1DdMOlXwg== X-Google-Smtp-Source: AGHT+IH0cp+kwWhIrAZ/b9ZY/F3KV8VlqzTH7gB3A2ux7X8+sWDjGy2pAgiFCePAdc8MsX6ntSnV X-Received: by 2002:a05:622a:88:b0:42e:8b8b:8cb6 with SMTP id o8-20020a05622a008800b0042e8b8b8cb6mr21301032qtw.13.1709565158236; Mon, 04 Mar 2024 07:12:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709565158; cv=pass; d=google.com; s=arc-20160816; b=iYFgsseQ0se9QjMg/A2fqdyEF3N4gJu5d1v45gBWw0+bF4pg4A7JwGwSxCUmo7NWll Fio37jVcpz8APjbXvjgH563gKZgzXO19sCOuvZ/B20OgTymUDRSQ7uhquEWZPTc82Uw2 357LnI3FwrMM0X9bWSrisDurEnHapTCzBGnYwC0mz7BUn3VliPheXZNgtMfR+nmLsbfw I6pYZy38+mqafBlrrnswGVXG5R3Uh3lgiEdjPYGZASQrHS/inAKhq+km0cFZ5k4WeFd5 g98+v64htgWWbtuqMzr5ubJ00wpl66r3116MSd7iAtB4QVQIpjvSC8iJ71SqRo8V1Vxu PtQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OmCZ8+vUM5DG7x+TAmA4cTrV/kcQNelYUOaYHrZMngk=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=v4dyD271KeFWeQ6YbElmkEG/0tPzaFOlVGVkgrAmEsdxZCEKcKhwUeJfW5bQTC5rJP d7Lp1UiDidsAri08th4T7tpptiNEVm+rk5jGieFL6wax+RNpDyVbD5ce5xgPIkT0l3GE hW75EYak7xm1On0+fZX7zyjWxjvH3GnCH2Fba07Ck1X6HKJiagIWDxbKk37+qaIi2VVq l7eIPaXoVI/pCh/wRVcxmftKDB5yVZ9IMNt3B+jDGhbcmOM5iZjFOdQTDVYPwJp3S/Dg h/mgOjxfItvZIB85WsUCiYIdbnArYDEffajXp9kNj7ZarVcoQTWF0TlO2bX3EETZJ7Ey 4wAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jOWFc6YT; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-90781-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90781-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e19-20020a05622a111300b0042ef058d401si2631169qty.436.2024.03.04.07.12.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:12:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90781-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jOWFc6YT; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-90781-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90781-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E57001C21B30 for ; Mon, 4 Mar 2024 15:12:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94BFB524DD; Mon, 4 Mar 2024 15:10:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="jOWFc6YT" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 7325F47772; Mon, 4 Mar 2024 15:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565021; cv=none; b=EvIZklK4N3PJZEKAbViwoCFSlh7nVFmsArkxkt4YF59R+gRYnOtc4ogvxyf+LuuaBqbbtbwnDFPSTyslaHuGyc7dotDLhQNDVbDPf1AhUklRX/QUkjgaKQJp+LJNO+PpDkxleqBU+J9JnuSjNXGD5Tsn2ynlbKpJ/fKFLeENwMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565021; c=relaxed/simple; bh=pW+1V7YqOhkcLioMl2DX0tOkmXUQtbPF3XcSxdIf7OE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RZy4abN0/KZIu/LWvWwlE15EqXAMiA/BojWlBqLmFjPO8af/rqv2z+BVmCdhzctygoCt2CdKFSGwK1e1E2rnYOZebvoeg3GkScPZn42plsBwEkxRyM4wAluk3epCEfrzo5GluP2uByi/pv6WmgkiJDdvzgB6g6G0zyK3cUEj/Jo= 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=jOWFc6YT; arc=none smtp.client-ip=217.70.183.201 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id 4405B1BF20B; Mon, 4 Mar 2024 15:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709565017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OmCZ8+vUM5DG7x+TAmA4cTrV/kcQNelYUOaYHrZMngk=; b=jOWFc6YTA+JqZ8uZMFTD1zxcWx2ZZf7jB1sEU+oTscYmKbqz2oFj3fFqQF4TtGOIrdja5Y Ih949WqcLOaLh4y6ZrMU3x2dGW4pfFyOa/tLtYEH7w9PItt++G4sei7qmVDsjunOL7tqFb yXrggYyFSHiMbLfGiDK7dPF87MJkqo4Nf16x09XaTC1aZhSpidzepVWkA00KblZMgRp6Ep ZUjCwYp9EurDlbd6ZYv9twBz++Jh+g9HIjWf/KKF3L+t0o1SyWPtsyNEgWhjm6ZhLz1poa n3AzhjQFrrlTtdbYfpkbl78+gjzsrAgv/LYMl6zKl9T0fVFPdPGG1Vkb6FK1Hg== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?utf-8?q?K=C3=B6ry_Maincent?= , Jesse Brandeburg , Jonathan Corbet , =?utf-8?q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org Subject: [PATCH net-next v10 02/13] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Date: Mon, 4 Mar 2024 16:09:58 +0100 Message-ID: <20240304151011.1610175-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304151011.1610175-1-maxime.chevallier@bootlin.com> References: <20240304151011.1610175-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792608995292979345 X-GMAIL-MSGID: 1792608995292979345 Pass the phy_device as a parameter to the sfp upstream .disconnect_phy operation. This is preparatory work to help track phy devices across a net_device's link. Signed-off-by: Maxime Chevallier --- V10: No changes V9: No changes V8: No changes V7: No changes V6: Moved an incorrectly added hunk from the previous series to patch 0003 V5: No changes V4: No changes V3: No changes drivers/net/phy/phylink.c | 3 ++- drivers/net/phy/sfp-bus.c | 4 ++-- include/linux/sfp.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 503fd7c40523..8a34883eb99b 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3385,7 +3385,8 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) return ret; } -static void phylink_sfp_disconnect_phy(void *upstream) +static void phylink_sfp_disconnect_phy(void *upstream, + struct phy_device *phydev) { phylink_disconnect_phy(upstream); } diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index db39dec7f247..e05013aeecc3 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -486,7 +486,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus) bus->socket_ops->stop(bus->sfp); bus->socket_ops->detach(bus->sfp); if (bus->phydev && ops && ops->disconnect_phy) - ops->disconnect_phy(bus->upstream); + ops->disconnect_phy(bus->upstream, bus->phydev); } bus->registered = false; } @@ -742,7 +742,7 @@ void sfp_remove_phy(struct sfp_bus *bus) const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); if (ops && ops->disconnect_phy) - ops->disconnect_phy(bus->upstream); + ops->disconnect_phy(bus->upstream, bus->phydev); bus->phydev = NULL; } EXPORT_SYMBOL_GPL(sfp_remove_phy); diff --git a/include/linux/sfp.h b/include/linux/sfp.h index 9346cd44814d..0573e53b0c11 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h @@ -544,7 +544,7 @@ struct sfp_upstream_ops { void (*link_down)(void *priv); void (*link_up)(void *priv); int (*connect_phy)(void *priv, struct phy_device *); - void (*disconnect_phy)(void *priv); + void (*disconnect_phy)(void *priv, struct phy_device *); }; #if IS_ENABLED(CONFIG_SFP)