Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3110910rdb; Tue, 13 Feb 2024 07:13:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPGaJBs1a4q6c0tO3kIcpCGFaUyplRNNLdWZ/Ql0t9HW0/3+fyhLt0u5ajxAurm7RluYK9xUkUtMaQt2OGGSAHr2YLu+sbTqQUP3pERQ== X-Google-Smtp-Source: AGHT+IG6Luk+0dWJw8jONhkflovBQj0SJ+oUPD+F5gB1PdnFqpSPtsuyCoqQ0PwO9Uim2bZlC+aB X-Received: by 2002:a1f:e001:0:b0:4b7:a77b:299 with SMTP id x1-20020a1fe001000000b004b7a77b0299mr6218945vkg.16.1707837196057; Tue, 13 Feb 2024 07:13:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707837196; cv=pass; d=google.com; s=arc-20160816; b=AOpI46m0AvKFbuC4wANf8/h2zvaO3QrQPSmfs5dZaiYtd1XTL/UcGBnaFM1+TXlLWw 93287/SYXMdKo9LaMHyCE9metdV9mV269stgOsAd7xSIDuo20L2yAC1w4bUZ/f7Epv+C ySWM19VQT3SY79bGd7ufmWJy33D3Z2rLBP2CyWq2S+9gxjagnZIb9lh2noHCcXzSoJLN R454/9HvB+vruwfmj7YwlJ/ah7QPf271H51X1Gae7rQ/l2y8HF5nF3m/EHfrWTi5bewy jmas5nz/MddbqJyy+DCoxU+23hz1kJiz0UxbwOUroZjkm6/foID5iQ7QW1AwaIzHGjWc /v4w== 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=bO6KG76m4Nd9rZadZpKzqEv/4pO6oyFeFkjBHB+TjVQ=; fh=jhRzrWPqhdgHg4PbnqLVzbG2QSCQeW/5Kflr5C1aqgc=; b=tp/2BS2mcyc6ief/5L66MCFLjqiVVhQ/wGK7FzXKArOLUdJhg4wPVNr16Qo75G6lVS 87zEoewHCPLUQ3ydoUWnKZiioch5ozwG+6ZIOChe4wlog31h2xr6hgY7/40sZr/BjR/T 6AGglCH/mjg7of6tcA49OkDxwZsdHx91vqzPZ4BG6JtKe4+0H+X05lJxWp0WwEL8tbfe Yzr81QZzyYPsydgYEQ5Dh/NtRvE04cv50ntuweMVex/4Bvyz0rwGRxoF33b2XnWG5+Il +dUz7qiiYcR5zgSRzNsDHRCbs37omh6YaQdxIxG32+9MI14noDJ5tQWtZK7iG7uTtJDj vuXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=HLCQY+BB; 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-63776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCVv9A1jbAymooJ8f0CcKZvyfCmSuaZB9auu6MxQJnYQTld51vHYU9fOUQOAI00Vqj2N1JmZD8bRIUOqLrGiBBWJjnB/kUFzQRh03dLPgQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c9-20020a67e909000000b0046b1803398esi1041422vso.810.2024.02.13.07.13.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=HLCQY+BB; 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-63776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63776-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6323F1C26434 for ; Tue, 13 Feb 2024 15:10:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B7E160DF0; Tue, 13 Feb 2024 15:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="HLCQY+BB" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 9ED235F551; Tue, 13 Feb 2024 15:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836694; cv=none; b=JAb/IdsEQOTvMY0ni5tz12LDFO2CQwAtLU+8xu3tzFYUmSJqyxKSDE6aDhGGITsIHtZjnVmlvf9bUgZcejctzCoUw+qwd7kMxxf0nMv7sm9ycLyQJ+vG1D8YEt8CYFfLri18/cSijm/kbnAqVhJST6O5Yi5Q9r+b3v+lWf4nmrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836694; c=relaxed/simple; bh=X3c8gHGtjEXMd3BlGmG1D7pPDqJ8xb/YjEepUdeKZpY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uf7Wt1jjLlShgv5xeKVqZbciNAgiI6Er0bsjBTsbSyiRruRlUeqYNH1OPaeHvoGZSSVaQtmZ4kNGPh1SsY1Ocp0E/pMRg1qrorB4WAg4FNU/SpkaWxON1TVfOUtCLv7VYUosDDrLgMZZL/ay9q8pmqwIv1RXV/acQAMPum877Ow= 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=HLCQY+BB; arc=none smtp.client-ip=217.70.183.201 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 CECC11BF208; Tue, 13 Feb 2024 15:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707836691; 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=bO6KG76m4Nd9rZadZpKzqEv/4pO6oyFeFkjBHB+TjVQ=; b=HLCQY+BBe8wVcrVRk88zAYSxqvNgUwMkS6FFNjtuxcnPn8zLqNuoQH5QfWl3CSnhRl6tqC cm2eIbC5cVPfsj9j6SihKvY7M8BizvxdL4cOOCraCqlXLJe3KSFszLPiWLzoRXPdJ0BIVd pKc49YV0qLQI61maF4MrvgOD6KQBQVpH02XCSkpPOSL8y9zsnqJvtLQfLftij2wXh/JngC gmte7iXNZKXnNn7CZHhrCw20A0Mykw4ZdrRHHjjV/fU2RGBCsoYg6f683JegsH4b477PwL tCnmNt0/TjhsSNg6/wVmyuR7NEIvk55aoWsfhnNrk0TOGdsl1KH4Djqe/WH3Qg== 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 v7 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Tue, 13 Feb 2024 16:04:28 +0100 Message-ID: <20240213150431.1796171-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213150431.1796171-1-maxime.chevallier@bootlin.com> References: <20240213150431.1796171-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 --- 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.0