Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3562366rdh; Thu, 28 Sep 2023 16:02:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3/Cs+flEGGH3QE6xNCqzBk7xdXPP+JLdIrizv2+LBt4r6L/okVdoJP2kfsmpIYF3ykDpo X-Received: by 2002:a17:903:1251:b0:1c5:59ea:84de with SMTP id u17-20020a170903125100b001c559ea84demr3060549plh.29.1695942134701; Thu, 28 Sep 2023 16:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695942134; cv=none; d=google.com; s=arc-20160816; b=TcOkvBt8q3VlDUi/p8J+fk9JuDSP6qTrLmLMuTjfzwgbAs46rra8XfnIltPCyWycHO lvIDMnWsQ5Xyc7EC0R+LhohrD+JPPW6DP9SklJZc9PLqMKUfRkrG0cht5GPqejI9ZDr6 FpbmT7xO9hYlO+W7VVXxHFdFfq82Ppz05KVz4wuQ9W9TAtSlxn7wO3J/OhAMoGNZc99H sUNU2IlqscgneU5vFDPQyoaCOx3HDAnp84dOXy75V/8Os6bFf1YzRrpb+eQcXYyM4GuZ ru/SVdj2Ti2BXNb2aAuRiODFntJoD9HISRU5GjbJNdgy9BtygKgXMB3gfm/XfmM/PmI4 l5Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=EZE2REsMNc2mXuGaMpgEFAlQvcHuSlVOm9/Mjr1E1/U=; fh=uIDto/y6WATbonwfnDg3y3PK/oGgWsqaOvkp2Mh6eTg=; b=0qpzuNLYgUKxcpAgNKd2tvVkfZbuGBxGZOl65xpuuo5ZBwVfclkmNVFN0FcAJjSJpQ KCuQ41/Pe7z2JtXj3KgVxCSCabL8BiWOI884q1AjTAjASlI21ApwQ80H79OFnhYHf3KC GwJDaZsD7LGBOczetEivWi5xsXLpH67h9FU9NCqOHppgTSrbOncBI909LQyK9Q/BrV/8 jbIsm1cs8iKDI9W2Fk3Hq/T9pmZ+VUeV4Z5n06uU1Hvrz1N4zdIkyC70Pkg87YLyrzAr iSmbeL52l4kTD1KkvoW0qFFezC1Io4ytY7RQuLgIiqlKZzD43AMrGgQOpDpaxq9xaupc Btog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o1pVvjLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id l11-20020a170903120b00b001c3845d008csi20370271plh.424.2023.09.28.16.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 16:02:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o1pVvjLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8E382807AC7D; Thu, 28 Sep 2023 05:40:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232462AbjI1MkN (ORCPT + 99 others); Thu, 28 Sep 2023 08:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjI1MkM (ORCPT ); Thu, 28 Sep 2023 08:40:12 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3462139; Thu, 28 Sep 2023 05:40:08 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id BEFEDFF803; Thu, 28 Sep 2023 12:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1695904805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EZE2REsMNc2mXuGaMpgEFAlQvcHuSlVOm9/Mjr1E1/U=; b=o1pVvjLuwW2grIpSsEqE9yI7+oF52h2SqpQ9B0r6YXZh/1hTAgvmyLvpSBiIJh0kpi7YiQ ER8ZofzXmje5zZKAmn/FehD4xUENVDfdWMIngyzU4579y7sAm3WtEZbQ2Ifb4AS9pIqbjd uNtiOOg+mlm22Tb64tfBUScCgPeKZ4BTVFdDEPPOh8L4bi7cG86tyN5sAIN2u4jQB2QDXu 4onienvj+BsTjNra/tnjqBwFUUakHZeW0p5S9A6ns4JKo6Cna0suuSEvJWK8RIgHzl25NF D/ncq+fxLC2npgJwqUzUAWfK0Ke2+RSrBNhAMGcRialqWBxB4cNdgyudJpPjjg== Date: Thu, 28 Sep 2023 14:39:58 +0200 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Maxim Georgiev , Horatiu Vultur , Maxime Chevallier , Richard Cochran , Vadim Fedorenko , Gerhard Engleder , Hangbin Liu , Russell King , Heiner Kallweit , Jacob Keller , Jay Vosburgh , Andy Gospodarek , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , UNGLinuxDriver@microchip.com, Lars Povlsen , Steen Hegelund , Daniel Machon , Simon Horman , Casper Andersson , Sergey Organov , Michal Kubecek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 net-next 12/12] net: remove phy_has_hwtstamp() -> phy_mii_ioctl() decision from converted drivers Message-ID: <20230928143958.298ee225@kmaincent-XPS-13-7390> In-Reply-To: <20230928121214.170e31b0@kmaincent-XPS-13-7390> References: <20230801142824.1772134-1-vladimir.oltean@nxp.com> <20230801142824.1772134-13-vladimir.oltean@nxp.com> <20230928121214.170e31b0@kmaincent-XPS-13-7390> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 05:40:22 -0700 (PDT) On Thu, 28 Sep 2023 12:12:14 +0200 K=C3=B6ry Maincent wrote: > On Tue, 1 Aug 2023 17:28:24 +0300 > Vladimir Oltean wrote: >=20 > > It is desirable that the new .ndo_hwtstamp_set() API gives more > > uniformity, less overhead and future flexibility w.r.t. the PHY > > timestamping behavior. > >=20 > > Currently there are some drivers which allow PHY timestamping through > > the procedure mentioned in Documentation/networking/timestamping.rst. > > They don't do anything locally if phy_has_hwtstamp() is set, except for > > lan966x which installs PTP packet traps. > >=20 > > Centralize that behavior in a new dev_set_hwtstamp_phylib() code > > function, which calls either phy_mii_ioctl() for the phylib PHY, > > or .ndo_hwtstamp_set() of the netdev, based on a single policy > > (currently simplistic: phy_has_hwtstamp()). > >=20 > > Any driver converted to .ndo_hwtstamp_set() will automatically opt into > > the centralized phylib timestamping policy. Unconverted drivers still > > get to choose whether they let the PHY handle timestamping or not. > >=20 > > Netdev drivers with integrated PHY drivers that don't use phylib > > presumably don't set dev->phydev, and those will always see > > HWTSTAMP_SOURCE_NETDEV requests even when converted. The timestamping > > policy will remain 100% up to them. =20 >=20 > > +static int dev_set_hwtstamp_phylib(struct net_device *dev, > > + struct kernel_hwtstamp_config *cfg, > > + struct netlink_ext_ack *extack) > > +{ =20 > ... >=20 > > + if (phy_ts) { > > + err =3D phy_hwtstamp_set(dev->phydev, cfg, extack); > > + if (err) { > > + if (changed) > > + ops->ndo_hwtstamp_set(dev, &old_cfg, NULL); > > + return err; > > + } > > + } =20 >=20 > In this case the copy_from_user function will be call 2 times, one in > dev_set_hwtstamp and one in the mii_ts.hwtstamp callback of the PHY drive= r. > Should we create also a copied_from_user flag? Other idea? oops sorry for the noise the issue I face seems elsewhere. If I understand it well, two call of copy_from_user consecutive will behave= the same.