From patchwork Mon Mar 4 15:10:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 209596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1499377dyc; Mon, 4 Mar 2024 07:36:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVsj2K+IV4Vuz+eSiopS9wGzyJt+EAYSOIYTAxbtCHw+1BGiO7G7+0ihcvm438e2v9fp6p9WatDUye2zq6v+Jnx4PLRLg== X-Google-Smtp-Source: AGHT+IHGCkJnwQw0hnHIrBEByWHSri9v3zmnA/rHFcEiYQFXkanYppKu07TUHlJXyUUbMW7vCzVW X-Received: by 2002:a05:6a21:185:b0:1a0:e855:b551 with SMTP id le5-20020a056a21018500b001a0e855b551mr7150229pzb.21.1709566582631; Mon, 04 Mar 2024 07:36:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709566582; cv=pass; d=google.com; s=arc-20160816; b=g5IpZxdeDZq3bJhkJtko4N6ozW4vN/35Ze5RLy5vSmMkh0DyHAy7skxIRqGFS4fOLU bBKseoMq08XLlxXktUwZi4noWwO081FG+qKCRiQ86LKQTbKRi/6j9svuiKDMLjvuWH/3 ofOIYn03FNjw/uDNDS6FXzJudA5R3fc3tXuC/Nq2oHTm/mN83v5V6V2i7dw2S4ARW9Jg TFfAco2Gdmee1+TIiK3f7SStfjnYqRJmr93QQieRe3y76b36OaByCdzJ+kLCQX3anxjC qQxuR3BNH16PigtvRCpLRsNhHyJ/LvLahv6NOxK/g2yqRTj6xMKLHoFzrZPhJPjOGZit Zmbw== 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=L/C3xUqQ0tXQjt3ntr9VJkY5S54Kx0JHgdC83Vx8JfM=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=0fiPCLoxF9yJwQ2QE9+FTJFfireSm+2CJthWp1HsLJlJ/5thDMcOwIgjGSYB/WXMkK GSw/50Em8YTgqamN3T1ZKIGqdOBxf0+8XnWDXs0e/mvBpVDyL5U3Y5dCDehpppTRqh00 BJF5gGZr5t0lijFcDXePr2U1RkcD0Rfxlymy/cU3U6EmghMcPt9+Z7jhaamkSEk/Ewex AAqAJumks15lESqysqKeAfQJHQ2KiFJhguUTOQb1kCMlKZpDibhUiMIGQRdJl5UzL0id l5YHQZYXCk2RM+FBsovr0zUFiurlUB9AzsKvA74YE5tJ1iBzU6ipw4nZPo89/8SXbsG5 /9TQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XF628UNf; 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-90789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lo21-20020a056a003d1500b006e62736fdd0si1395164pfb.173.2024.03.04.07.36.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:36:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XF628UNf; 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-90789-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90789-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 22D95B232F1 for ; Mon, 4 Mar 2024 15:15:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A62C5810C; Mon, 4 Mar 2024 15:10:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XF628UNf" 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 91EAD5491B; Mon, 4 Mar 2024 15:10:29 +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=1709565031; cv=none; b=mgE6eFzXVpGs40vhQSmdyRi8c7glrQmE03u8tIeDSDZpG92CQLWHRmalv1HeiHheIx+9gjtNGAx3wUWyRTKhXFi55GXGDkllcK0hs0ownN36LsaXothDSTDb6dZJfQLmJbbyk0ie9OmUa/js+MuKStYFng+cwqMXkoiYrAtpQXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709565031; c=relaxed/simple; bh=YOGyQUz8B9RI8LIdyBuQxqlffVGk5aIswPIGBWCAZ8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bWMjz1uEqkbGJtRbohX19+0fVzj5twSwoFUzubwqTdtiujlgpaCPIG40JQcszEyCkT6IqGZ+2IqqQrum1HZ6j4RqFIwgjhVMpct9CvQaprlxiVvjf8pKyCCayGJZkQUGqAE1QXrUR4movmDS1MsxLjaLMp9vIjeu2lKQyHyuPlk= 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=XF628UNf; 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 A82521BF20C; Mon, 4 Mar 2024 15:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709565027; 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=L/C3xUqQ0tXQjt3ntr9VJkY5S54Kx0JHgdC83Vx8JfM=; b=XF628UNfWHEfdCXOgV9bW+M+j4CFu+YlGp6zlH3E7ApeeTwr6/JpE0pS/uCH9j9yEgXCfh L21d8/OD4NhEpY0wLiiOydL54WRbZ2ZXItyJ4XUZuL6oFzGbpmkoNSWv7BTnW2ywfSddr/ ctkqCPEgiLKWY5i9TG3mKu7bdyd40s02p/1sFzponRkc2815P/pejKkr32OH+yeeg65C9X JHlKYqPRh8/nlGG5l5YmJZY91R9eFn/F/fatp6gdl3KPWJUavncvcCglIQ/I4V0z7nZThF MxnNYC6F2veaN3AA9JrImGgSfXFE3xFe+9+TBYHbHMHMspWmvJikLIkvOccNiw== 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 10/13] net: ethtool: pse-pd: Target the command to the requested PHY Date: Mon, 4 Mar 2024 16:10:06 +0100 Message-ID: <20240304151011.1610175-11-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: 1792610488651262318 X-GMAIL-MSGID: 1792610488651262318 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 --- V10: No changes 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;