Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp152234lqe; Thu, 4 Apr 2024 02:35:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdzISRoMjfu4o9kCDNq1esHyU3lefZVkgJlVwBHgcBZKwGjl6fFGKRrZuOPxzyWb0i04hpQDqQlalis95ITDPqKEswwicBfGwin7dQog== X-Google-Smtp-Source: AGHT+IE2xNlPYIti3XYhO4JJpDdJAXhzVwa1jPr4lbpagci23VP5sIu7wO49lskQtaD+oSPkAhrr X-Received: by 2002:a9d:4d08:0:b0:6e4:b663:b204 with SMTP id n8-20020a9d4d08000000b006e4b663b204mr1860886otf.11.1712223320434; Thu, 04 Apr 2024 02:35:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712223320; cv=pass; d=google.com; s=arc-20160816; b=rJE9EJ2SF5l1Fcwc++1Mk1lOlQOe5rBNeCaBODCW8QfP1iPYncJaeC3w88gdlPjmYU knnbzj83jsNfWP5POD3i0gx2e4ikcWgdE9d9SUm/kkGSgGpgnycJszuduV4Bt8TknZgA 5pVtZF1oSR0PpHPuYsVCgn7cMtmFMNkLyyBKtj4N0jZ+GRGx3cei0O6PefpAwLI9gXJu m1T/kgrXZnqk37lf2WARQEw/K7FYO9jaaidefAQJrkyMZecvvcFYvx25LE0skd4M7Jcr X92Aj665tkXQQTJFdAgL2Sn3JU2A6wZOqy21YpNOUJGMnrZEDeyeUJjsWnhiXuPFgD+O 0t5Q== 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=OkaYzhy84p0EpwjNV7Gv96k07sp8KSMZ6sJ0yZxCEJo=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=PLv/uRquDOErRRIkf9HWCvxwxTPflIuRobIFWjs3fJJHMTa2qGGkKJqn23Q83/TAyI jrm1xHPUj+dnmejUeBVDrbNWEjW8HYLo1IEoUQswdNeeYs6CI5yQRRZ88XDKvL74Q7J5 fNNU9zEu9g/E+MYF4xyAPIhZFBg6F7sIunGDOwJGzHJcBlY79JDshDlOAae8b3oCtS01 8ZWZ/iqfkdq4V1frgsAEc9AbsbZjZVN9DYhq9XtG/dmHgjif3phYFrBDi8vi7iAznU3T 8Vi6oNYuwwis/3+unMdoSn/SGMvzv28ZTgKvJ9G+km+4noGCe2j9VSEi8eRpF2mcoOJo bpOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="F7/TN+wK"; 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-131182-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n12-20020a63f80c000000b005f3dca40648si3168222pgh.880.2024.04.04.02.35.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 02:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131182-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="F7/TN+wK"; 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-131182-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131182-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EA92B282ACC for ; Thu, 4 Apr 2024 09:33:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44C148626C; Thu, 4 Apr 2024 09:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="F7/TN+wK" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 08F7D8565A; Thu, 4 Apr 2024 09:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712223027; cv=none; b=P+eflcgNFdiShYMajMN1vGfQIi6K3VIAlm91tc1Pk/sjupmeKKwq47I7yQGOvQ6yW/ECCLiR9651OhmhRuwkDR2nxo5K6CDA0MDmNQmUgFYbDRXyd0j2ibN/PK0HsJ8+ccARp4C2JrPFZ0qvkSDThT9lY9XOw+Zfpy43oY9MrOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712223027; c=relaxed/simple; bh=rJ80Y81eP71i/x4DCBn3dS+etxfZoUhLjNLZdHjbadg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sk0hN3GqWR3kuabkzuRrd38sLLbT6R2TvjnKQLLMEoIqGMm2FHOTQfyS78jfdjE3y6NfYQgn1UTkzcFZBEhTaFtVWQjM97JfCTPnNRFTP7YtV90yyRaCy2G1JJjDL2ryWmUwbqJtGF5Sb6wA0CaTGWjRWRQrFmcLFuf0pGgHBgo= 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=F7/TN+wK; arc=none smtp.client-ip=217.70.183.198 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 657E4C0002; Thu, 4 Apr 2024 09:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712223023; 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=OkaYzhy84p0EpwjNV7Gv96k07sp8KSMZ6sJ0yZxCEJo=; b=F7/TN+wKX4dQ+5j+mCMAJsNYZ5JjoH62tsUAg92c4FXEb7xgJcAzYmQm2FuqM1LOOjtqNl zdD+T8PTu3//NaXmo71/PSCInljpfXVsr43kuPp8av5K2F0BqQVC81tg90DPjbgr6wwkPR czPqAQSCC/UtPVZ+6vScTY3/DdWf3M/QKnZI4k4bzlpeBC13ZEpnz5STV+fOuw3ehnsnsS 3jBteqy7kjGPaUH5bnoODopfr+2WmWPySC87lOGuDbI4aiqEPMsm/MmTHGPKlxc/hGdr4A Vq9Sd3IBhwanAH+rnyVe0MGeHz7a/yyAZb6OAfVU1M+6AUSO5YE0Xn0EngeThQ== 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 v11 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Thu, 4 Apr 2024 11:30:01 +0200 Message-ID: <20240404093004.2552221-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404093004.2552221-1-maxime.chevallier@bootlin.com> References: <20240404093004.2552221-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 --- V11: No changes 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: -- 2.44.0