Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp791259rdb; Fri, 26 Jan 2024 10:42:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+yWt393YqXL7zlWPXdIiFZZd5RlobnH1HQWTuaTM0GFz/gfX3C3UDGdYOMpPkaMGJiTMG X-Received: by 2002:adf:f309:0:b0:337:bf3d:225 with SMTP id i9-20020adff309000000b00337bf3d0225mr42003wro.129.1706294524080; Fri, 26 Jan 2024 10:42:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706294524; cv=pass; d=google.com; s=arc-20160816; b=WhXh2HIloncRp3N2GBK50wDaN9a8UrMgzK1R+/Cr1bxNgXhqONLH5olAZXy7anY7yu 4YAxjNMZNQisY7oUfy9bvFowXJBrD/x0N4gVCxfy38dqOfNBvDPV6l4PNO7CT7OdezGr VafvcTiWx4pBdBMrFAiHS5/+0N8wW//2I0P7uWKDph1EYn+5/VC5puzJyNQNwjjgPN3X r1wGqvivyHBluVRu55obWZE3Cx2Uutl6Lf+n0Gr3fJRjVkrlW3sQWptsSGYa2NBuve/3 FMBmPd7hYhduQ5ifhKFaKceqhlLtNRfE6GzIyGxrhHcyf81XQNuvF5FRsGX74QtwsMMt 9vbQ== 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=CZgIWdoRIqBr6cY7Zh0tr+myspAW9cZOlS5rIeVg3R4=; fh=d3Krop4IPE3x6nBOvh3GY5QHg6bS91zVnQiH59I3hyM=; b=Eu9PsqXnDy2rz0nGpC/qFVxNBIJCZLz2sSe6tF5KdpQPyk6R9Xr1rxvxrL688Zl6ya aCrDdS9CEI0vPOGEwKr1fbCynSEXqC+9NLEa5mBEXcIx7IeSDtCgP+2g/XayUme/qlTM WLL8gQWuGwl8S2apBLTkzfx9mKFKXRJK5/Uyo15EuouW2vrYTMyZPGE4yBiLDxUxvEUW 7sYWM5dPIemy/S7sHbGxn2r/9WU/dMjoWal6TR8dQl9hsiK2zejhahK288+NP94Sl6CE ld4+yp3HDi3XmdJhf8dewZeSt8HqnCaRwJoTszE8X0JxTyWNdOGkvw1elEw3282OXLpY bZIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=n+ePvpk+; 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-40512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kj3-20020a170907764300b00a3496faabbcsi805182ejc.544.2024.01.26.10.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 10:42:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=n+ePvpk+; 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-40512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40512-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E0F831F21418 for ; Fri, 26 Jan 2024 18:41:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 273F42C6A0; Fri, 26 Jan 2024 18:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="n+ePvpk+" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 059F723759; Fri, 26 Jan 2024 18:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706294352; cv=none; b=V6VrRSo3nE++dhOv6IFDrto7Fr4gQT/ZZCjaOQvQ380RVjOBJdAUDbtGcpRtmYhvXpZARmUyZFEv2XPY/xVvDTZHcz0AX9iV89JH3OuPn9ARpC3d+B9WuoINGQYdApulkbhroQ1CHJqX4IuYPWM8B67NtLSqAqJVTlbNKDpbMXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706294352; c=relaxed/simple; bh=YM6q57pJRMctDvTVOS2RveTfcQhUjtlPBwQ1E+Rbvsg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j8AQKBjv8FqnaMiTz0qPSmNTLaxSMwMGc6+DdF/zYvV/yuKwphrELGgdK0eq5nP6AP1ePJba8Pgk6KkJ44RusOO7tIwcNgzp/TcEXLF+vP4fs4mwvZy/mBB0prtuycN7Ay3yCMVLvdTcpn2X0NFFRPkWY4bzUcmSDewGEzTQG98= 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=n+ePvpk+; arc=none smtp.client-ip=217.70.183.199 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 4C5C4FF80A; Fri, 26 Jan 2024 18:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706294348; 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=CZgIWdoRIqBr6cY7Zh0tr+myspAW9cZOlS5rIeVg3R4=; b=n+ePvpk+vrgp+o1QwFeoJEYp5KQVP9SUcuQCR5B8vPqCIPLbcgDkV5riLxJkFYLklh567d pVFNaaPEcKbTjL5r61EX7H6oajkHC9F/E/pMtZibperorjpD0OBb8z8rAml+2iw0B/Q3Fd zgj8KECq0kU0hofEyV1Nqr+8bR96dMu12LIODQn4c0ZkViiKtSZordJ4EITAueGGIsjUqR q6Mnp5SibfvXooMmsdIDZoWH9kCPxgdHhIjdf6I76kFT7+wJOC/QDjxBu2BxddrHDpVZ7N ZlTN7WPfHzMJBRVLavP0PO6zVTGFrdUxP+NX2R9l3tNAbWnsMk7/DIo8BF6UEA== 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 Subject: [PATCH net-next v6 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Fri, 26 Jan 2024 19:38:48 +0100 Message-ID: <20240126183851.2081418-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126183851.2081418-1-maxime.chevallier@bootlin.com> References: <20240126183851.2081418-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 --- 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 @@ 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: @@ -220,7 +220,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 }, }; @@ -321,7 +321,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; } @@ -342,12 +342,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.43.0