Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2506267rbb; Wed, 28 Feb 2024 04:13:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWUph+y41f2120Oh/ooVsTSgnN9H9DYjfxyHmNsote3EYd/zqGXPdnXDzV74u7u3scyn5aAUVVw2GBqkSqB3ITLHwZmRMuMtPATYRnUGQ== X-Google-Smtp-Source: AGHT+IFsTbt46SzoaZqQTnvtDKnQ6OuTwsDsAj9uxc8pQjvRXIploOBxV2+EID3QBA/kIj10hHm7 X-Received: by 2002:a05:6a20:8f93:b0:1a0:e220:d40b with SMTP id k19-20020a056a208f9300b001a0e220d40bmr3737560pzj.32.1709122387975; Wed, 28 Feb 2024 04:13:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709122387; cv=pass; d=google.com; s=arc-20160816; b=oMHtWcAZ+zqxjepvfHsnb/z8tfPkAe6miUK8SakKQx/E2U4ApYfzVSGMZ6Ul9y5/Hp Wm8zS0UEA//dA314ExsMFVxSQktu2Ng5s3Ep/IwvXWdRaEcXM8UFNLlIPK0oqN/Wiww/ gY+3avsBHRlChD5peKXpX+/hhzIsyjlex+K1vJsXsXSDwvs1lvGtQNjLCI3fs2H9yMrz jPYuyT968pnF6TyiSpfFBEAaTS96t7pvwh740wei7KEXhdt0aCbxJ89u0WdWUz1ohiRp fhQtc2mp69w1/saDokxbkHnV8HccwGmLV58l7mc8WslEWPO+QfwgPozixhUR8eUrDSL7 R99Q== 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=9nTsioBOPXNMQENkN02HiFNofPk7GXy9TuLuvq8iEI0=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=o0DtsDEFkLBrK8wVATmjD7kPbSVuj0dbwBB/I4aWnnppg1BlaPKvIDyR0oj++46dmO lenutW4dXfQDqW9ctaY29u+v40XdmvYU4Y25rQIffr1rgLIx0TC23vYt2hbTb0uA76ha hMNfj1X/MfhcjjcK2QDtv29iEFEettcKpBDdXl/qXOicHOS+8ANi8fptVVTOOc+er9Qv dQK+m59oe//79pL2wItXe3OZrcplJBBg870Vy92WTw6sudNLKlTYXzrPXeaJ8nu5u1wn IdKUEqqQYsdgpO7nQurfUKP6mWoU3M+DWsiR1/y3PtkYFgQP/gvHP2tRcYzz46u7W3zW arDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jcBTj+9p; 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-84952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84952-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw39-20020a056a0204a700b005dc85a7eb1dsi7595108pgb.299.2024.02.28.04.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:13:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84952-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=jcBTj+9p; 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-84952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84952-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 20CFB2955F3 for ; Wed, 28 Feb 2024 11:51:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6664D1474D8; Wed, 28 Feb 2024 11:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="jcBTj+9p" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 492DF1332BC; Wed, 28 Feb 2024 11:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120871; cv=none; b=ds1/aI25YQArEWENHbAzNtsuJuiu1ub0AMCMdQXHq3bDosq0g7IYzwYLA3vc28+kwQynUE1Yrq+pCbua4M8LIhdCSK32tYvftXOFxhExiFHkEtmxPln9GUnVMjSoIumb8BXvFDXvH25QS/Ok2P49cracWBseKNbk+L4aoKZPc+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120871; c=relaxed/simple; bh=lf0zYs45jRPiNWr3cpDD5gYlS/ONbxKrIfLSthH1bdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jDDuEq0a1eClY4zKF0nP5LdtKvkGXKcIaUWYDahe66oLd7UrnF70KYop6mW/ghE3ykVozuXJxgAUrUJmedYxSRlm04eWTf9vp382H0uFKZ/fqbVZncZwLt3wk9QeV0HxP8+qNPVObEWhqld4gnIsaalagrNUbGa7y5hv5uIkYH0= 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=jcBTj+9p; arc=none smtp.client-ip=217.70.183.197 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 B13091C0007; Wed, 28 Feb 2024 11:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709120867; 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=9nTsioBOPXNMQENkN02HiFNofPk7GXy9TuLuvq8iEI0=; b=jcBTj+9px0U9ctQlr9mRW+Ejo3PEANUyDyk3RR6LHU+8BXAdtKBJ3PK+RuqVcuJEGdffYU iYKcgw5tNLub1rw9HIj0eBkinSdUyHg11MJcQgOT+tv0+oBZJKMHZkbh26b54dZh5dwA7U QPJvuOiUWOYmfZdRLzEG/nUNkU0aq+mRsxj48yWz9gZqEzwXHaL54vXI8BE0lGDucbDG/X 3TuV4IKNKgeCkwPtjIcPbtc3Ucm3fwnaWPqYBkvxV8MSeQ5gRSOnoQeBOwyQYDzW68UzEA YRuz28rLdIq8Uin1WNsJJ3hclQpwLpT5nlt5D9k4dzrxnOvjibRruhIru3bJMA== 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 v9 10/13] net: ethtool: pse-pd: Target the command to the requested PHY Date: Wed, 28 Feb 2024 12:47:24 +0100 Message-ID: <20240228114728.51861-11-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228114728.51861-1-maxime.chevallier@bootlin.com> References: <20240228114728.51861-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 --- V9: No changes V8: No changes 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.2