Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2479723rdb; Mon, 20 Nov 2023 11:59:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXsxHyYDpTDns4i1mxsvzZVSTYHP+agYtLuK46AzB6nbtYcGblzbNwKTrugdtO86lXVVdI X-Received: by 2002:a05:6808:1529:b0:3af:c259:71e6 with SMTP id u41-20020a056808152900b003afc25971e6mr3799095oiw.5.1700510341952; Mon, 20 Nov 2023 11:59:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700510341; cv=none; d=google.com; s=arc-20160816; b=S0zdZvajH7QhzKWC+1Am8RmwW/CtNK9+8efOyfdxs6c73PZ5i9n+v0/zNDOp2XbQQz H505cHd1Gt3VyFUvIeXdInggGi+zHwhzUOkYu7oCvaxVr0L8nmgxa5n85wOAaRRVAtoG aQfA+/4CMH50+yKgtVIurHSNz/ZNwPBqWWrOrQriJe2/VT2Ni+3LVlofg2WgUmZIX5Cy YSA5fgPWS/dMw8LVsCgnbBQn6CmWZdWs8/QPCqmUwqqYGBOY3hvMrWebwQKRbdBMrz5a WXE/EIDJCyHxLMTzXYhgHllXlv5Uo4WvJRnqgRbDRlVF2mFAV4NtoFeX84p/nlgEQYvZ +ytg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kqOXLzKsdX7CU+BiLbd6l4zUkLWhjs83HEjABTqBCM0=; fh=R5kBmJySSBdAH4m2RtTvd5gBSup+rk9XN+LvkgmMOaw=; b=V6s20gQKjIFk4wwp+yvDTVAeXudMf/sqxe0q1Mznpbvgi5theYxjZjPdxJR/Y2fP0o e7+qnOgMDbsVRWZsEqn5C66UgH5T2v/pzVs+KpsNlvqyQklPP7kSybCuwhP6CNQ04M+T jWn5i3g9j0Ajae+nkb6VzDCgRZrt/HPfP68i5VyNoLIZm7hWhCtYWBbrgTrDMwsxy/AO vQmXyInjJRQe2TXyzNEPWmyk8dMkF4gFacY5durNLfHo4A7Q6evL+xYBGLKOu0T+wo8L 39rDCsBw8j8ZiW9PLi3erMJNybklr0023s2AvGjSE2dxtaJRD0FCui3G1q4ZOhn4YlGM xo/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BKNkukmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p14-20020a634f4e000000b005c1cc7273bfsi8336282pgl.26.2023.11.20.11.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 11:59:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BKNkukmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0C277802F7E3; Mon, 20 Nov 2023 11:58:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbjKTT6q (ORCPT + 99 others); Mon, 20 Nov 2023 14:58:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjKTT6p (ORCPT ); Mon, 20 Nov 2023 14:58:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D54C4 for ; Mon, 20 Nov 2023 11:58:41 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 583B4C433C8; Mon, 20 Nov 2023 19:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700510321; bh=kqOXLzKsdX7CU+BiLbd6l4zUkLWhjs83HEjABTqBCM0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BKNkukmIlBs70y1buJVoLbG9KgdLqmiyiai9AM3sC1n6ybQf+tv3usOOs8CEgfQZO lgSdc/lkoKDZdYxTomFUZNCzWuLZ4+5XgL9lxU2+18+N/avPDB/hMW5OUpWNeqOoNU ACBvNxjZ5hoUuuj1rXup1tKbFRZHay3gn6bpMdQDa05xOB3sPdvMCteutsVQH50joc Vsgxoqr/pSEZZIJsfkt2MiUb5k5v+tUntmuwN6U0to9GDNkjWjTdui/2wB65t+IiYZ a5ps3Z3E9rZdAJenUi5Y421Flyb5YNbxq43UaHsfpWh1uuo/ZFYfVoyFmgIV7yJrCY hH3QWP8K5Mzaw== Date: Mon, 20 Nov 2023 11:58:39 -0800 From: Jakub Kicinski To: Vladimir Oltean Cc: =?UTF-8?B?S8O2cnk=?= Maincent , 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: <20231120115839.74ee5492@kernel.org> In-Reply-To: <20231120190023.ymog4yb2hcydhmua@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> <20231120093723.4d88fb2a@kernel.org> <20231120190023.ymog4yb2hcydhmua@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 11:58:56 -0800 (PST) On Mon, 20 Nov 2023 21:00:23 +0200 Vladimir Oltean wrote: > Well, first of all, given my understanding of the "laws of physics", > I think something has to give in your use case description. I can't > see how on RX, the NIC can decide in advance whether to provide low > rate MAC timestamps for packets going to a socket and high rate DMA > timestamps for packets going to another socket. It can either provide > MAC timestamps, or DMA timestamps, or an unreliable, unpresentable to > user space, mix. Rx time stamping is configured by filters. Is there a problem with user specifying that they want "true" timestamps for PTP/NTP packets, and "dma" timestamps for all the rest? Maybe we can extend struct scm_timestamping to carry an indication which stamp ended up in ts[2] but that's less important to me than the ability to configure the thing. Right now, as I said, mlx5 uses an ethtool priv flag :( > But maybe I'm wrong and there are NICs which can do that filtering. > If such NIC exists, then I guess a SOF_TIMESTAMPING_RX_DMA flag should > be added to the socket layer, and the NIC driver provides timestamps > according to the skb->sk->sk_tsflags, and that problem is completely out > of scope for K=C3=B6ry's patch set - and implicitly compatible with it, s= ince > as you say, the device-wide timestamping layer - PHC index - does not > really change. IDK. Maybe the sniffles I picked up at LPC are clouding my judgment but to me this patch set is shaped too much by current implementation and not enough by what it's modeling. It basically exposes to user space the "mux" for choosing NETDEV vs PHYLIB. There are multiple time stamping points as the packet moves thru=20 the pipeline. Expose them so that SIOC[GS]HWTSTAMP can target each on individually. > If I'm not wrong and the MAC-or-DMA timestamp selection is NIC-wide > (which diverges from your problem description), Nope. > then neither K=C3=B6ry's work > nor my "everything is a phc_index" proposal will bring your use case to > fruition without further work. Here I would avoid speculating, because a > lot will depend upon the details which you haven't really given. What are the details you'd like? PTP gets stamped at the PHY/MAC,=20 the rest gets stamped at DMA. mlx5 achieves this by splitting the PTP traffic to a separate queue pair, and configuring that qp to capture PHY/MAC stamps, AFAIU. > One question will be whether, in the case of "NIC-wide DMA timestamps", > DMA timestamps should be presented as hardware timestamps - struct > scm_timestamping[2] from CMSG_DATA() - or as their own thing, that user > space needs explicit support for - by parsing a new cmsg level/type. > If DMA timestamps won't look to user space like hardware timestamps, > then the use case is again out of scope for K=C3=B6ry's work, as far as I= see > it. >=20 > Another simple question is - if NICs do this today - probably by giving > the "unrepresentable mix" to user space in an implicit, hardcoded and > very fine tuned way such that nobody bats an eye - then what is there > more to support? Are you looking at extra UAPI as a way to legitimize > hacks, or do you feel there is extra control that applications can gain? I don't understand what you're asking me. DMA timestamping is becoming increasingly important. Ready any congestion control paper from the last 5 years and chances are it will be using delay as a signal. If we're extending uAPI for Hw stamping we should make sure to cater to CC use cases.