From patchwork Fri Nov 17 16:23:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 166226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp618511vqn; Fri, 17 Nov 2023 07:41:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHLoApCtHKQQ4hklBxo8zecT4D1AGmbSCbjziBmLnWZF7b3+ErzOx0hfSY7E+dVKrq9xMA X-Received: by 2002:a17:903:2a84:b0:1cc:6fa6:ab62 with SMTP id lv4-20020a1709032a8400b001cc6fa6ab62mr6235477plb.29.1700235680077; Fri, 17 Nov 2023 07:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700235680; cv=none; d=google.com; s=arc-20160816; b=a550BKrJZjWF4keulJOtS3PQHYfS69+N3rGHJRgOomk/dKP2PpX0rQ9yJ/8vRyyOiG 0GnHgKoHsr/tIiUC5hIBNKJrfS9jUn41I+3qYd9w/ky40GVzYtWDMlVj8RVGrAb5W++6 3fEacO4sTsn0Hvi481OXoEZRPXy8fBPmShaFf7Kob9zqWt4jTUpOEm+XcA6wjW5fuL94 lOqm1j3vDyF+tdmen0myYD2f2t9d4sZWyquvXmvNaEroLeS76kfbLebBWq9oSRRltAw+ 2ojHpw0kr59+IYIER1zsYjcCZlaus6dGdYL8MnBn9cuZRKk+ryaC9t0nlKnzP3C8K+GU a3Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cc5FJffdyRYgh63tOCyG9vrWU+jsbhy/LpYTiz7ix4o=; fh=1WRQxG55ASsvt/9NxVDhUbJ1aQecLyVglFoTAx66NyA=; b=LSjydvmXIicOfWG7prBnjkfReFp8ioz7hg+xZs+YrqFS2xdpGeOEk515p8oFgqIRnI OVw/gQYRdWTz5HuZgUzlUOeQWLI9U01pE7sAMD19IrEVYRMvy8cGKS5h4Dm4YqvKPwLG hhDvwhWh4q8LcnAVKEFJ5u8J7q8wq5ScEaoRFIItIdbLTuCv6gUshxhZSjfAKaBB0/PT sR/b/r0b8Ps8IAR3gmu4llgF+Lqc84sc0TR3Dv2sChPoLgjPP7Qq1Q/SI+AAzTC5BLXV OXhWhFrQHY3pb/q1QVRW+dUw0m/VmR3NBGB4ENEbGMoE3x5LmomSbxVyvhgXNyPOtIkp W5Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="NpnZ7o/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a13-20020a170902b58d00b001cc282684c6si1953478pls.278.2023.11.17.07.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 07:41:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="NpnZ7o/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3618C809D442; Fri, 17 Nov 2023 07:41:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346004AbjKQPk3 (ORCPT + 30 others); Fri, 17 Nov 2023 10:40:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjKQPkY (ORCPT ); Fri, 17 Nov 2023 10:40:24 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7674D6D; Fri, 17 Nov 2023 07:40:20 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6ECE51BF20B; Fri, 17 Nov 2023 15:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700235619; 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=cc5FJffdyRYgh63tOCyG9vrWU+jsbhy/LpYTiz7ix4o=; b=NpnZ7o/Ue4VbtiufsHK0X3dEfoRl59knm2x54B97u2rGVDKgtTgPY7Wj7embBpZnXkqsuM HO0CBfjez7iAFGgFjpFtGPeE0SR9goVufQSdwGUPFA6gArTMhKOAIt48VNqV0ZjDGq07IP JeQPZ0KvxWVB1pvbkjvYPOm287kDzYPDkJ/ujTZDm+o32KzXJyxqIDl4PXftNfgNhsKCjo 8YIWjB39v2V+68j8UoV0IE/t4KflUGO5xNUbDTaGq4u7OImeAhEkqo9Oj1iYEIl4cehHQV yKRhZzwyYvlfg5+YjgFYVrYIKpTxi75rT/Je68CvusWFmcrZy+w4tUy+lH2iZA== 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 Subject: [RFC PATCH net-next v2 02/10] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Date: Fri, 17 Nov 2023 17:23:13 +0100 Message-ID: <20231117162323.626979-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231117162323.626979-1-maxime.chevallier@bootlin.com> References: <20231117162323.626979-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 07:41:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782826328141128864 X-GMAIL-MSGID: 1782826328141128864 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 --- 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 6712883498bb..2abb56c3bff0 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3310,7 +3310,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 208a9393c2df..f42e9a082935 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)