Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2273683rdb; Mon, 20 Nov 2023 06:55:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFycDJ++itrEbHRr0AH2Shbbm6v4R4wfeWMxrbZ/pLPZNYPj8Rb4/KOvkfIq/WTQEFDhX8H X-Received: by 2002:a17:902:720c:b0:1cf:31c4:3a7 with SMTP id ba12-20020a170902720c00b001cf31c403a7mr8327059plb.30.1700492105269; Mon, 20 Nov 2023 06:55:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700492105; cv=none; d=google.com; s=arc-20160816; b=iYEz4uVc54jtkeNpvVrMS471sQka/MFhDlokYA1yBsbulPtiU4Xh9VmmB8lw4EMKu0 hQGdR77u/+3OjVwEP5dehBgvKGMO/DplUDBjkjPZfbofS8HCvb0hKGHeafcQ4jGftxPy eNXnGwNfM26Ur+yIPN36OUBvAwtYV3RjGqaWMtOtwRPzPZeCRAsvbu6NoqrHrza8cPMz YqwlqXa96GrBA02yE4wXM9kE5YZG9eickPRq3sV0qruNRCHVARJIwUmUfGPas7xc1vtl stDSb1JIhg++GDm75+fR0H1VJ6dQODqS2rpqMfMXYfLDls//KfchOtNWaL0PMhFRnv/e RaRw== 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=HjKENZFyX54rFkqeyuDYUZ6Ty9kSEaFLut91D/l6Ncg=; fh=MWt/aau18iZB4cBNRDtmAfDw6lQMgSQj1JsFQe1KAAc=; b=zkFYRr+IuyqeXHJu7Ukil8SAJVdWYAggL3PmWCW7a61Xt/M9htPxTDxXxeUEnc/gm8 mZBrP6OYmcR5+M03FPxPLAhyUNWzBEHzVTIcaIkdaFk8c3tHkTb1geaLLnJVr/7+ldqe G7nQwfYYoW5w9HB9ppCDANEP+d2pF7Tgiu62AGBK3W5EEZfQN9Tkuf0jDDIFMjgHbE+4 pW58QT2MyOep7ZmfaW66pCRKuqUC+88MdpYhyvk3b3SJP7FzZdwUA9MZbwhbyrPHhsoW tgE33qfAHU4PsDUH+IuF5xPy5pjKSf6Qorwv8hPOcfe4tFtl+QhL7ZYGOASSaoxn5d6M PPjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BQLcaqE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a24-20020a170902b59800b001c60c109ce7si7925604pls.295.2023.11.20.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:55:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BQLcaqE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id BC49380B7C25; Mon, 20 Nov 2023 06:55:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233904AbjKTOym (ORCPT + 99 others); Mon, 20 Nov 2023 09:54:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbjKTOyV (ORCPT ); Mon, 20 Nov 2023 09:54:21 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5721810CC; Mon, 20 Nov 2023 06:53:48 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7A3A32000C; Mon, 20 Nov 2023 14:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700492027; 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=HjKENZFyX54rFkqeyuDYUZ6Ty9kSEaFLut91D/l6Ncg=; b=BQLcaqE8ggFlKmCl9aqn13XcvzJyg3PLP8bx3vEuNOV6zJwmyVQkvuWjtn62y6zKtOK5pk cpOmlwAo1j7ndcps4ZewnhSn0sH/iiZBIbC4U6mYhnVog8hynOmBn8Spa1R3qNxySHcNep k27e1yImpOd35sY1cPkUV1pfLyKSpcGY4qo9MatqtQuxwIq3tiWn2+gYRvzyymtwFiQ3ce JO+NzWM/CZlchn6wGcjoAeoa0fg03J18Isui6BNvfoEGVqw5xJUVpPECRsu8em/G+ygzyW LGSBRhhu5RgcqafJMJwtswsEvg4gI+Gvshhvg90NwjlOvZonwk96FRh9+ONqYw== Date: Mon, 20 Nov 2023 15:53:44 +0100 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Vladimir Oltean Cc: Jakub Kicinski , Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , 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 , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maxime Chevallier Subject: Re: [PATCH net-next v7 15/16] net: ethtool: ts: Let the active time stamping layer be selectable Message-ID: <20231120155344.14cd69d9@kmaincent-XPS-13-7390> In-Reply-To: <20231120142316.d2emoaqeej2pg4s3@skbuf> References: <20231114-feature_ptp_netnext-v7-0-472e77951e40@bootlin.com> <20231114-feature_ptp_netnext-v7-15-472e77951e40@bootlin.com> <20231118183433.30ca1d1a@kernel.org> <20231120104439.15bfdd09@kmaincent-XPS-13-7390> <20231120105255.cgbart5amkg4efaz@skbuf> <20231120121440.3274d44c@kmaincent-XPS-13-7390> <20231120120601.ondrhbkqpnaozl2q@skbuf> <20231120144929.3375317e@kmaincent-XPS-13-7390> <20231120142316.d2emoaqeej2pg4s3@skbuf> 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.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:55:01 -0800 (PST) On Mon, 20 Nov 2023 16:23:16 +0200 Vladimir Oltean wrote: > On Mon, Nov 20, 2023 at 02:49:29PM +0100, K=C3=B6ry Maincent wrote: > > > The next question would be: if a driver performs PHY management in > > > firmware, and does not use phylib, how should user space interact wit= h it? > > > What timestamping layer and upon what should the ID be chosen? =20 > >=20 > > In that case it could be the second options I refereed to. > > Using the id to select the right timestamp within the NIC driver. > > It indeed won't be called PHY timestamping as it is managed by the NIC > > firmware but as it is managed by only one firmware and driver using the= id > > to separate the available timestamp seems a good idea. > >=20 > > Another solution would be to create another value in the layer enumerat= ion. > > PHY_NIC_TIMESTAMPING? Better idea? I am not good at naming. =20 >=20 > The point I was trying to make is that your current choice of exposing > PHY_TIMESTAMPING in UAPI, when it really only refers to phylib PHYs, > would lead exactly to this sort of UAPI balkanization where everyone > wants to add more timestamping layers, and to define IDs to be specific > to their own invented layer. Maybe the concept of timestamping layers is > not what user space should see at all. >=20 > In previous email discussions, I was proposing to Jakub and you "what if > we didn't let user space select a specific layer like PHY_TIMESTAMPING > or MAC_TIMESTAMPING at all, but just select a specific phc_index as the > provider of hardware timestamps"? >=20 > The limitation we're trying to lift is that currently, there can be only > a single provider of hardware timestamps. We make that provider customiza= ble. > There is already a good understanding from user space that, if "ethtool -= T" > on an interface says there is no PHC, then there are going to be no > hardware timestamps. So I thought it would be much more intuitive if the > timestamping layer could be selected by the user merely by an unified > phc_index (provided by a phylib phy or firmware based driver or whatever), > and everything else would just be an implementation detail of the kernel. > No one should care that it's a phylib phy, and shouldn't use a different > procedure to identify its ID based on whether it's a phylib or firmware > PHY. >=20 > It's a bit hard to align my expectation of what this series should offer > with yours. I think we're talking past each other, which unfortunately > makes me lose track and interest. I wish you could have answered my > earlier question about this alternative proposal. > https://lore.kernel.org/netdev/20231013170903.p3ycicebnfrsmoks@skbuf/ I did thought about it but I got stuck by the case of hardware timestamping without PHC. Richard explained the reason of its existence here: https://lore.kernel.org/netdev/ZS3MKWlnPqTe8gkq@hoboy.vegasvil.org/#t Maybe I got a bit stuck in my implementation and should investigate more yo= ur proposition and how to deal with this case. Do you have an idea on how to solve it? > > > Finally (and unrelated to the question above), why is > > > SOFTWARE_TIMESTAMPING even a layer exposed in the UAPI? My understand= ing > > > of this patch set is that it is meant to select the source of hardware > > > timestamps that are given to a socket. What gap in the UAPI does the > > > introduction of a SOFTWARE_TIMESTAMPING hwtstamping layer cover? =20 > >=20 > > As I explained to Jakub: > > The software timestamping comes from the MAC driver capabilities and I > > decided to separate software and MAC timestamping. =20 >=20 > Why? What was the problem? This confuses me because I don't understand > what is the problem that the solution is trying to address, and whether > the solution is orthogonal to all the other UAPI that exists for > software and hardware timestamping at the socket layer - which AFAIK can > happily coexist. >=20 > > If we select PHY timestamping we can't use software timestamping and > > for an user, selecting the MAC as timestamping seems not logical to > > use software timestamping (I got confused myself when I first dig into > > it long time ago). Be able to select directly Software timestamping > > seems appropriate and won't bring any harm. What do you think? =20 >=20 > Hmm, can you please explain what is the reason why software timestamping > can't coexist with PHY timestamping? It is a genuine question to which I > don't have an answer - I haven't used PHY timestamping. It must be > something specific to that, since I do know that MAC + software > timestamping work simultaneously just fine. The software timestamp is managed through the MAC driver calling skb_tx_timestamp() function. The PHY driver does not call it, that's why th= ere is no software timestamping in PHY driver capabilities. Also the PHY driver doesn't know if the MAC driver support it so it currently can not coexist w= ith PHY timestamping. Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com