From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ipL+I8TV" 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