From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DE5ACE7B10 for ; Thu, 28 Sep 2023 10:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2m2SdWnIoCrtn241YoPBqITxbRQxJCtM6ZMv9LDAIGY=; b=ZXprk9q5pjbHQ7 zL1C9IGgaXyqPJDyKBXecQaTUao/iXRx6kRlWFw2De8w0LWcywWyFs5nXJJewYm2Ggl1croPY5psE 1IHmEgBV/8g/aYgkgk0WVXbfIE8UWqNlrKiw5ttyekSYhY1FnxNXE7F6YIW/p3Yh3LpnUEnR6JjIB +SQuu4KxzLpG0Q+n5euV+DJSmxB6pxI4YBT/CbVEETlJp45tNLYMuO6NK1st2ox5hLROZ+uJdSSU1 yUOurJx1I5NBK35/DcxuSQfgu/Bw55F3iib+rjQyN74K+5X+lONgqR1vqKEfaps7WS+Vl/8omVQgu P2DAoNN4tXCokOsZpC7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlo0T-002o81-2q; Thu, 28 Sep 2023 10:12:29 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlo0P-002o6Y-2u for linux-arm-kernel@lists.infradead.org; Thu, 28 Sep 2023 10:12:27 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id C9B264000D; Thu, 28 Sep 2023 10:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1695895938; 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=0w3QyFnZ5GzEcVuSjQvNj3lczN8eP+MoNd8bPG9ffps=; b=aKCaiyST9Arbjirrx+gb/s4ajF8AuFFBbXJz0N/UkJlGJ146yLZzDShnLNOJ4iH24MTK7A hr9+VKbXjAgbKjsRXzOl63ixQQpkKYaUpoUsG3VmVgr/oGXZLxSIFRbhGacKNWq2DzUF4S FCnn7ZhSA4g96L/RQTL06Jmkw1u3tyvULYrTKKu89ke3bQVHuSbeYZNm7/GtIPZlhLOKV2 BqoBQzUIcKREPsWj5zgmvmrx0gfci7NRHEkDUXJ+X47qJfRDYpBdd7zZOsd6hDeTJxjtLB vwg0cpD6v/cYn4DWWbfnQOtpjIheVXN9x/h7lOiJisn7FZTNfQDDX0BmbiqZ4Q== Date: Thu, 28 Sep 2023 12:12:14 +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: <20230928121214.170e31b0@kmaincent-XPS-13-7390> In-Reply-To: <20230801142824.1772134-13-vladimir.oltean@nxp.com> References: <20230801142824.1772134-1-vladimir.oltean@nxp.com> <20230801142824.1772134-13-vladimir.oltean@nxp.com> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-GND-Sasl: kory.maincent@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230928_031226_288988_ACCBAC43 X-CRM114-Status: GOOD ( 18.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 1 Aug 2023 17:28:24 +0300 Vladimir Oltean wrote: > 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. > > 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. > > 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()). > > 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. > > 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. > +static int dev_set_hwtstamp_phylib(struct net_device *dev, > + struct kernel_hwtstamp_config *cfg, > + struct netlink_ext_ack *extack) > +{ ... > + if (phy_ts) { > + err = phy_hwtstamp_set(dev->phydev, cfg, extack); > + if (err) { > + if (changed) > + ops->ndo_hwtstamp_set(dev, &old_cfg, NULL); > + return err; > + } > + } 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 driver. Should we create also a copied_from_user flag? Other idea? Regards, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel