Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp294141lqr; Wed, 5 Jun 2024 06:26:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/kOjRZJonfGPI4CVHUT7IV5L7/KX2DXjVFfQtel57iL2zHXMyaC5ElHU8ja7SOHg31S9mmN0Q7TEimEqcwIgUCytUbaXfFbCsGBkGng== X-Google-Smtp-Source: AGHT+IH0rbPOqeIiE8WKVn9mtkHCpP5/suuRBoRSyJivf6qCWp9KgaHCxuAKUEdiiKM7DJurY3u+ X-Received: by 2002:a05:6214:4b04:b0:6af:232a:1910 with SMTP id 6a1803df08f44-6b02bf10255mr24585526d6.7.1717594013805; Wed, 05 Jun 2024 06:26:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717594013; cv=pass; d=google.com; s=arc-20160816; b=xU82NP9kc2NkWeZrmBdh6AAObe0OI/jQfLeTK8oI0kzxD/fkS4pGXB7FSveKKFC8fx xn5hBJqIY30X3GMXD6VqOyP5lIDXvKnIrHsCQv1wOTjD0OwgI/BT3Ake73wWwqp1yQ/D sqxP8FV2ALZbQvzpErBkVCtmfmEiZsm2Ile0kK8YF/EJnoVoiSQT/SGbxtBVHB09pVsq 7FuDBvGCUfT7FlTsIv+O8B9PE2phQNyf7v59BhHxnqPS7zQrn8ax4jM5Dz0rPimE1HFR ADL2/LUVoKDM8u1U23pvIFrbgMDF/7/d5NqM482CbnA7PnmrEDURceS0rma4FBfHbbmT E81w== 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=xdHRxZdIVtQDmtg/7Szi9R9ppNOPI4/sMJdJvlp0D74=; fh=Dinp91LF2KcnzfyOXGg1vCezYXJAYX+8GKPCxLQjq1Q=; b=n8DOc5luCJ8NDEHzKwohTZz37X63RpYvdWG9VeZtaRtjgjn+aBEE5Q2ADP8+zUphqI tu506VZi2RTtfhbDFyEGOxhsDPxKRXTM5uIlxp7EDyQYtYgqLSV2npjX3wjZcw6q9CcA Eeqcx/O3G6PYO7VhmwWJIQo8XSjXXyjSXameVJz7g4MjTWQElVjhp+fh1YO5dYw+KOYO oIMzbbOVwBNm9v7kwFKGm3wKqn1tcsi8+kaINeZtSxA9pb00JODnWLC7piHeAYXM1PVw N3k2Nn55/NQW62GDjaAHWqPYz7V9xbyVthjHoM2pZR4CHqON94MLCBdmIVc+w62NnDKl 609w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZWUgemwu; 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-202651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202651-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-4402a2a118asi22359571cf.252.2024.06.05.06.26.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:26:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZWUgemwu; 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-202651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202651-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 529D51C21E5C for ; Wed, 5 Jun 2024 13:26:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D993D1C225B; Wed, 5 Jun 2024 12:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZWUgemwu" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 F1CAD1BE858; Wed, 5 Jun 2024 12:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717591783; cv=none; b=hUd/Obw4y07rmR5FfptZks2aBDGs02M+ypvKEhR1lJ8fcqwzSDaylRIVp8Q5rFYfOeDnQwkhg/yeNeZDQYu8mH0fUblWqnQ0mqRLEf4X+4iyjPa892A0vHgHZKW8dDwhxURPA2rvnSiKmhte5mzZnorhjI7sIfr5xhUzqNMU/uY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717591783; c=relaxed/simple; bh=Bvti8tUOJkTJd9qxRveOWe7B/kBSghbeRtPhRSb1F78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g125oAIlCGVQO3zrxgwAe5jlOHJL1UBEOl274Y9FHYrd8BT0Z7TgkxQ8N7IY/pkx8QKwIftNndSmGGhwr+LDeiYGaVfOE+4mC8K0Fx2OQYfRc4rpNYLdnjKPHPrGRnzHuXa4gV6VblDMNV8a9Bt4J36Vi0JiIT4175pAlp18xtE= 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=ZWUgemwu; arc=none smtp.client-ip=217.70.183.200 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 2F6E52000F; Wed, 5 Jun 2024 12:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1717591779; 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=xdHRxZdIVtQDmtg/7Szi9R9ppNOPI4/sMJdJvlp0D74=; b=ZWUgemwu6J2NEIyfRxyaU1WwsgKbShC0jxdf6/8QrrA5s+rCaLWg+r5JzqPOOKq+WhT+e+ 57ofaSMizDOwqw7gnwxhBnm0ej0dPPC9Fi1aQ6covGp66qwVZONe/N1tzP+w8Cmw+ADvGk MVSz+5dKQpfYRFzR02S37KhyAoPFCmr74kqmAlL9P7l5/8ol/yTbONDHwsFuE/RArmPjaP uxKHuSUQ2XqmQy0oO9OthAaHX1ojv1ja3XS9xVY6Rwy5JuHWrqu7PZBzfTZqOzonkO6jwk rogk2K+SV/qKGYh0X5O28T4o9il+D305pi1EAFWhg+WOkG3LffPvrvagHMz64g== 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 v12 09/13] net: ethtool: plca: Target the command to the requested PHY Date: Wed, 5 Jun 2024 14:49:14 +0200 Message-ID: <20240605124920.720690-10-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605124920.720690-1-maxime.chevallier@bootlin.com> References: <20240605124920.720690-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 Reviewed-by: Andrew Lunn --- 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.45.1