Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2623771rdg; Mon, 16 Oct 2023 09:41:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmxtNEYlvFy3TecCxYwZ/3SNP4r5UNqum5Ez36PdEAcA1sh9X8SkpfsgysjAfFF3vPf/45 X-Received: by 2002:a05:6a20:918d:b0:16b:9b5d:155d with SMTP id v13-20020a056a20918d00b0016b9b5d155dmr26095202pzd.30.1697474485635; Mon, 16 Oct 2023 09:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697474485; cv=none; d=google.com; s=arc-20160816; b=NYnOt9yAsfSEuvqCZeqxxzegPPMvbadZdpVXKQ59Ai9f+JSNu8SJLsUXlydCKHQh6X Xkg9ESKz2fwRygZ/0ECDpeGfwPkajwzn/T95DdQnjAzPg34JDNybsEX0N9aYzXhp9t6V BQQawZaXqP7pUFpX+/cAFRQj0HIGLGjOVjWuD0oJ40mH3dGwG8A7fhVAFJcUIoUxLG6y UnXDC3Xr6TrWIg7m8bc25qsGD6ExHm0vDQCo0T+OMSax+ZlLKiX6NTSc+ynZA5yGNId/ d54Sw8Po4jO32Sg+pmxH1i40PYjm+OGIkF4BUC6IdV1Ge7f+v/cTeRdwz4fEMkpy+adh Ub0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=/XVHBW4OllJOkAPcU2owgNX1LO5d3o45pdtyP1brke4=; fh=psDXZ/1J6aepbe5WGf0gWGEQ70M/c17P944t1VG0PCs=; b=QGAUod3eEV8IH+QjU/8bqXEAFpiDLDAnEPMqUZYxi5V8ZFMX7FabFS0PcUtpibY00p fm3s3j4ycVQCjw9VZxgAJ0Y+y3vG1pebkj5FkbGTDDESEEFNJQVqJP/3Ue5/OXBQ22wt yK0syP0P9rjtNOjYBaW58G+9cd32g1HRhhozDmvG+O8sFVl3qlMTOPejaYtHl5MSYlAm eer9N2f4j/meYU5GTtJwtiJ+vqs8Ozm5BqJZprbPYe0b2gGkslnmXB5rgDQRRkxKP1Bs YMEeY1OphwwjhIWrXQP3sC4N3E58nK86PSvugvOLC7aZhxVfPtYpmjEA+HbLoFurHrkM wdVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hqgbZmKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n4-20020a170902d2c400b001ca1bd1e09bsi7455424plc.376.2023.10.16.09.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hqgbZmKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 435238083B6A; Mon, 16 Oct 2023 09:40:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234456AbjJPQjp (ORCPT + 99 others); Mon, 16 Oct 2023 12:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbjJPQh5 (ORCPT ); Mon, 16 Oct 2023 12:37:57 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C158252; Mon, 16 Oct 2023 09:23:15 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 378FBE0002; Mon, 16 Oct 2023 16:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697473394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/XVHBW4OllJOkAPcU2owgNX1LO5d3o45pdtyP1brke4=; b=hqgbZmKJTURFIiX5ft6fhvifc3JzLapjCqlmxEd8rPDZ+kcyaFLNEi2/2qzlOkr90NvDhm lNLJkQHtfn4K17Pir/2CyMQW3WQ/+VcQC6x2SokKSko5WO/XwQZdOuBeEQHGgLKW9SOw5C 4dXiSjc0JlSHJUDRNg1vwQ6wJFUGgof64slmcaCYnt7j5DSqqFkibPvkD8+wwPRbvMq24T Cr2tWqMbu42VlXFo7XGRB9QJ4p4RKqogyzwXraGpp2nEvGV74nVyomo3vJjobXdYS4NgAo ucYUU9I+fR7bocPTlzY5q3Um7oFrD9ga9LQXbKBhRFZr01NCqry2O8jXRVK9TQ== Date: Mon, 16 Oct 2023 18:23:07 +0200 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Jakub Kicinski Cc: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Thomas Petazzoni , "David S . Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , Jay Vosburgh , Andy Gospodarek , Nicolas Ferre , Claudiu Beznea , Horatiu Vultur , UNGLinuxDriver@microchip.com, Broadcom internal kernel review list , Heiner Kallweit , Russell King , Richard Cochran , Radu Pirea , Willem de Bruijn , Vladimir Oltean , Michael Walle , Jacob Keller , Maxime Chevallier Subject: Re: [PATCH net-next v5 08/16] net: ethtool: Add a command to expose current time stamping layer Message-ID: <20231016182307.18c5dcf1@kmaincent-XPS-13-7390> In-Reply-To: <20231016084346.10764b4a@kernel.org> References: <20231009155138.86458-1-kory.maincent@bootlin.com> <20231009155138.86458-9-kory.maincent@bootlin.com> <2fbde275-e60b-473d-8488-8f0aa637c294@broadcom.com> <20231010102343.3529e4a7@kmaincent-XPS-13-7390> <20231013090020.34e9f125@kernel.org> <6ef6418d-6e63-49bd-bcc1-cdc6eb0da2d5@lunn.ch> <20231016124134.6b271f07@kmaincent-XPS-13-7390> <20231016072204.1cb41eab@kernel.org> <20231016170027.42806cb7@kmaincent-XPS-13-7390> <20231016084346.10764b4a@kernel.org> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:40:48 -0700 (PDT) On Mon, 16 Oct 2023 08:43:46 -0700 Jakub Kicinski wrote: > On Mon, 16 Oct 2023 17:00:27 +0200 K=C3=B6ry Maincent wrote: > > On Mon, 16 Oct 2023 07:22:04 -0700 > > Jakub Kicinski wrote: =20 > > > Ok, but there might be quality difference in case of several timestamp > > configuration done in the MAC. Like the timestamping precision vs frequ= ency > > precision. In that case how ethtool would tell the driver to switch bet= ween > > them? =20 >=20 > What's the reason for timestamp precision differences? > My understanding so far was the the differences come from: > 1. different stamping device (i.e. separate "piece of silicon", > accessed over a different bus, with different PHC etc.) > 2. different stamping point (MAC vs DMA) >=20 > I don't think any "integrated" device would support stamps which > differ under category 1. It was a case reported by Maxime on v3: https://lore.kernel.org/netdev/20230324112541.0b3dd38a@pc-7.home/=20 > > My solution could work for this case by simply adding new values to the > > enum: > >=20 > > enum { > > NETDEV_TIMESTAMPING =3D (1 << 0), > > PHYLIB_TIMESTAMPING =3D (1 << 1), > > MAC_TS_PRECISION =3D (1 << 2)|(1 << 0), > > MAC_FREQ_PRECISION =3D (2 << 2)|(1 << 0), > > } > >=20 > > Automatically Linux will go through the netdev implementation and could= pass > > the enum value to the netdev driver. =20 >=20 > We can add multiple fields to netlink. Why use the magic encoding? To simplify the Linux code to go under either netdev or phylib implementati= on without needing describing all the enum possibility in the condition: if (ts_layer & PHYLIB_TIMESTAMPING) ... if (ts_layer & NETDEV_TIMESTAMPING) ... We also could add "is_phylib" and "is_netdev" functions with a simple switch case in it, but we have to be careful to always update these functions when= new enum values will appear. >=20 > > > But there is a big difference between MAC/PHY and DMA which would > > > both fall under NETDEV? =20 > >=20 > > Currently there is no DMA timestamping support right? =20 >=20 > Kinda. Some devices pass DMA stamps as "HW stamps", and pretend they > are "good enough". But yes, there's no distinction at API level. Ok. I did suppose this when writing my last reply. > > In that case we will have MAC and DMA under netdev and PHY under phylib= and > > we won't have to do anything more than this timestamping management pat= ch:=20 > > https://lore.kernel.org/netdev/20231009155138.86458-14-kory.maincent@bo= otlin.com/ > > =20 >=20 > Maybe we should start with a doc describing what APIs are at play, > what questions they answer, and what hard use cases we have. >=20 > I'm not opposed to the ethool API reporting just the differences > from my point 1. (in the first paragraph). But then we shouldn't > call that "layer", IMO, but device or source or such. I am open to change the naming to fit the best for our current and future u= sage. If we take into account the Maxime case of several timestamps on a device t= hen maybe source could work.