Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3437342rdh; Thu, 28 Sep 2023 11:32:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEslWN8GHr3zZBKv3X1s/lg9Bp2E7ELH62995DWmiJYfbvu7iZ32QD5lcUu+yEL0ZOq0pR0 X-Received: by 2002:a05:6358:5e0f:b0:140:f6ab:b11e with SMTP id q15-20020a0563585e0f00b00140f6abb11emr2228028rwn.28.1695925923269; Thu, 28 Sep 2023 11:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695925923; cv=none; d=google.com; s=arc-20160816; b=pDZVLcS2uTHmqzwpsJQs6uEVGT+pHx3/7gQYTMa4if+/aOIup5Ww7xV2pvP55NJmgm AK7d5/5UIkfw6FcNXYrwzVOJbi/lNUBT/6qzaUgJULWy+tKVlprqxhk/PJhAXrK54Hgd TjAIt2xqBtk5hoiG/jMKhC0NHNB0XXD2AoTDtlEqV8p1cMI1lyOUWJozG827TYf8RSKO zFayj1iJLx08cHkB3GlfPVWwfNDiWY/44ahmCeJkV69a5iI50E3SYt/OO3MvFRB9JgYs yNrF0jX+H0XDwqLMAKycuKGLf65ZmVsJo6hHhAssTn0wY8H1vHgofQiIQB6jlVkIibjG XSdA== 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=0w3QyFnZ5GzEcVuSjQvNj3lczN8eP+MoNd8bPG9ffps=; fh=uIDto/y6WATbonwfnDg3y3PK/oGgWsqaOvkp2Mh6eTg=; b=D30d/rsYJaVkZnmEDbPvIerYvQIwQUyNVqYjStpLPZoi1cQvI1uH3EYNOaIbqm0tu+ nmgJtEk1OHVNaUjI5mwqamVcu4hZDiGhxHr6QR3MRuzlrmVNLUlS8J1XX/U7MzxwzH+R 1BNk58J2641SrL9JL/WnnqOvJ2W/4Van5FRCzWHVJxi3p13YUm8vuueoV+MryIj4YCWE fXXWULvbvNnSuZNNwylK4c18J/D0SWTdQpBWF8FmakB42BvXhkYnXRGmPN9qyU/Ic/W8 7m+iFxZPJVudDQ39W+E3NWut2IQNQawEEvT7w4fjd28qvIG0ZjgV7awi7YqOuLfSqaDT oOag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aKCaiyST; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x190-20020a6386c7000000b005859c81f1f0si15219pgd.137.2023.09.28.11.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 11:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aKCaiyST; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id A478D8371186; Thu, 28 Sep 2023 03:12:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbjI1KMY (ORCPT + 99 others); Thu, 28 Sep 2023 06:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjI1KMW (ORCPT ); Thu, 28 Sep 2023 06:12:22 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E5F122; Thu, 28 Sep 2023 03:12:20 -0700 (PDT) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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_H3,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 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 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 03:12:33 -0700 (PDT) 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,