Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp403788rdb; Sat, 17 Feb 2024 14:10:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXXSld9NTRTDuw0eEdEkx+QVEovwOFYvOzzqiHIJTkI9OX87qqq/EJfmJ5O2yPGsXyA8tr6790bxwJFj9KLHMlQ6UIJQAaGKWm6XoQeOA== X-Google-Smtp-Source: AGHT+IHz39cC4vw2krGum1el9dmGGNTV/jj5ZIr4sSHmoS7BdqY2vC8rnwCkdQVQKAfKK5ywmEtF X-Received: by 2002:a05:6a00:1390:b0:6e0:d220:4463 with SMTP id t16-20020a056a00139000b006e0d2204463mr9927017pfg.24.1708207837226; Sat, 17 Feb 2024 14:10:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708207837; cv=pass; d=google.com; s=arc-20160816; b=lXcEk6PmEwD0VpbxZ5Ebl5dv3xQ23Rm+H8UZMt1E5coW+7/It6xz/PLM0oDqZfQ4am zlvGNG5iktxejEVYEE7scopHuBLFDSN3H3Rnrh64Po6Fd66a6RVPpqakRAVWuszK4HFU WtfamvOfa3duqK075yQtMEKHKAEVz7NNDQ2Xh4QaXjgRVMIqf2KTyl61FEoHRzMXTiLz 0+7ZQP3bP90Zbgr8NAGWC2ZnIbfyM+7dwe/G25H1IOZK8tkeyqkD6bfOZaI2lD0LZbQ1 t5tKsBz/Uj0UcI6mcQSv0fJCly82KDWa7flFgMb/FkRt0tAUC3/31cWhH8M985MtTiPG qSJw== 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=dBMEFj+vUqAqgSWaC9a7/Khmdxlt5g8WjS7g/9NczGU=; fh=WRjJBipeRZp4WND6tCu7eFnh3ZWobecBqThuU7I/Pj8=; b=XWCUNOb4BT12KE3diHXlnTGu/JU87cght674emeq1YdBHwLct0Q6BXOLuOJ5Er8smk drDdQCc7kA5q9Lj6VEP4IxCKZ8JxbwKqUoyE/bshjpK6u7ymATS9MwboPxUu5Qwsbb9O FyyY/wh9Xt10Sb/scE2CS6SMYJ0drGldOqeoSrp/AA2q1e6A9rnkIg+WAdaKPpEX3FGx L6cfnEak0fRVUfNGW6/gT0Nu0oeCTTxq+Ejd7F2LTGwNN4fjro0eiA1ch804ERd50mSw AvFXyP5ZTiEoJl1PXpu/irE9NK3ymxDAqbDTt82jmzbMvq/nDpHeRjp1kBsQvOPOaMTc 8ZPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=c6TUOfad; 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-70105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70105-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ld12-20020a056a004f8c00b006e09331f02dsi2097409pfb.300.2024.02.17.14.10.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 14:10:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=c6TUOfad; 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-70105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70105-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 9FF87284025 for ; Sat, 17 Feb 2024 22:10:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C35080045; Sat, 17 Feb 2024 22:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="c6TUOfad" 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 19C7E7CF0D; Sat, 17 Feb 2024 22:10:17 +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=1708207820; cv=none; b=kF06D0hdMoE8dS5krrpg9tqhkFXDpPH72KPxQoZSWXYgCRasNfT2tAE2ZiI1xo3Xoc2mXzhOSIwTFvQYnvhiMs234afh540+P+BvCOr7vFM+qcNz1Dg3d4Isr87/t3HY64X61U2PK8E4MWpH8yu2IbBdvHr9dlT4L3z/OEnAUoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708207820; c=relaxed/simple; bh=mYKwzXe2ZRGlF20vDTg03J91yT8nqSlhzoN8Ylq1xjE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hMTwvWUAlrwm7iTaWOTSGiinBjgFnBqdB8QG6D6E+y4dBLmt0MFPkDDMa9oMdC2Rhj5xvAIy7dc5o1VtC2ZjdDkLeKVycpz2aWgT+kYvlLkqfo1ZBChlWckJNTSqbBZslQj4/oPtBfp+sKM9+06PdisfN1KpByjXFhnEkwGi+pE= 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=c6TUOfad; 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=dBMEFj+vUqAqgSWaC9a7/Khmdxlt5g8WjS7g/9NczGU=; b=c6TUOfadK4NqEjqMqSb5/Ek+Gq CSL/AFvP1Zq8sMM+xK7J2+sqWrkksPZNvHspX8F9efTEIbztyWQz+li5nMENrtD09dqVHeJWQ04Rz ssNHCK2YCkMFw5ibUxERy7+Cj8czdLNeGHVtpgVtXS4Lemr7UrpjeJW9UD5U3D8sXrKc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rbSsp-0085e9-VR; Sat, 17 Feb 2024 23:10:07 +0100 Date: Sat, 17 Feb 2024 23:10:07 +0100 From: Andrew Lunn To: Rahul Rameshbabu Cc: Kory Maincent , Florian Fainelli , Broadcom internal kernel review list , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Radu Pirea , Jay Vosburgh , Andy Gospodarek , Nicolas Ferre , Claudiu Beznea , Willem de Bruijn , Jonathan Corbet , Horatiu Vultur , UNGLinuxDriver@microchip.com, Simon Horman , Vladimir Oltean , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maxime Chevallier Subject: Re: [PATCH RFC net-next v8 04/13] net: Change the API of PHY default timestamp to MAC Message-ID: <9e2ce7a0-e938-4f5f-aae9-cfee3a066628@lunn.ch> References: <20240216-feature_ptp_netnext-v8-0-510f42f444fb@bootlin.com> <20240216-feature_ptp_netnext-v8-4-510f42f444fb@bootlin.com> <87jzn4gtlv.fsf@nvidia.com> <87o7cebx9z.fsf@nvidia.com> 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: <87o7cebx9z.fsf@nvidia.com> > > Could you give some examples? It seems odd to me, the application > > wants a less accurate timestamp? > > > > Is it more about overheads? A MAC timestamp might be less costly than > > a PHY timestamp? > > It's a combination of both though I think primarily about line rate. > This point is somewhat carried over from the previous discussions on > this patch series in the last revision. Sorry, i've not been keeping up with the discussion. That could also mean whatever i say below is total nonsense! > I assume the device in question > here cannot timestamp at the PHY at a high rate. > > https://lore.kernel.org/netdev/20231120093723.4d88fb2a@kernel.org/ > > > > > Or is the application not actually doing PTP, it does not care about > > the time of the packet on the wire, but it is more about media access > > control? Maybe the applications you are talking about are misusing the > > PTP API for something its not intended? > > So hardware timestamping is not a PTP specific API or application right? Well, we have drivers/ptp. The IOCTL numbers are all PTP_XXXX. It seems like the subsystem started life in order to support PTP. It is not unusual for a subsystem to gain extra capabilities, and maybe PTP timestamps can be used in a more general way than the PTP protocol. > It's purely a socket option that is not tied to PTP (unless I am missing > something here). > > https://docs.kernel.org/networking/timestamping.html#timestamp-generation > > So you could use this information for other applications like congestion > control where you do not want to limit the line rate using the PHY > timestamping mechanism. I think the key API point here is, you need to separate PTP stamping from other sorts of stamping. PTP stamping generally works better at the lowest point. So PTP stamping could be PHY stamping. If the PHY does not support PTP, or its implementation is poor, PTP stamping can be performed at the MAC. There are plenty of MACs which support that. So we need an API to configure where PTP stamping is performed. I expect the socket option is more generic. It is more about, give me a time stamp at a specific point in the stack. It is probably not being used by PTP, it could be used for flow control, etc. We probably need an API to configure that SOF_TIMESTAMPING_RX_HARDWARE actually means. It could be the PHY time stamp, maybe the MAC timestamp. Same for SOF_TIMESTAMPING_TX_HARDWARE, it could be the MAC, could be the PHY. But whatever they mean, i expect they are separate PTP. > In mlx5, we only steering PTP traffic to our PHY timestamping mechanism > through a traffic matching logic. > > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h?id=a6e0cb150c514efba4aaba4069927de43d80bb59#n71 > > This is because we do not want to PHY/port timestamp timing related > applications such as congestion control. I think it makes sense for > specialized timestamping applications to instead use the ethtool ioctl > to reconfigure using the PHY timestamps if the device is capable of PHY > timestamping. (So have the change be in userspace application tools like > linuxptp where precise but low rate timestamp information is > ideal). I would expect linuxptp is only interested in the PTP timestamp. It might be interested where the stamp is coming from, PHY or MAC, but it probably does not care too much, it just assumes the time stamp is good for PTP. But i would expect linuxptp has no interest in what the generic socket options are doing. Andrew