Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4254840pxb; Tue, 10 Nov 2020 11:35:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzod8nLecIkGB43L11hDugExyhJqMigYWjfxfHSf4+IOSJVg6wqvHxeR6FCH4DQA0pd67w2 X-Received: by 2002:a17:906:66c9:: with SMTP id k9mr22515625ejp.204.1605036938352; Tue, 10 Nov 2020 11:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605036938; cv=none; d=google.com; s=arc-20160816; b=gtTDKHagKR0cM1+05bOxCVh1vw2icCWL4IgmmdC7bJMgpqrXx5mAxQzAKAhchsnMpY R++1MiXHgTHbV1MfiHivqbuE7+nhOw+8fP8sN+OdoUa2iuEiHlRpxB6phhO4RTzsPPE6 OAY3oFUzaZbAqa3b16X3ugqgbjV93MsRsysCl9sEg6YsRamWHndd/ByoC/RkpW4N/ZMZ VM3F7E5WnkLv1BpeXFXGybRQ8g1wlBCTuJBMs/FemtFFDcXPpBvqoTDAX08U+2k05ZMQ ub1HVf7zhIwHV96CbbtHyO/KvYs6wHMrJMhxzWBzuw6NFKdoEjvmVwDsePWCxv8lUFU7 7pIQ== 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=VM/5N1Cfxe/m3bRipJoTI2B3zhN3N0f0sMhjH2eyUBU=; b=gf3GPPA7JDtEthcY5m5yl1QuNS1awla6iDpTGZxQaezet4rHJC1CULE3FsC1b8vHFn gjPUHnF++dS+WruFfeChiB1OqrpUwK6Fd8KRucKTF5fiimcQhSBsBxsOAnDvN8wOQWtH jVBkUCS/qScm+pG1NFAq5Ne+BTdaqfcyNSzfqtjgTplN3HwEpbFvxebaUXtT8fN/U4dn X7ETWCQ5z5jPpFyucb8mQlMpwUgvQrYsUH5IRj6wLekzRFGsLptYJQ4OFRTfpt6GMohk RMyor5yWCmtjwmhSt7kdmj/e/n6Vs6HBPYhLE8dBIkEARZYa/EghEsWPklo2utVBWESl krfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KdkNh6b3; 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 e24si9706938ejr.575.2020.11.10.11.35.07; Tue, 10 Nov 2020 11:35:38 -0800 (PST) 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=KdkNh6b3; 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 S1732700AbgKJTcy (ORCPT + 99 others); Tue, 10 Nov 2020 14:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732004AbgKJTct (ORCPT ); Tue, 10 Nov 2020 14:32:49 -0500 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D0AC0613D1; Tue, 10 Nov 2020 11:32:48 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id v22so3690425edt.9; Tue, 10 Nov 2020 11:32:48 -0800 (PST) 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=VM/5N1Cfxe/m3bRipJoTI2B3zhN3N0f0sMhjH2eyUBU=; b=KdkNh6b3qKXeJvvlcUmKWOeRgPT/zxH3+orznfb65IsHrz7oKYGtiIZacKV/w9g3rP 1BHn9xyNAFCM66rdtplI01RPdvPFOhsOu163eyvaJLtISgPqleiayYU9t6U4RjyMe3No +mzIGAocaRP9G5AkadyXwHz+zNt8x9QJDIdy0HTZpuZlHMc1/OI0/xezTXDREFrQms2i CUEcAK5uInTPaSRJ4HXPty6DGW3/+Vcrh+2MCjiwZxlF/ox1llqaLProMD4XFRytgNSV PxUs4yxgM1oAdMEDdAHaSHKLOaf+TytLPyUjA4Q3B5QYCdQzPF3kDW7yEspTneFO3QSm zy6A== 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=VM/5N1Cfxe/m3bRipJoTI2B3zhN3N0f0sMhjH2eyUBU=; b=ENOBqh3VG0VERa0mWgXi2agTqnYrN4hKdOezr4kNnpf3HHwNVvPlejA+tAdsaEfonh +SDCk0xC9Fajoaqo6yLyqDHp9mlZqkbb6N1sQbXe2xLDXPVBrmfoBB28ZTCoi4hlzXSv ig++tckd+qAN8fGi29rUIs7klm3AOuI5TCwDVJfag5dhOU86UAHQO1n3VMRXFelU5bIs KnYMX2p6o4J0J1GMKRhG3UJkLV19YRoxNWC2+cAut9VPdI6+6mvxHYV4VbRnNy+GnEUG e6+4cg6yQVBtuxGW4kJ4NpcLGEAEHRwwOAYIvN9ZrR1X0C9MWVqg2yALVCHzjuf5l/sm XlSg== X-Gm-Message-State: AOAM530OogVPeCQBbtLYv0ilzeG6JiYss6JavJR06Z0RQvLFFTux9cgm PwjxtLqA7Rj+/ggJ7OZGvxo= X-Received: by 2002:a05:6402:234a:: with SMTP id r10mr992643eda.311.1605036767418; Tue, 10 Nov 2020 11:32:47 -0800 (PST) Received: from skbuf ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id cz14sm1918012edb.46.2020.11.10.11.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 11:32:46 -0800 (PST) Date: Tue, 10 Nov 2020 21:32:45 +0200 From: Vladimir Oltean To: Christian Eggers Cc: Richard Cochran , 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: <20201110193245.uwsmrqzio5hco7fb@skbuf> References: <20201019172435.4416-1-ceggers@arri.de> <5844018.3araiXeC39@n95hx1g2> <20201110014234.b3qdmc2e74poawpz@skbuf> <1909178.Ky26jPeFT0@n95hx1g2> <20201110164045.jqdwvmz5lq4hg54l@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110164045.jqdwvmz5lq4hg54l@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 06:40:45PM +0200, Vladimir Oltean wrote: > I am fairly confident that this is how your hardware works, because > that's also how peer delay wants to be timestamped, it seems. So I was confident and also wrong, it appears. My KSZ9477 datasheet says: In the host-to-switch direction, the 4-byte timestamp field is always present when PTP is enabled, as shown in Figure 4-6. This is true for all packets sent by the host, including IBA packets. The host uses this field to insert the receive timestamp from PTP Pdelay_Req messages into the Pdelay_Resp messages. For all other traffic and PTP message types, the host should populate the timestamp field with zeros. Hm. Does that mean that the switch updates the originTimestamp field of the Sync frames by itself? Ok... Very interesting that they decided to introduce a field in the tail tag for a single type of PTP message. But something is still wrong if you need to special-case the negative correctionField, it looks like the arithmetic is not done on the correct number of bits, either by the driver or by the hardware. And zeroing out the correctionField of the Pdelay_Resp on transmission, to put that value into t_Tail_Tag? How can you squeeze a 48-bit value into a 32-bit value without truncation?