Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1168388rdb; Fri, 1 Dec 2023 08:38:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTH64KczZBFcP8AVOH1x3QFOPAuR7nCEmjLK9ATN5ivHWZHcKtJJ91A3dQN8OZAzGw9vdE X-Received: by 2002:a17:902:b283:b0:1d0:4cde:6e23 with SMTP id u3-20020a170902b28300b001d04cde6e23mr3380886plr.53.1701448702819; Fri, 01 Dec 2023 08:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701448702; cv=none; d=google.com; s=arc-20160816; b=QyFBemCldI9DesSdipRGKmz4IsQ/THvzhqPuPpX1kE1g7PE39CuVzMv1/xIplB82mm kkaEfrsfWQ+u6uU/x0Q2jI6V6bURXox3B/RHD/TmG3/p/y9sAdQuK54x4CxIe9PZ/q4i Ko9QRjXlBTIA7wRnlTh3opON/4Z3iqOTPi5bKXrNeRR1DCgnLIdxyEuuPnLWDuM+yg1r flRG/q/bxwEagH+aZsXABkzvyLtQeflxccxsecMuWLUB545gebaCQJ3VP7413E1W727y wmAadtKT9DzVfcp6ciLDAmGH8QZ1IHTHsnlyAlm005yfqCg3uXwpzQF41xcqOAXhvbWy Zlyg== 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=2tgWKDF7KvzEfYVSrBqsu+zgRG5hS2mMQT/44TU8PoA=; fh=01/i7K9ues3Vkkz8uyECvnCPITXmGs/30yOh5FbyFgY=; b=VkAiVlZAfBjLFSkUlZhzQCWkN1aioWDy3vxb0iGpjUG/riYpE0CdpTuhTcPieLNhkG Ls7PJY2GLUFvdZiS6Gknd0rxDgMOYFgpfAoBqo+Z97lzZKAuyLUSKkx7CxP764Q2dkbm qBYjaVyvF5ko/RaovRB2+bXW001hkxQTDjrVi2ibglVwHZY92GY3yYDsS7bL9QGVuAC4 s9y+6XLlGOn9Cmc16xdBppJagC66B3R2yYbo1oVBuLrGcyocSp8T/7SRhvluKGpeerZD GhK0Y/vCRHLvnpq7LNhHyM/lE8uzUSfubre/Doklvt/Si+L1i0nW4XWnt4aMqQtGEqd9 8Jcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UA1HpYof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id b5-20020a170902ed0500b001d0511c990fsi1796302pld.498.2023.12.01.08.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:38:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UA1HpYof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id B8ED08379A41; Fri, 1 Dec 2023 08:38:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378693AbjLAQhf (ORCPT + 99 others); Fri, 1 Dec 2023 11:37:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235242AbjLAQh0 (ORCPT ); Fri, 1 Dec 2023 11:37:26 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA741720; Fri, 1 Dec 2023 08:37:21 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 58161C000A; Fri, 1 Dec 2023 16:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701448640; 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=2tgWKDF7KvzEfYVSrBqsu+zgRG5hS2mMQT/44TU8PoA=; b=UA1HpYofn7CvVW1jmM9rDVxW4KmPR9Z26Y4X3G6WvpkQQl2tXn1GnogxZzYQv9L/reEgLK sZdBjXs1QOy3yVo7a0wYCEYlu9UwHvuQl01hzZO0W6gNCZbiG+iJcjMdW3luIVLnTPDAB1 CfieVJVvwNxMaaq5jJxewiTtCKyESPDKxfRwH5k487OuXqgPe2/k2CqI81EydjGxZmULDR 7neV7UZ6oTHSmkKgbqDg4XwJFjROPE7AdpI43n1Zf3uDC1zFDajWDB7MYmJJlSz3A21lCM Ty5zGelhS7j1QUUun6c8e5zrhhvWDiSr/yCaxHquPczbhCcRERbaAbWwrOeidg== 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=20Maincent?= , Jesse Brandeburg , Jonathan Corbet , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= Subject: [RFC PATCH net-next v3 09/13] net: ethtool: plca: Target the command to the requested PHY Date: Fri, 1 Dec 2023 17:36:59 +0100 Message-ID: <20231201163704.1306431-10-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231201163704.1306431-1-maxime.chevallier@bootlin.com> References: <20231201163704.1306431-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:38:19 -0800 (PST) PLCA is a PHY-specific command. Instead of targeting the command towards dev->phydev, use the request to pick the targeted PHY. Signed-off-by: Maxime Chevallier --- V3: No changes V2: New patch net/ethtool/plca.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/ethtool/plca.c b/net/ethtool/plca.c index b1e2e3b5027f..2b3e419f4dc2 100644 --- a/net/ethtool/plca.c +++ b/net/ethtool/plca.c @@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base, int ret; // check that the PHY device is available and connected - if (!dev->phydev) { + if (!req_base->phydev) { ret = -EOPNOTSUPP; goto out; } @@ -80,7 +80,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base, memset(&data->plca_cfg, 0xff, sizeof_field(struct plca_reply_data, plca_cfg)); - ret = ops->get_plca_cfg(dev->phydev, &data->plca_cfg); + ret = ops->get_plca_cfg(req_base->phydev, &data->plca_cfg); ethnl_ops_complete(dev); out: @@ -141,7 +141,6 @@ const struct nla_policy ethnl_plca_set_cfg_policy[] = { static int ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) { - struct net_device *dev = req_info->dev; const struct ethtool_phy_ops *ops; struct nlattr **tb = info->attrs; struct phy_plca_cfg plca_cfg; @@ -149,7 +148,7 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) int ret; // check that the PHY device is available and connected - if (!dev->phydev) + if (!req_info->phydev) return -EOPNOTSUPP; ops = ethtool_phy_ops; @@ -168,7 +167,7 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) if (!mod) return 0; - ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack); + ret = ops->set_plca_cfg(req_info->phydev, &plca_cfg, info->extack); return ret < 0 ? ret : 1; } @@ -204,7 +203,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base, int ret; // check that the PHY device is available and connected - if (!dev->phydev) { + if (!req_base->phydev) { ret = -EOPNOTSUPP; goto out; } @@ -223,7 +222,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base, memset(&data->plca_st, 0xff, sizeof_field(struct plca_reply_data, plca_st)); - ret = ops->get_plca_status(dev->phydev, &data->plca_st); + ret = ops->get_plca_status(req_base->phydev, &data->plca_st); ethnl_ops_complete(dev); out: return ret; -- 2.42.0