Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3111118rdb; Tue, 13 Feb 2024 07:13:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUa4Qr0rP71fZi1zbieynoz/oyJOFIOD+CdGSHdBsOZ/MdFEpNUY4u75+7uGdNwnMB182beBOvPvACcJvjF4moFQQuI9gyWTz4nVerInQ== X-Google-Smtp-Source: AGHT+IGyZGzWIfL1d0MbtD/fLsH9tVH6CbYpBfxJfYzAisj6PGXO5UxR8sLFcax9bp16+8AqArvr X-Received: by 2002:a05:6a00:938a:b0:6e0:e49d:1b75 with SMTP id ka10-20020a056a00938a00b006e0e49d1b75mr5268673pfb.21.1707837215976; Tue, 13 Feb 2024 07:13:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707837215; cv=pass; d=google.com; s=arc-20160816; b=HsUWJ9QioIexl3CRGpBkVUGUGXcaqg1E6lH1sLYmI/vM8MSTi0vi3zPBGtnTrvXZJR ZrAt3KHci42gaq78cyxd9apkdsn8bDurK9F18Om0Qmq7XlT8qFpLkx/edlEQ0kNPIY/9 7EZAoYy0CU7/akat2kkN2ZE834yYEmF5gjnInUVbntHqGPTq2YjRr2vBY5wWoqx5MQvl 1ICz/xIxK01zOgr/upjtwW5VbfFvmmjVX8bvQCRJZZc88jxUR757EgP9jyrtvrM2zyEU MFSnWc6d/rqKxkm4Rkp4gDmi5X1HZNHmjcin7i76NJSS9/TyiZvT9nHYWwyhC4gQPu4G iI3A== 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=cKWt/5oJoHfaiL4BUEaS6eUa1vxrw2RfNzNw8xM4Juw=; fh=rKuK99S/s7B5ZqNMmUxmGQOCj+sLEBXS9ivlTnhM5NE=; b=wbhljvlyC01lYAvlGlg8VluKvMhFpz84kKcRbbHpEVczsBkBPfjykmCvN6pu9Q300u jH6oOWgQpYGloF21OuGlS5oKcmvESX6dFo0gAqr6tqWP0DihzvgG0sNedD3hZDr0MN0W hC7Hu0R6rrUaryN4iGF+O2ZUH76N4x+BPiLTzHZDRIEeaqUN1YO96HJlZaQSp/A60I6m Gu9rH2gwo/8DiFlo+qBzW+E5xlEV7vmi7WDm1htmeKxwJRF/GCPlrM9nJldb1Iy7uDzf a73S5/PvZyvb826q5t9won559HyDVS1veDBl3Ct+0iXZ9veW5YCwsYWEGfHzRPqUYl1o fdyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ekwSQmXg; 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-63775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63775-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; AJvYcCXNhLmZHv6VBuaaIOBJGc8p/4YGv1e597BcfMek7rHVgE4OhH/g/A1xMo8+afLG+67ozd/f5/ivZv501P24cK94PorPj0FQ887Ch3AGcQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h17-20020a633851000000b005dbd5035dcdsi2096986pgn.192.2024.02.13.07.13.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:13:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ekwSQmXg; 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-63775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63775-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 EE3B02839FF for ; Tue, 13 Feb 2024 15:09:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F05560DC3; Tue, 13 Feb 2024 15:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ekwSQmXg" 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 37D0C60888; Tue, 13 Feb 2024 15:04:51 +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=1707836693; cv=none; b=Ol1uqVxadDov9hBN42wC/m7IfIkDjtOqtaJ6lqL8ZH4vN46u3jpyNjx+DzZHOd1cm7uOMQg/jgZjnwGuMa0VJ29bMzJa3+lofDqI5HSbBBfK4jQVroadG33/ZIgGqhiKK5H+xDZw/K2Os8vht+JBRjL315QKVVcMtxfA9onMnlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836693; c=relaxed/simple; bh=PRoPj9vmIk/WhxkPqGCA+tEdR4c30S4vfKve6QRCLJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y/mfthQPmLjxO9CGN+45pbBLLSOcGA6O6kxtLAQU+0rhUHiYRSiOzunJvZ9OSD4MAgTL/LcZqdHmjE4hC7Vxu/OXteVsU3BP+qJVm/Ch2uzSVjWJof4mfu+4faG+HXYuDspBhQu85eLhm9FSRNTF6bVCpIC3llXOcLsTEPNlolE= 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=ekwSQmXg; 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 921401BF205; Tue, 13 Feb 2024 15:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707836689; 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=cKWt/5oJoHfaiL4BUEaS6eUa1vxrw2RfNzNw8xM4Juw=; b=ekwSQmXgiANTDBFSLbbTWVfYid2lSwLzrVLqQ1EvLUS21HJ9ZSWvlhlysRY/w41tLcjU/N +3O/ks2ORyfdkvx/OQCp49+M1Y/MR2usNFIpYH7czt21Lq4+FysUZp7suNeD8eRFrdrHej 5CnPlc+Ehjvfxv5S30rlT1Kef2VCej0aW6sgfiOI5/fIbcsadVN0g7g4SmWVwHB4VUGVZ2 N8VyrNO7JvBwk61uMboiu2XmBoZznhuZP9r+V5P8W/LxFfwII9jRs6ZSeNJ217Udcb7saj s9Nd2BQXaVXnj/HyOUrhxYvA/BGb75Uapchcd4KO/Re6NhJ1sSYLIMYuWsuq5g== 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 10/13] net: ethtool: pse-pd: Target the command to the requested PHY Date: Tue, 13 Feb 2024 16:04:27 +0100 Message-ID: <20240213150431.1796171-11-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 PSE and PD configuration is a PHY-specific command. Instead of targeting the command towards dev->phydev, use the request to pick the targeted PHY device. Signed-off-by: Maxime Chevallier --- V7: No changes V6: Use dedicated policy V5: Added-back an incorrectly removed check V4: No changes V3: No changes V2: New patch net/ethtool/pse-pd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c index cc478af77111..be50d79122c4 100644 --- a/net/ethtool/pse-pd.c +++ b/net/ethtool/pse-pd.c @@ -28,15 +28,13 @@ struct pse_reply_data { /* PSE_GET */ const struct nla_policy ethnl_pse_get_policy[ETHTOOL_A_PSE_HEADER + 1] = { - [ETHTOOL_A_PSE_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy), + [ETHTOOL_A_PSE_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy_phy), }; -static int pse_get_pse_attributes(struct net_device *dev, +static int pse_get_pse_attributes(struct phy_device *phydev, struct netlink_ext_ack *extack, struct pse_reply_data *data) { - struct phy_device *phydev = dev->phydev; - if (!phydev) { NL_SET_ERR_MSG(extack, "No PHY is attached"); return -EOPNOTSUPP; @@ -64,7 +62,7 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base, if (ret < 0) return ret; - ret = pse_get_pse_attributes(dev, info->extack, data); + ret = pse_get_pse_attributes(req_base->phydev, info->extack, data); ethnl_ops_complete(dev); @@ -109,7 +107,7 @@ static int pse_fill_reply(struct sk_buff *skb, /* PSE_SET */ const struct nla_policy ethnl_pse_set_policy[ETHTOOL_A_PSE_MAX + 1] = { - [ETHTOOL_A_PSE_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy), + [ETHTOOL_A_PSE_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy_phy), [ETHTOOL_A_PODL_PSE_ADMIN_CONTROL] = NLA_POLICY_RANGE(NLA_U32, ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED, ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED), @@ -124,7 +122,6 @@ ethnl_set_pse_validate(struct ethnl_req_info *req_info, struct genl_info *info) static int ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info) { - struct net_device *dev = req_info->dev; struct pse_control_config config = {}; struct nlattr **tb = info->attrs; struct phy_device *phydev; @@ -132,7 +129,7 @@ ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info) /* this values are already validated by the ethnl_pse_set_policy */ config.admin_cotrol = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]); - phydev = dev->phydev; + phydev = req_info->phydev; if (!phydev) { NL_SET_ERR_MSG(info->extack, "No PHY is attached"); return -EOPNOTSUPP; -- 2.43.0