Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp332370lqr; Wed, 5 Jun 2024 07:26:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4RbpkY6l/kNocsmK5m0oYfuVUiipzsx3t3pM6k0DiP6x5ygjcVF6w2jK4tFc4zdOfkQ6b6eH5sKgK9t4EnjX7CqCb0o+GJomVzBjXkA== X-Google-Smtp-Source: AGHT+IFt9kwSs0M33u/1UbUnDeEHKMx1OMttxpfFOaIz8jtWFZcBmAa7BLdEgAoMd465eeFO5JOJ X-Received: by 2002:a17:90b:2396:b0:2bf:4c7a:e47a with SMTP id 98e67ed59e1d1-2c27db62f2cmr2800034a91.42.1717597576360; Wed, 05 Jun 2024 07:26:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717597576; cv=pass; d=google.com; s=arc-20160816; b=wA4ojCuzS44DtGFo48aVqQUnx6wbtLhtHX/SuYVkQvyI74pPGU8lxCNjWmQVSHfHUk F7i0Qp/KW5ZCG29R5ngHdi0ciQ+h7LheKzRfJJomDDUA2J/JPNuxQlsZBEanapFmWVMp xWFAKJBnY9oYhbh8CaeWrhjDiGiGnpNLO2g5dTrYwek42mgHnCIBKDBe6p3s9N+0FE+Z NKxyu/aenPKGL89Ee6jzH0UZaFicMbzWOiOKoITmQKwPnF1RdV9oiDonhHwL74FaPn7/ vdlPoMwsta6HbuZsrB6y6KAdc5jBSais3GdvPXcA8Z1Rm9kXxj7FIj1B9qjbpoEcfOCt LDGA== 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=aTeslFgz8vSg7S4dfVYAbCiXpnFjv0CJKUEzc0dnIH0=; fh=Dinp91LF2KcnzfyOXGg1vCezYXJAYX+8GKPCxLQjq1Q=; b=ZWJLR9NbC88UgCHK9AmAhozNXvPkgz6ghO4qBkX0m5VBBepREyitXtTZdIHmEUbCYu BD48FCMryrbmJkfrvriMhuhGyRVRjN2g6VbpgaAlb3TVIdDxnnLd/NJWsXNiL2ZQtFpC hCTZm8bG5U1VqzjV8REY0G6oEzTZxIgTroA8riZC3QekJJNAESCKzMMhAdRDCRl3Jfif dSTCdmzqR6TE579eY6Ax1I0j9C4PZOyvGw04LJYKuDwD7wOgDZzihtmmZE8gYyb6fJgL tvLtjgpSd5QHDvgdyGu7ktifzifBw/3KY3LtnOwgllzIs/X6pgz67jCNYnv6e8SrJoRd SLtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=onoSsidm; 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-202654-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806d27a1si1311070a91.157.2024.06.05.07.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 07:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202654-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=onoSsidm; 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-202654-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202654-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CD853B22BAE for ; Wed, 5 Jun 2024 13:28:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 109E81ABCAA; Wed, 5 Jun 2024 12:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="onoSsidm" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 3EC6E1C370A; Wed, 5 Jun 2024 12:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717591786; cv=none; b=hD/RvmxmOJdqeeryE1VpfsaKD4yxYOv2V0jytdoebNou3kpN8DTpNs09QY59Uom2tugnfha+A1ai2hdOgKvdOn+Vlvwy8s9z/wmFbRALLfpkARXWbAGLO+1FAr7C8FUcT+3MkwQfqrpfILJhG0G1q/bPeow8drDEKACDkEHUnJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717591786; c=relaxed/simple; bh=e6fTToYWq45w/807OmOw6rMDMu3d5j5d5Sgp+iyhRSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HaORevvxCzGTsiZGsgdvJJPjEe5Mv7VrmPrc4we7QjUpI8Rwf3be03eVKEs4Q9q6k7HE6Pg5DWUkvvKHgI1dFRuiazIMgkINcbyzQLVMRRGITF46bX3L89lrOOuSMyLmMz4RdZCbdnzNBtjv9zkxC7cbdHYn7fspg1kaTjniYgM= 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=onoSsidm; arc=none smtp.client-ip=217.70.183.200 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 3C8CC20011; Wed, 5 Jun 2024 12:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1717591782; 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=aTeslFgz8vSg7S4dfVYAbCiXpnFjv0CJKUEzc0dnIH0=; b=onoSsidm9K+0s5Q3/i+ipqD202bwbXnlOCpTQT7V4xdrpphK3/fX2gWUER3FreaNus04SX CsVDqSsQwFhFbEX7yklfY4S58X3LtgiGyCHSbf7+ZvvW7gFYe7SYGYPfrz3sSJpcclt8LR pbKjjAvswvFxwVwRMYcQT84sjYhcrvuRSewEF3lSoqknQUsF7f3f74HNfkx2JfoCTk4OmV HG4FJixJ44N9zaTt4T+1h3ATMyIYV7AT86W79rHQ48zRJqrEHNpD3wFw6Pu+SScd5nSX+B dMl/xOUFsiq++zsawRId4MMbNmQPmz4oQfory+TVmccEnFthp7IIimOufUGEkA== 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 , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart Subject: [PATCH net-next v12 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Wed, 5 Jun 2024 14:49:16 +0200 Message-ID: <20240605124920.720690-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605124920.720690-1-maxime.chevallier@bootlin.com> References: <20240605124920.720690-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 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com Cable testing 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 Reviewed-by: Andrew Lunn --- net/ethtool/cabletest.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c index f6f136ec7ddf..73dd4c439a3d 100644 --- a/net/ethtool/cabletest.c +++ b/net/ethtool/cabletest.c @@ -13,7 +13,7 @@ const struct nla_policy ethnl_cable_test_act_policy[] = { [ETHTOOL_A_CABLE_TEST_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), }; static int ethnl_cable_test_started(struct phy_device *phydev, u8 cmd) @@ -69,7 +69,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info) return ret; dev = req_info.dev; - if (!dev->phydev) { + if (!req_info.phydev) { ret = -EOPNOTSUPP; goto out_dev_put; } @@ -85,12 +85,12 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info) if (ret < 0) goto out_rtnl; - ret = ops->start_cable_test(dev->phydev, info->extack); + ret = ops->start_cable_test(req_info.phydev, info->extack); ethnl_ops_complete(dev); if (!ret) - ethnl_cable_test_started(dev->phydev, + ethnl_cable_test_started(req_info.phydev, ETHTOOL_MSG_CABLE_TEST_NTF); out_rtnl: @@ -216,7 +216,7 @@ static const struct nla_policy cable_test_tdr_act_cfg_policy[] = { const struct nla_policy ethnl_cable_test_tdr_act_policy[] = { [ETHTOOL_A_CABLE_TEST_TDR_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), [ETHTOOL_A_CABLE_TEST_TDR_CFG] = { .type = NLA_NESTED }, }; @@ -317,7 +317,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info) return ret; dev = req_info.dev; - if (!dev->phydev) { + if (!req_info.phydev) { ret = -EOPNOTSUPP; goto out_dev_put; } @@ -338,12 +338,12 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info) if (ret < 0) goto out_rtnl; - ret = ops->start_cable_test_tdr(dev->phydev, info->extack, &cfg); + ret = ops->start_cable_test_tdr(req_info.phydev, info->extack, &cfg); ethnl_ops_complete(dev); if (!ret) - ethnl_cable_test_started(dev->phydev, + ethnl_cable_test_started(req_info.phydev, ETHTOOL_MSG_CABLE_TEST_TDR_NTF); out_rtnl: -- 2.45.1