Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp865458lqt; Fri, 7 Jun 2024 00:22:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU70Li7ilHxDk7dBeba2BzEeZ2bHcOcAQOLmLi8aLFYmia53CMKwVvwQ8y3OrjAen0JC51FXb4/CmZV5ZSSMi+pAchoKRuZSEBIetLceQ== X-Google-Smtp-Source: AGHT+IE3ARDKOyvfBXcm7FMqxHI1/GrSp0VJfOxh5c5ZJ4g+G+Jkl+h87VIFcGh0soQNTdC4NkZg X-Received: by 2002:a05:620a:560b:b0:794:ec55:4183 with SMTP id af79cd13be357-7953c5db78dmr158166285a.53.1717744972320; Fri, 07 Jun 2024 00:22:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717744972; cv=pass; d=google.com; s=arc-20160816; b=ANHh2NKi3oe3s5xSm21c2zd2L3IOI1sCL5hMoDmZEEL4gCJ+w985NnZwH/eeT1Fk4a ChSOav0BrP96E9ilLJot04AMSi6cNAyu6N1jMYNWPFbfrZq+v2T0VnNJH3fBQocz9BZD 4DnwfBlBtYnTvE5qOTCI8tEztKH+Bi7W0F5nQPvZkzKKLVoi6TMnSVt8ecxr3klp2HQ+ cKLECDJJVMPRI7VUbQBoPAFhQhcTp/m2sK4+rUIl3Yc5CmuYoFJ3yrdh+JeqWScdtSlF bbovWR12oEhfGDNqyrQJCoxDz5oGzhzlD2v5BouDALP3EXMbeIiy8t2SLk9pxlpYx+qb H+Xg== 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=aTeslFgz8vSg7S4dfVYAbCiXpnFjv0CJKUEzc0dnIH0=; fh=Dinp91LF2KcnzfyOXGg1vCezYXJAYX+8GKPCxLQjq1Q=; b=grJ4stvv19Jsw85VRwMRXSOLhPVXHKL/62RVazrnrVj79jz0FuHpnygqrxRUlyrzZt D5jr/y/rievqdgU+WXqkBODdJZI/4AWa1Dbhmv9ZQ5mPnBgFrB64KxgKqfx3FSs7qPH4 B2YhUvfksY+9KNZq3STudJ1pb6Z19cjBs75mRJXahI0HpQa6Xf6ikAuSWExBFpR+DikF 8rOmmLeiDHZXuDDYfjwJNrKHQoZ7giks6okM6GCiSTTUUJ9Q8wz3Zs8EiSxr1kOZSbop G+B8xdgvdGZWG9Y4IdB5BQAKz6qPFfbQX0y7/cjZk2QtA6DctYhWQ5iMP/m9kDsxLm7Z X/vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pGBKmdEI; 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-205515-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79533337823si356905485a.550.2024.06.07.00.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 00:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205515-linux.lists.archive=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=pGBKmdEI; 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-205515-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205515-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 0B5DA1C214DE for ; Fri, 7 Jun 2024 07:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7452D158DA2; Fri, 7 Jun 2024 07:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pGBKmdEI" 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 31008156F55; Fri, 7 Jun 2024 07:19:03 +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=1717744746; cv=none; b=gpcu+PNAaLz7ZzV6qReYKaujdMJr0nDmJfUoi/KQ3uxKE0Y4vWp6BrZCArSbJkqc5Wkp2Q3DtuWb/YlybzCr1lnBs6VHwQRNpUCSe2Xz9bK+K2wCbO5qO99SDUGd1LxwyTl6uXNufEkCfzOhIOPNDmD+GjOzjf9BhI0Qh/0PyhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717744746; c=relaxed/simple; bh=e6fTToYWq45w/807OmOw6rMDMu3d5j5d5Sgp+iyhRSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QeqE8OZFYCYYVBwwADKNbKR30zX81tVw/4oiU/D5zHKn2d23+EsNmrFBnpJySIZDudsWumaCpebXAciYipP6sboSDL5dsayG+740SoYdaLJtZugstLriGScs0xucXPBC3v9TKmpT/Ou2Qe4PpqSVcxvOw3EaOEWiIo6rw26TgTo= 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=pGBKmdEI; 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 514521BF20B; Fri, 7 Jun 2024 07:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1717744742; 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=aTeslFgz8vSg7S4dfVYAbCiXpnFjv0CJKUEzc0dnIH0=; b=pGBKmdEInMUWl8TKGdPDRQqfq/xOm0sMC8OAIzj2JGeoBQZFhLRMi4JquHoRpOTJmrD/ZA bJ5WqeuOOMRpOl1Te3Xv02lnERiNdmpxalIzp4WwhYR3c8SEr7w39A7lpPKfOHoc/lZcVb UqIiYrIu1+3lg0tVtC4D3ErsxNHnRvLbykEcA1YP2LWVPpJlgWD2ty0iZMoIdolGFP90/Z 4GuN4RZEUn6tlCJxfiVS56UI2+pWKHnzmz9URUkoIHyWtZnw9bA+FgNUOL9sk+Nj9ef7cu YetbO59+J5YQE1/zfwExUosQOhA7IjSmOaHZOCSFQm35bS2X92sBdZk/Pn6siw== 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 , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart Subject: [PATCH net-next v13 11/13] net: ethtool: cable-test: Target the command to the requested PHY Date: Fri, 7 Jun 2024 09:18:24 +0200 Message-ID: <20240607071836.911403-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240607071836.911403-1-maxime.chevallier@bootlin.com> References: <20240607071836.911403-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 Reviewed-by: Andrew Lunn --- 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 f6f136ec7ddf..73dd4c439a3d 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: @@ -216,7 +216,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 }, }; @@ -317,7 +317,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; } @@ -338,12 +338,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.45.1