From patchwork Mon Mar 4 15:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 209579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1486055dyc; Mon, 4 Mar 2024 07:15:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUFX2bCvB1UAuPBhyVO9v0qYnXcXx0l8lHE6mgUneKILfVFNllWrKV4bRD0/Y6lDSK/hWdMB/SEqhK4/85CwAdmCgj8iA== X-Google-Smtp-Source: AGHT+IGFRwL2+yxSevbA+YTDUqmyoWtkw6C9ZoyJgTgizij398yNwjYMKC4le/lriKtpGeAjMTfv X-Received: by 2002:a05:620a:2483:b0:788:528:6fc with SMTP id i3-20020a05620a248300b00788052806fcmr12006943qkn.47.1709565333982; Mon, 04 Mar 2024 07:15:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709565333; cv=pass; d=google.com; s=arc-20160816; b=rIK6aE9Bm/mmICMtOxtdQauj+Sqs4ZWMhdglqaXLOa4p1AnqUzIutBBdWUxKqsjK0I ECDRhlNCZf9ZWUL0mgL1O82FL/X24+PgRm/ce8CObeNZXnWE49EHdOt9XWuUI6p6f17t m1qgeRnSKP48CKiQc41mJHSZDvChkeA02xWr4DW/KEFPXOgLY9JHwH/jv0+5aRlr+vIa Dnaa0XytAfpUKjlcY4SE0kQqrPAOrDm/MitOK7j2EzGsNOr3VVsJc6Q9ByrI2VkKrMHR DRKynGQ855cTrFtmBM7ZUX1Jsb3cPh3NcDiNCV5AP+P8H55CuX4vggdRbM3XwsZ4T20s r6wA== 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=IxDCgpZdBlnxrye4NnTC+31Jemid+FYTQs/BDr2oHKg=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=fAnehx2Bm5CS/eBH2q3HMWqo26h5N0PCzcAsZInHS0/rUGdT3yvXgx/nXSRhzl/MUr xlgSp4L5ns7olCY2b/hYk5VGvgrRq9sjn4+h7W30EpZzzANgGiZlKMGzaC7SDTr5/8PT kw0wJo1QGQFBSSIV/hubkZ/3SNisG+iZ8X/hMViza8xKMOT+pZ+5GjQNJLoJfmTrkcxg 7OxKH4Ta8OF/nGB5iO9eVP0fBqTMoM74RvgQf2qPx/6nIwcnEcQ3Do1+n8kFUyl/GpcW mpBLanMn3Rjvv7e+O4gwBpmYQiaqs9UPJtSht1Cq5rxnKbzsuuXYG+6fH46B7F73iiWH 6F8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="SNLEK/cO"; 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-90790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90790-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id az18-20020a05620a171200b007882d2ca73bsi1509580qkb.111.2024.03.04.07.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:15:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="SNLEK/cO"; 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-90790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90790-ouuuleilei=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 C1DD81C234B1 for ; Mon, 4 Mar 2024 15:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71B915915F; Mon, 4 Mar 2024 15:10:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="SNLEK/cO" 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 8A9DB55E7F; Mon, 4 Mar 2024 15:10:30 +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=1709565033; cv=none; b=UZaWBAeC+KiC8xuLmVEIMxrwlAXHJ2mGn4uBRbHB/eviyUUX6wbtrcCa1HVkLeRiqLZfWWG/TFQ1aIYUwFyroSmJQb6ZO0XiuBY0dFnb0KkYjVYmzuGyCCGWN+405w3U/AOkej0iC7AEwkDtHpt7k7/81qhges2DmdOsgpGKmhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565033; c=relaxed/simple; bh=f3owsytC0v/VYAevNtIiR3iSVCtA2/W082ze9xaZh5U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FIGf95N6i1sdNdDtx+H3FDegA5+ZCl3umoemUW6IqMFD9GCNeQyBntDClE9EyCrXlflvw0srwal5lL29qI3Ndm+jGFvt/FC81Xt/qX73XOv3JtW1tigeosntmuVX2kSKNyMdS+BEDL0pRTSDvjm/Oo9CZlgHgzSWaiYyi8Vb/Go= 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=SNLEK/cO; 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 126E91BF210; Mon, 4 Mar 2024 15:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709565029; 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=IxDCgpZdBlnxrye4NnTC+31Jemid+FYTQs/BDr2oHKg=; b=SNLEK/cOmk8vdWQcrsfensmPgsFT6YUQgNbT3rCgFfy568tEX3c5V94/x/95UVgfRUv4jO WUSs8BVi0UoJyEpVlZ7Istuq/pxWbXgYU2vC4ohzqqExq4+aWxiE6SjPsOsJ81stJubhOg OiMKZbCCyQo+JwiRtMHbTIUyZl6eil+htL32lvM/adcY8MR1coubId16dQn6mhBDeJu7n4 Mmp2pNtxCIPGHytoRuBJXYlG1Z/4wpAdJpWSFhCkYX+/JDnbJTU8z52VSOynNnTCUogXDx 90CAnTxnM7oERZ5n5GmJLzDIzcVAgg9iHT0GB5iV+LxMuCZTtW7bU2dFnPRxGg== 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_Maincent?= , Jesse Brandeburg , Jonathan Corbet , =?utf-8?q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org Subject: [PATCH net-next v10 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Mon, 4 Mar 2024 16:10:07 +0100 Message-ID: <20240304151011.1610175-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304151011.1610175-1-maxime.chevallier@bootlin.com> References: <20240304151011.1610175-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 X-GND-Sasl: maxime.chevallier@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792609179268521022 X-GMAIL-MSGID: 1792609179268521022 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 --- V10: No changes 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: