Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2495231rbb; Wed, 28 Feb 2024 03:51:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHAzbcDKH7jXxLk02EeMSk5N9PYEHGUhaZnjZx0HPnzRsferzNdDAKuYpNlon1J0VzBV5kjxwj7r/i71TWMje0s1m8cJ0ng9Zky7sv2A== X-Google-Smtp-Source: AGHT+IH7GHfAuVD1VhBGsgMgtwi3a4ydkm5NHlbxNNUzZHTnR6I5DY2nMtC0fgR+8NHoaLlkgfvM X-Received: by 2002:a17:906:c34b:b0:a43:f341:d21e with SMTP id ci11-20020a170906c34b00b00a43f341d21emr1110050ejb.34.1709121112714; Wed, 28 Feb 2024 03:51:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709121112; cv=pass; d=google.com; s=arc-20160816; b=hJ6/XVvM/FuikOkFG8mpxQGClJFw8+sbNPZqyGNdgZFwip48+Jq+FkFzjO922n7UDU +hZbsSLgaPUy7xdFdOPZyEJL793C0z+Na62fifyWmNADAvg1IRCxmyYyMMM4Sdao9bmu PjwZq5bZlDBC8dSnvj5nswBxHLoH/+qrTxWyF2I6mxSm2SpeT1DzUPCWqcsmfcpBMp8Z 22wwcSylKWcn5qGLBMD40qS9q2zJc/LOEO9fbHfDrnklGxOLOlMEAQI8ow0Ime6kWzPZ mDj6doFyyk2+PMUx2rPN1ZIXMHCJM0LOklKcrzfsPePvWRWPKwcikMy328F6d3MvUdxx peaA== 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=sgOogDtanHEd8bm+qGwxyE50KWI8Y9AXr46d1GNftJQ=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=wH9FCQXuvc55zRCmTTnfqTiE/0KIn4DXLHxk3sTKkBTmm93sIqr3neLpk3rasc21Wo lLDnGsbX57myuXFyIKRU5ZR7vDyd3M1N8KpuJtvuSgQybGxSSQwMip8jSdkOSCnDoWmB pJ10LQ8+mVu2FzQnAQ+7oriusR8+8nEUC8wByEz1dVwwcPaazP1LH8dg6wGpRnucte22 oxE9D8zL8HAn3qiJGZg1i45S83d+M+PMbIdyhCsPOS9T1BvLHMGPt9GAR0MGD2deG3nM McS0bMwB2ALzeF/3CEAk9Kx/l2npoG9RXoyTE80WKPx11tVgFahyGY42vdCCEyOvn7+Q cqmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TDDVoFaQ; 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-84953-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84953-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 q9-20020a17090622c900b00a43f9ff4444si593186eja.752.2024.02.28.03.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:51:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84953-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=TDDVoFaQ; 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-84953-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84953-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 88D901F22266 for ; Wed, 28 Feb 2024 11:51:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 878C5149E1E; Wed, 28 Feb 2024 11:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TDDVoFaQ" 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 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: 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 --- 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 @@ 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.2