Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5468pxu; Thu, 22 Oct 2020 13:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySyoMHY5GhyHLN3Z9nayPMJxxunf8IV4Sf/EIYjRBvK/hBvUYVN3PGxdEHF6jIP9jULyTQ X-Received: by 2002:aa7:d3d0:: with SMTP id o16mr4005828edr.47.1603399390261; Thu, 22 Oct 2020 13:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603399390; cv=none; d=google.com; s=arc-20160816; b=HWPEecQtBgP06FBXi1vCcg85kMroNWEhXE9cqMQfvTQRtiL42uq5WW2g8xqJ4j+g5D K0237XnPFrdjsvYX/TEDwbk7hDEvzwvdbOX9rvYUaaWlbXS0wRTVK64zUPFHESQibGrY PGFCjZRBJC62eX/DOrVOso7vwIwlPhuS1BDNZAqJ0BgrVqhFosKQwgWh50xfr4UGF/Cc 15Xl1DsrEm1P93O8emwlW2K6oKYRNCjdpvaXpotXUc9UFqsGtKUFTp2WlfWzB9plPlWd I1Mk/DaWyRx1oq5l5G9TmD8yl/yyFP4K8eMiDv1PcA6beEG5KsqmqYa+itWGK5vNBEyT qKHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AqJYgFfxf1zWkOlgQREW7xW14ZLBvpYa1x30aNKm68E=; b=q8o2D6w2U0kssmhw0mT2lrfZRCJb/145vNNCoYaBjOlxEOuEwRI9tyQivN/qSu1bqU CvYECvHBLypUVWbjk+6IYnEwhdSwtHQCINXfvUmSXR9S0iCsks2OgM70Z+4WvqMcok2T PDT9+lw+O23YE6eZbGmJjJoqhZydRVyvil7DMFp4IhjZD0iC6qoDja47d9G4+0kEM0hw R4vVda9WPfERDEO+qnR/XeDvJLcJ+vp5mrag3PSDfOfk+7cCf7M/rdc3gJ3c5Pxyu7KM s6tHvRLxmNj64ZlDURNHLKh0Ltk+CLQS53MMBcg+15XxjjqAAmwPiu9falOH9TzjD8mX Mr/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pbufEwGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si1663414edr.404.2020.10.22.13.42.37; Thu, 22 Oct 2020 13:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pbufEwGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896738AbgJVKvN (ORCPT + 99 others); Thu, 22 Oct 2020 06:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896731AbgJVKuS (ORCPT ); Thu, 22 Oct 2020 06:50:18 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3D74C0613CF; Thu, 22 Oct 2020 03:50:17 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id u8so1624665ejg.1; Thu, 22 Oct 2020 03:50:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AqJYgFfxf1zWkOlgQREW7xW14ZLBvpYa1x30aNKm68E=; b=pbufEwGlldI/bNKzoAlD6JH/1Kgwp7LL9n0IaPmYRMej2U9bzqt6blEz40JNSaI7Lh 2O682xKGy0D4TGwYimdte1eCaB73TcXuT/kE3v++8oLlmEb9N9Rm+jz9b9m7ThDmMQ8H GRdACCf/1DPz265510ArcI2ZKTPUGthTquqzLZt8UYV/Vl0qgSfAmxkdRjrb6nRNqYBA dGUHWDNuShmo3IYCrxndoMPak5+LWmhkl+EwHYH3M0Jvz2Qug22e3q2HCL8e6C1g76E/ E0OOdFkCaAncynTartJBUe1oObiFSfir4TcxGNpQ7DHArFB0u17w4I0oMi6BXlKUiGoW SKKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AqJYgFfxf1zWkOlgQREW7xW14ZLBvpYa1x30aNKm68E=; b=hn1cvuqNQyfNekRceOuAuZlX2ZfparHjXCcQxAf6+laesjsWgpt1nf36JRh07/Hwuu +xQZuLgH01Ine1B4YDjEVn6G8U985dabHYnaDF7v+lEE+B7rh3fWUViD4KnR9/NSVWX1 AdBqQ/03ivyy24jcs/RwSkPN36hIWZJFcs07ZpygVAKVkMzukEQTidGBoSsyddjETA2q apcvQz4AsLNGEYONB+X2Wb5tcZYmCKyNxpuzbnGzMqEquNxYoiPWQRz6NjucdYwNRTGS /rnREPVjw335atVO7dAhAV4HCLGN4Pu5G72pCbPw9EpwbxghVOisJd5Wvw0lONch9B7F uH/w== X-Gm-Message-State: AOAM532Ge3IybvfP0dEeW29jy1dREK5BlAZ3RxU+E4nYlcts9L3rV/U5 JMLhAflRU+y+31nU8wAHvnw= X-Received: by 2002:a17:906:bc57:: with SMTP id s23mr1621953ejv.94.1603363816451; Thu, 22 Oct 2020 03:50:16 -0700 (PDT) Received: from skbuf ([188.26.174.215]) by smtp.gmail.com with ESMTPSA id h13sm547472edz.43.2020.10.22.03.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 03:50:15 -0700 (PDT) Date: Thu, 22 Oct 2020 13:50:14 +0300 From: Vladimir Oltean To: Richard Cochran Cc: Christian Eggers , Florian Fainelli , Andrew Lunn , Vivien Didelot , Jakub Kicinski , Rob Herring , Helmut Grohne , Paul Barker , Codrin Ciubotariu , George McCollister , Marek Vasut , Tristram Ha , "David S . Miller" , Woojung Huh , Microchip Linux Driver Support , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support Message-ID: <20201022105014.gflswfpie4qvbw3h@skbuf> References: <20201019172435.4416-1-ceggers@arri.de> <20201019172435.4416-8-ceggers@arri.de> <20201021233935.ocj5dnbdz7t7hleu@skbuf> <20201022030217.GA2105@hoboy.vegasvil.org> <20201022090126.h64hfnlajqelveku@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201022090126.h64hfnlajqelveku@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2020 at 12:01:26PM +0300, Vladimir Oltean wrote: > On Wed, Oct 21, 2020 at 08:02:17PM -0700, Richard Cochran wrote: > > On Thu, Oct 22, 2020 at 02:39:35AM +0300, Vladimir Oltean wrote: > > > So how _does_ that work for TI PHYTER? > > > > > > As far as we understand, the PHYTER appears to autonomously mangle PTP packets > > > in the following way: > > > - subtracting t2 on RX from the correctionField of the Pdelay_Req > > > - adding t3 on TX to the correctionField of the Pdelay_Resp > > > > The Phyter does not support peer-to-peer one step. > > Ok, that's my mistake for not double-checking, sorry. > > > The only driver that implements it is ptp_ines.c. > > > > And *that* driver/HW implements it correctly. > > Is there documentation available for this timestamping block? I might be > missing some data, as the kernel driver is fairly pass-through for the > TX timestamping of the Pdelay_Resp, so the hardware might just 'do the > right thing'. I believe the answer lies within the timestamper's > per-port RX FIFO. Just guessing here, but I suspect that the RX FIFO > doesn't get cleared immediately after the host queries it, and the > hardware caches the last 100 events from the pool and uses the RX > timestamps of Pdelay_Req as t2 in the process of updating the > correctionField of Pdelay_Resp on TX. Would that be correct? Ah, no, I think I'm wrong. As per your own description here: https://lwn.net/Articles/807970/ If the hardware supports p2p one-step, it subtracts the ingress time stamp value from the Pdelay_Request correction field. The user space software stack then simply copies the correction field into the Pdelay_Response, and on transmission the hardware adds the egress time stamp into the correction field. So we were correct about the behavior, just not about the target hardware. So, that's just not how this hardware works. What do you recommend? Keeping a FIFO of Pdelay_Req RX timestamps, and matching them to Pdelay_Resp messages on TX, all of that contained within tag_ksz.c?