Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp818611lqb; Wed, 17 Apr 2024 11:34:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGylu3kMqZT7jajF0phgi8t3FBKHhLmXuvaGKa9tWA4ig/rAcPwHVwcz9EVrjaSs1JFPGeFfBS+Hk22CS3sRhtiXBg0Bdo6n/0IYrUbQ== X-Google-Smtp-Source: AGHT+IHHBUt+PGNfaD5sGmuocIf3F1976vTqT9gX4FSAv2iadrbVjEEyKxyUieDShm04Y+6X+2Su X-Received: by 2002:a05:6a00:1402:b0:6ed:21d5:fc2c with SMTP id l2-20020a056a00140200b006ed21d5fc2cmr452140pfu.26.1713378853658; Wed, 17 Apr 2024 11:34:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713378853; cv=pass; d=google.com; s=arc-20160816; b=eild1THs7iaAbaDauQ/LeNDTiRKGXqdCRr8Upvq1/Zdm2EvZTgLI4a179GfvOQMSPF sSNkVnWM+4QAVn91MDJQknv/fh8R0naDz7QY0ZzayRIYuyEUGI0K+DpSOKFvOkO4NNPQ PjXsEN8FrwYwEbuMHZcdmqKxU2PGhkTb4c4upgrrAksaFbYUaaeR5Bp7tUCQXjpdwKD0 No2hsO3tJjEoa8rdV9jEP7zZFyOY3wOGYqR9UsndQNb20PdXQ1TfPArfKq4LegINE0UP AJUOC8888Iyy6xbzOx+l6/owYLpChkgdvR6nBak26yZXONAg62GtfMBkCTKDNi79wyYf aXzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qyvdskYVnamQI3a/ILIalEumJFvEM9exFz2R/7q+4jE=; fh=ncjpuIWmB2ZTo3yYcl0ur4KKVFqsiXJpgHR0Njh9MJQ=; b=WkoH1ECzi8/I6soAVNEO3EyKGa2Z3RxAb+j7kMdy7NrwDsIncPyiXBwI7m9PTk9p0s fTes9k2g/1O/JukAKgZU9vGnOMPmtYyamdx9vv7Br+GyszC+A9AtS7weHk2QLxltbc/0 P2kw1SHuA9sMBnnb/UpddwhYyy/GtuOFstvp3pML5Ra5to5nZWHNKhrzPbkmMJwG+WTp nksuJWea1KyWv0AO4Es8CHZHVFtirQXjqhFvp2hpv1dmB5M8riL3llgwozQXTeSRmkP+ 1msUdW1H4AyraseRGzeKwyWtj9oUkA0rk1mVgeADM/eXmeEoLnlVhgxRZluuuD8B8WwM FxQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ipL+I8TV; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-149056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z9-20020a63e109000000b005dc1e39fbeasi11727888pgh.80.2024.04.17.11.34.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 11:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ipL+I8TV; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-149056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1BC272862CC for ; Wed, 17 Apr 2024 18:34:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF178125DB; Wed, 17 Apr 2024 18:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ipL+I8TV" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 24DE8F51B; Wed, 17 Apr 2024 18:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713378848; cv=none; b=eGA/3YkREJaUwh4CogTunBNmMp2WZJKy6zVg0ZUAhEPy7rcBGhu4LHm95Tk0lmcrfmLvVdaZzEEXHxljw0Uy7QysOzqgvkvDXuN3HTrEH64oIMUXDk73tMss0vgYc9wj6/3Rgp8HKCjEpoFZ3bqaJOLxSESyo4M9IHbLpZsB+8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713378848; c=relaxed/simple; bh=6veavc1e9T/l9NoSbIGFrOaQTgn3qFpNCXEWKSehzVA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Att7oOr2ZPb9EMpoxNkCDhEmw9daRs8IRPSI0Lx6+NaFX/rOwFad09nZa6+3mxwyByjWx/YqbtYctd/ebxOl9S7qOmPvRlj9dT2vW8ArtpD8NAjxzF35sWLz3xvTbX2yEYDQIJprpagEkOF6nCnm9d6yrssOGhoHBZD6UTRtBlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=ipL+I8TV; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=qyvdskYVnamQI3a/ILIalEumJFvEM9exFz2R/7q+4jE=; b=ipL+I8TVXay+xwWsxLnGcJxNq+ 3MXPVeffIwUTLH4aFqP2fzWB99kP6oLrc3fydU+rNpr2jleE5dV3VCx+y794YXUXnqUhYl9g208Gh hm5aTjVvDdsaJfvozWQ84C1ALa7MppKCBaGT9jY22rHzGVmw0tSveXsTpH4kuza9SKH0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rxA6E-00DGzN-GY; Wed, 17 Apr 2024 20:33:38 +0200 Date: Wed, 17 Apr 2024 20:33:38 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: Alexandre Torgue , Jose Abreu , "David S. Miller" , Heiner Kallweit , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Woojung Huh , Arun Ramadoss , Richard Cochran , Russell King , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH net-next v1 1/4] net: phy: Add TimeSync delay query support to PHYlib API Message-ID: <898f435b-99dd-4636-9a52-558780c1bb06@lunn.ch> References: <20240417164316.1755299-1-o.rempel@pengutronix.de> <20240417164316.1755299-2-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240417164316.1755299-2-o.rempel@pengutronix.de> On Wed, Apr 17, 2024 at 06:43:13PM +0200, Oleksij Rempel wrote: > Add a new phy_get_timesync_data_path_delays() function, to the PHY > device API. This function enables querying the ingress and egress > TimeSync delays for PHY devices, as specified in IEEE 802.3-2022 > sections 30.13.1.3 to 30.13.1.6. The function adds the capability to > obtain the average delays in nanoseconds, which can be used to > compensate for time variations added by the PHY to PTP packets. > > Since most PHYs do not provide register-based delay information, PHY > drivers should supply this data, typically dependent on the interface > type (MII, RGMII, etc.) and link speed. The MAC driver, or consumer of > this API, is expected to invoke this function upon link establishment to > accurately compensate for any PHY-induced time discrepancies. So your intention is that this function is called from within the adjust_link callback? Hence there is no locking being performed because the lock is already held? > +/** > + * phy_get_timesync_data_path_delays - get the TimeSync data path ingress/egress > + * delays > + * @phydev: phy_device struct > + * @tx_delay_ns: pointer to the transmit delay in nanoseconds > + * @rx_delay_ns: pointer to the receive delay in nanoseconds > + * > + * This function is used to get the TimeSync data path ingress/egress delays > + * as described in IEEE 802.3-2022 sections: > + * 30.13.1.3 aTimeSyncDelayTXmax, 30.13.1.4 aTimeSyncDelayTXmin, > + * 30.13.1.5 aTimeSyncDelayRXmax and 30.13.1.6 aTimeSyncDelayRXmin. > + * > + * The delays are returned in nanoseconds and can be used to compensate time > + * added by the PHY to the PTP packets. Please document the context this function should be used in. If users use it outside of the adjust_link callback, the locking will be wrong.... > + * > + * Returns 0 on success, negative value on failure. I think kdocs now requires a : after Returns ? > + /** > + * @get_timesync_data_path_delays: Get the PHY time sync delay values > + * @dev: PHY device > + * @tsd: PHY time sync delay values > + * > + * Returns 0 on success, or an error code. Same here. Andrew