From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 112DF8BFF for ; Thu, 28 Sep 2023 12:40:11 +0000 (UTC) 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) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.