From nobody Mon Feb 9 13:58:10 2026 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 84DCD13B2A3; Wed, 28 Feb 2024 11:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120872; cv=none; b=rcLJknlw+XGyZuEzjHFkY8MppKwPQ4VWXhMyRe/a1Ds6qMNSp8PzCGSzyZC+JdlOECACDb2ezmYcR8cm9BYsJ/tHTJioWuFRPopBTnplPw0R/xIic1oFNQri5P2Y/xi8LiLBHtAMwyccAFKP/TvN4eR6p7lD9nR4tA9IBW7RiBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120872; c=relaxed/simple; bh=nfclxXDmccqoJeZ6Xuve1/yVbu0Ku5GdhvUzwebFiD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MU/tIveaUXMNgktFNAsbE3gk4pC5UbrUzpUOw1sqMsDoHEIa1uYYS2r3wHlxf7wyAIyFvU3MfHsHEWfoYE0PLpji2oX4dCSkhNn7xU7ElRyOq7dA8MO74WcjASqp3mLWon+FMWVce8qIxjv7DBl8eCND6H1LeRzUNxPhkcqjxOc= 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=TDDVoFaQ; arc=none smtp.client-ip=217.70.183.197 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="TDDVoFaQ" Received: by mail.gandi.net (Postfix) with ESMTPSA id 020361C000B; Wed, 28 Feb 2024 11:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709120869; 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=sgOogDtanHEd8bm+qGwxyE50KWI8Y9AXr46d1GNftJQ=; b=TDDVoFaQdCGG28VUf36c5DTMuT+5xM7e15xE84bA7kkfWQuqup5aP/E436PjubaV/4tZ6A LLIsp2ezZXWbslnG7afMBJYtxns8CnGIYnhX1hxqrKuHS7E8bZpWf41j28O3kYgbN47fVK jxHbFafCjgbxv3zu4UkpAAGgyr4IR0VUAYLZhmhdTGwsymeGibOdpAyOb+zmryF/U1LuiN 6AU16OEXRwRPEMJf5HnvwN1YAJ4QULvP6qG+0suF+lqvIuxB998z4qChe0SKDi12Irb6UM NKqGhh8USeg5oghh3gzy1jPpVF5volK0GQowN2CEZ/kxIVpR0vWjsvJoQCey1g== 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?= , Simon Horman , mwojtas@chromium.org Subject: [PATCH net-next v9 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Wed, 28 Feb 2024 12:47:25 +0100 Message-ID: <20240228114728.51861-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228114728.51861-1-maxime.chevallier@bootlin.com> References: <20240228114728.51861-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: quoted-printable X-GND-Sasl: maxime.chevallier@bootlin.com Content-Type: text/plain; charset="utf-8" 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 --- V9: No changes V8: No changes V7: No changes V6: Use dedicated policy V5: Added Andrew's R-b V4: No changes V3: No changes V2: New patch 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 06a151165c31..536800bbc379 100644 --- a/net/ethtool/cabletest.c +++ b/net/ethtool/cabletest.c @@ -13,7 +13,7 @@ =20 const struct nla_policy ethnl_cable_test_act_policy[] =3D { [ETHTOOL_A_CABLE_TEST_HEADER] =3D - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), }; =20 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; =20 dev =3D req_info.dev; - if (!dev->phydev) { + if (!req_info.phydev) { ret =3D -EOPNOTSUPP; goto out_dev_put; } @@ -85,12 +85,12 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct ge= nl_info *info) if (ret < 0) goto out_rtnl; =20 - ret =3D ops->start_cable_test(dev->phydev, info->extack); + ret =3D ops->start_cable_test(req_info.phydev, info->extack); =20 ethnl_ops_complete(dev); =20 if (!ret) - ethnl_cable_test_started(dev->phydev, + ethnl_cable_test_started(req_info.phydev, ETHTOOL_MSG_CABLE_TEST_NTF); =20 out_rtnl: @@ -220,7 +220,7 @@ static const struct nla_policy cable_test_tdr_act_cfg_p= olicy[] =3D { =20 const struct nla_policy ethnl_cable_test_tdr_act_policy[] =3D { [ETHTOOL_A_CABLE_TEST_TDR_HEADER] =3D - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), [ETHTOOL_A_CABLE_TEST_TDR_CFG] =3D { .type =3D NLA_NESTED }, }; =20 @@ -321,7 +321,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struc= t genl_info *info) return ret; =20 dev =3D req_info.dev; - if (!dev->phydev) { + if (!req_info.phydev) { ret =3D -EOPNOTSUPP; goto out_dev_put; } @@ -342,12 +342,12 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, str= uct genl_info *info) if (ret < 0) goto out_rtnl; =20 - ret =3D ops->start_cable_test_tdr(dev->phydev, info->extack, &cfg); + ret =3D ops->start_cable_test_tdr(req_info.phydev, info->extack, &cfg); =20 ethnl_ops_complete(dev); =20 if (!ret) - ethnl_cable_test_started(dev->phydev, + ethnl_cable_test_started(req_info.phydev, ETHTOOL_MSG_CABLE_TEST_TDR_NTF); =20 out_rtnl: --=20 2.43.2