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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0D37C678DB for ; Sat, 4 Mar 2023 15:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjCDPEq (ORCPT ); Sat, 4 Mar 2023 10:04:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjCDPEo (ORCPT ); Sat, 4 Mar 2023 10:04:44 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC64D324; Sat, 4 Mar 2023 07:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=3EW+cE1iPdOSlYV+9XVPWeV5/ZUNFFr2RNIs7Bm7Q44=; b=1au3pzdpramIt1YwUPSqtQumKR 0r4t1ixg0lzWmEO/XivdFeomCxi/BBZopPzoFBt/tpl4omWM2O8Yg/YVr5kOtVyb5gqwjWoZDbn+v xOOW/5Dxdcx7RRU10CY85NgVYCy1Z+3nWwhx5U4ah5qO62qa59w7B6V9IqrIw1z3fT8M=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pYTQy-006S1R-4R; Sat, 04 Mar 2023 16:04:28 +0100 Date: Sat, 4 Mar 2023 16:04:28 +0100 From: Andrew Lunn To: Willem de Bruijn Cc: =?iso-8859-1?Q?K=F6ry?= Maincent , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, Michael Walle , Richard Cochran , thomas.petazzoni@bootlin.com, Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Joakim Zhang , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Grygorii Strashko , Heiner Kallweit , Russell King , Minghao Chi , Jie Wang , Guangbin Huang , Wolfram Sang , Wang Yufen , Alexandru Tachici , Oleksij Rempel Subject: Re: [PATCH v2 3/4] net: Let the active time stamping layer be selectable. Message-ID: References: <20230303164248.499286-1-kory.maincent@bootlin.com> <20230303164248.499286-4-kory.maincent@bootlin.com> <640289d5ef54c_cc8e2087a@willemb.c.googlers.com.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <640289d5ef54c_cc8e2087a@willemb.c.googlers.com.notmuch> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Should setting netdev->selected_timestamping_layer be limited to > choices that the device supports? > > At a higher level, this series assumes that any timestamp not through > phydev is a MAC timestamp. I don't think that is necessarily true for > all devices. Some may timestamp at the phy, but not expose a phydev. > This is a somewhat pedantic point. I understand that the purpose of > the series is to select from among two sets of APIs. Network drivers tend to fall into one of two classes. 1) Linux drives the whole hardware, MAC, PCS, PHY, SPF cage, LEDs etc. 2) Linux drives just the MAC, and the rest is hidden away by firmware. For this to work, the MAC API should be sufficient to configure and get status information for things which are hidden away from Linux. An example of this is the ethtool .get_link_ksettings, which mostly deals with PHY settings. Those which have linux controlling the hardware call phy_ethtool_get_link_ksettings to get phylib to do the work, where as if the hardware is hidden away, calls into the firmware are made to implement the API. When we are talking about time stamping, i assume you are talking about firmware driver the lower level hardware. I can see two ways this could go: 1) The MAC driver registers two timestamping devices with the core, one for the MAC and another for the PHY. In that case, all we need is the registration API to include some sort of indicator what layer this time stamper works at. The core can then expose to user space that there are two, and mux kAPI calls to one or the other. 2) Despite the hardware having two stampers, it only exposes one to the PTP core. Firmware driven hardware already has intimate knowledge of the hardware, since it has to have firmware to drive the hardware, so it should be able to say which is the better stamper. So it just exposes that one. So i think the proposed API does work for firmware driven stampers, but we might need to extend ptp_caps to include a level indication, MAC, bump in the wire, PHY, etc. Andrew