Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3111010rdb; Tue, 13 Feb 2024 07:13:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMus6r3UVUODIAXMygTsHHzC46iT5RQddzS/8MLV9XrYs36HXdIIdvruhZDyiZrkXXdc2CgNjpew+ZTUJu9b4ivDdNORdGPmRBSfp8lg== X-Google-Smtp-Source: AGHT+IHpa+MvzBbDWWCfX/6naedmPWv4twDdA0bzJddYuMrOcBnU90e3/CT07gUIfXSnwMKZGnIT X-Received: by 2002:a17:902:b696:b0:1d9:5596:ffe8 with SMTP id c22-20020a170902b69600b001d95596ffe8mr8183585pls.66.1707837204921; Tue, 13 Feb 2024 07:13:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707837204; cv=pass; d=google.com; s=arc-20160816; b=0v5eKwHKYjb2M5eV7Ebm4GHc5oV7XTFeYIRhFfupnd7FD9gQa3TH5ZVUs/+tl5VLBT kqMdDP9fKlpKKqPUkH/8aMe+yQotrPz0auno2O5FG5x3gLocMxp5nH0HfYzq4DqwgUhg CfVglX2DQuiwAkdQBjachnEZ2lRRCS5ZqrGD7dHRWsJmpgvg47+h4ZXEmbE3THLLFZsj tNTYzCiW9kyb6SlwyoDG+5t1JzT7sb4FuvRSlVNWWI3Rz3CLRvgFYv8AXQR5S/kk4mkv TUo11lcasayrVkNewjWQ8ZWoGS7ZnTd6di6MTOmzyRYHO89GYaD21tbBekm9GnVgqZaO WafA== 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=aWTuDer7pateN9r2X0Jl1ZpbA7JJOYc0nb5gl+3hDaA=; fh=I9dXaBKhP97R/Tc/vnasVQcRH6OQMP5yLAQxdcMnXZE=; b=LkdE2hCpt8UGKlXCb4cgUebC2p0HPANt8HA+9cnS/U1bE7wihnJyW+F+T26KqWzRpm Az7q4uIp1+Xzc39bjtRpJ0BfXIH7OBLJBO/W8VvQDUuNuesu/lTfCisAiQv9yrhNRVLf NpnxZLVVR88xFlV/ozybyKmQBbyrTH534gbXrKxn5ntZHUy2YJn+yQMJHmuNnz+XQy0d K6sl6tqaRmdj/tz809N2g4rOE7JIyRwXib7wdavyBfxqtv4v+zdL1i2xNXd4smC+HMCb P1eM1wlSDJSvNZzKffTYreMGXnc4w3CopB7Z7daMm3hb5KtsqYugW9H+SLONztUwU4X1 Mi8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Sao55gVg; 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-63774-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63774-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; AJvYcCUN6aKzLaXc7dTwSS7Stfmuk6tFaNz/PmnPrPJv4xysRCmmYxAHX0ms618vQqh6MFg1XwrNMSQpvdSxLdv7FWxALfbySBbkdF6KQ2L/oA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mb14-20020a170903098e00b001d9cc9f85a7si2106339plb.566.2024.02.13.07.13.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:13:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63774-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=Sao55gVg; 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-63774-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63774-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 C6530282642 for ; Tue, 13 Feb 2024 15:09:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C16C60B9B; Tue, 13 Feb 2024 15:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Sao55gVg" 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 EB89E60864; Tue, 13 Feb 2024 15:04:49 +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=1707836692; cv=none; b=QXhQJ2+OETdFFnsjcRZu+Qcg7/FT4Z8lq/WOmtVo7HHYjcN/vHEWn12yOYuGXGmw1+Tf4f9e9kmTIzSNjN56T01tSncA6rzS64DtKQNbmm2HuTONu73QyaGd6LzoXUzTS5uf1uZHgyGLvNnJkX9jTaNaGbbLLIdnYv+qY4QNqQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836692; c=relaxed/simple; bh=eikMrHfEtel/upPwWFp+EA1Ekjg5tsXxytsOi21E0R8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UgPapb7Jbm9XlfYpZ8qS2OOh+iWMmDN+mFSCjxDx36r9FAQAWIGdhwe9JUBCWgMJvbRINnc+Iqnov0i++84RqzDp9T7qfwfTCgB8g0kKN0td2m7A9ygtzXsVtA3xWPuCZy1OUetXhma7M4yzUrLB/riIxeF7DKDYRRE/kK1YeJU= 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=Sao55gVg; 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 5DF711BF204; Tue, 13 Feb 2024 15:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707836688; 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=aWTuDer7pateN9r2X0Jl1ZpbA7JJOYc0nb5gl+3hDaA=; b=Sao55gVgc6fpoE4a5Djs3dBVgpi5WG05G1oMrPiw3/r9LhnWmtD4wuNi/ZMCZoGffZJLKY 92seeH3n2bRzJXEr0tPkUytbS46cIfN3PM1C0yt8cycDee7ul2bQoWNkYDBiGWjlFgRlAm ibx7l+0ANMGBqiHsc5XvaE6ArerPJgYBlo0vtVLXqTWRFOEfU2tVXo/GdNbyPnqtGMrOAF lBtdU52y+FZPc2LrxMi+KF67PDWRaJAro5tqr2JFf3uvczRgRFCditvWjgnGU1S7+zvtbF 8cPBX54nrLswGzmFGyEfom9wjQBmznqJFy1Dk5xmTo5QuR1p/wjI5OQnGXWlDw== 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 09/13] net: ethtool: plca: Target the command to the requested PHY Date: Tue, 13 Feb 2024 16:04:26 +0100 Message-ID: <20240213150431.1796171-10-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 PLCA 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 --- V7: No changes V6: Use dedicated policy V5: Added Andrew's R-b V4: No changes V3: No changes V2: New patch net/ethtool/plca.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/net/ethtool/plca.c b/net/ethtool/plca.c index b1e2e3b5027f..43b31a4a164e 100644 --- a/net/ethtool/plca.c +++ b/net/ethtool/plca.c @@ -25,7 +25,7 @@ struct plca_reply_data { const struct nla_policy ethnl_plca_get_cfg_policy[] = { [ETHTOOL_A_PLCA_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), }; static void plca_update_sint(int *dst, struct nlattr **tb, u32 attrid, @@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base, int ret; // check that the PHY device is available and connected - if (!dev->phydev) { + if (!req_base->phydev) { ret = -EOPNOTSUPP; goto out; } @@ -80,7 +80,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base, memset(&data->plca_cfg, 0xff, sizeof_field(struct plca_reply_data, plca_cfg)); - ret = ops->get_plca_cfg(dev->phydev, &data->plca_cfg); + ret = ops->get_plca_cfg(req_base->phydev, &data->plca_cfg); ethnl_ops_complete(dev); out: @@ -129,7 +129,7 @@ static int plca_get_cfg_fill_reply(struct sk_buff *skb, const struct nla_policy ethnl_plca_set_cfg_policy[] = { [ETHTOOL_A_PLCA_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), [ETHTOOL_A_PLCA_ENABLED] = NLA_POLICY_MAX(NLA_U8, 1), [ETHTOOL_A_PLCA_NODE_ID] = NLA_POLICY_MAX(NLA_U32, 255), [ETHTOOL_A_PLCA_NODE_CNT] = NLA_POLICY_RANGE(NLA_U32, 1, 255), @@ -141,7 +141,6 @@ const struct nla_policy ethnl_plca_set_cfg_policy[] = { static int ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) { - struct net_device *dev = req_info->dev; const struct ethtool_phy_ops *ops; struct nlattr **tb = info->attrs; struct phy_plca_cfg plca_cfg; @@ -149,7 +148,7 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) int ret; // check that the PHY device is available and connected - if (!dev->phydev) + if (!req_info->phydev) return -EOPNOTSUPP; ops = ethtool_phy_ops; @@ -168,7 +167,7 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) if (!mod) return 0; - ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack); + ret = ops->set_plca_cfg(req_info->phydev, &plca_cfg, info->extack); return ret < 0 ? ret : 1; } @@ -191,7 +190,7 @@ const struct ethnl_request_ops ethnl_plca_cfg_request_ops = { const struct nla_policy ethnl_plca_get_status_policy[] = { [ETHTOOL_A_PLCA_HEADER] = - NLA_POLICY_NESTED(ethnl_header_policy), + NLA_POLICY_NESTED(ethnl_header_policy_phy), }; static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base, @@ -204,7 +203,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base, int ret; // check that the PHY device is available and connected - if (!dev->phydev) { + if (!req_base->phydev) { ret = -EOPNOTSUPP; goto out; } @@ -223,7 +222,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base, memset(&data->plca_st, 0xff, sizeof_field(struct plca_reply_data, plca_st)); - ret = ops->get_plca_status(dev->phydev, &data->plca_st); + ret = ops->get_plca_status(req_base->phydev, &data->plca_st); ethnl_ops_complete(dev); out: return ret; -- 2.43.0