Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2448568rdb; Mon, 20 Nov 2023 11:01:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMjEuBjdEJVGcVJcXxbXyCazdt0gLj/wD+womyAq5KZcL9g3EEsmx8L26Sjttd3KPG5YJg X-Received: by 2002:a05:6871:e48a:b0:1e9:e8c7:bef6 with SMTP id pz10-20020a056871e48a00b001e9e8c7bef6mr251850oac.18.1700506916086; Mon, 20 Nov 2023 11:01:56 -0800 (PST) Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id hi18-20020a056870c99200b001bb4d565718si3081337oab.96.2023.11.20.11.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 11:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nxp.com header.s=selector2 header.b=SBW21hBr; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 46CC88093CBC; Mon, 20 Nov 2023 11:01:06 -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 S231768AbjKTTAg (ORCPT + 99 others); Mon, 20 Nov 2023 14:00:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjKTTAe (ORCPT ); Mon, 20 Nov 2023 14:00:34 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2054.outbound.protection.outlook.com [40.107.104.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB92110; Mon, 20 Nov 2023 11:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auxoFr32gIDgHGnSldYfaZnEFiajFMOlSuIe1v5TSXyBkH72y74p6wpiUtrVrbmdQxTLbWa3wdp2MaslGW0gdxkMKlGf82IpM/iEr22BYVrKsEx6ex0kFdXnXA2dZ7ij85BrB8xkHa/9t1vGHBbeXg2FLHD2L+MXGqCYcp4LUadM+u7n2ANKErzLm5Pwh0jTCZYZAaJflHfC9Jsv65nYSu6RplwRBhuO8XGeshrNnlhcbsa77g4GARXeU4U7bqqOIc7b1IRQEsIp61MUQFL72yVqfAQBzZx3UvmkLp5YjgRDg/nPiEOkFIDAnJmbaRtK6omO3zqdleUH2QR3xfwCfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GjFgWk6xbqwmX2w5m+KL7YYfXNiLEGvGUJC49wx9f88=; b=PhpuKMKrk/a2vZUkE+zIbqP2acTAn9nKlnp0145Z4qgWg2Tzb1Xa0J5xagrT3d90lzEUsNeQek7ehuanvAq3I3AtOpHCmNUdU36irxRobPil8RTI8GfywsbqZqBxJ+zmsC/Nh7eAQxLDqI6w/I23yQOpOvR6EnBS7T+HeXnywtO/rWae0EWX4hWlCCoRO8+7GYRe453PaVt5hnxJrZf+MwW1me8TOvD56h/hmZumoKAsQ5wgBxcjjB6e+BG0CewNxL/+MpBM7WK7cqGigGDM9J7uIKUMpbWjQV3F34c8d6gxNc8dMq8Rag+n4Zs5LwI/MvabkrlCaIEiwVGNqPg46w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GjFgWk6xbqwmX2w5m+KL7YYfXNiLEGvGUJC49wx9f88=; b=SBW21hBrf3FpTmjt4y1X5BbFaLOwHBHtIXRz65rZTk1sRAu4Wber8TQbtmxEz7AWCFSBjDRFw6O0wJSrIG3O/+yATkA3NXg3AbSOT8UbaAmYs1Pu46SIel8taTqyq0JbmeCv3+AxwyFJqr0PED3BR2zQ96e8B2LbgeTq3ywi0O0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DU2PR04MB8694.eurprd04.prod.outlook.com (2603:10a6:10:2dd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.16; Mon, 20 Nov 2023 19:00:27 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dd33:f07:7cfd:afa4]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dd33:f07:7cfd:afa4%7]) with mapi id 15.20.7025.015; Mon, 20 Nov 2023 19:00:27 +0000 Date: Mon, 20 Nov 2023 21:00:23 +0200 From: Vladimir Oltean To: Jakub Kicinski 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: <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> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231120093723.4d88fb2a@kernel.org> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DU2PR04MB8694:EE_ X-MS-Office365-Filtering-Correlation-Id: 1efd792d-2472-469a-801b-08dbe9faf58a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y0EZFJDrbXMxgYldlI0R/fx42DpbXAkDbIR2gtgdcvRPhvS3BtwrjXRXK4hLw8WmKjdkBZXOa2PRtxuGSdy8Hi4eetthyJG4RBVXGhWTOsaqcTOwDWWhurDJ/ZY7oXrUuReSOv+69TFP+P8Hkr9RmrwWZJnDd68jVrZI3q9c2aVnRrf9/dE/WpZIV6esA/FonWLiy7nnDKZ9XBYJp7g6jboDxGt0UNZDqeo862IALeFAZ2bewsxzbRcbJRIsYQajgnf8Q+8kfW6Wmem/zGGuGiMAu77WU+ffTyZR2IMAarrqWcTjgvO6k8fPLp6evze5opxU/8KRnrogheFvCpNv1wD7E1tZ/uzPnkABr84+YgTf8f5ZMInVIa8RB0bfYj4+V0JqdPI9zszXi/1o/oSWZq1qcBp+yH7qY21TTEbejgKCejSmAHWk04Boy16hO6egKnx6NzjVc0G2teMI6TN6vcKNVk+Hrnk+URdsGhbrJnZGoiztVsj6EYoFTYP65/xK/csM9stcMXvG95o/j/cNuzURI8FXhxNQ7YIHPXgw+EMJuHFF3NwMmGQWAi5ujLRD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(396003)(136003)(376002)(39860400002)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(6506007)(6512007)(26005)(1076003)(6666004)(9686003)(6916009)(316002)(6486002)(478600001)(83380400001)(66946007)(66556008)(66476007)(54906003)(44832011)(7416002)(8936002)(8676002)(4326008)(86362001)(38100700002)(5660300002)(2906002)(41300700001)(33716001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?khAMglkBP/70k4Buhga35KngCQc2Xja19ZzmuXFxtteSjCC4fkECY1oUhV?= =?iso-8859-1?Q?YTyPfJj+bFUrSkf5uK1XeycANnx8g4o4tlKuORb1Phk2yVWXhyCozK6D+h?= =?iso-8859-1?Q?/DcazAH8KOU87SR2CTb3nbs10WyRUGp4mlva2oSkVgi5/DEl7uO1+xdQFV?= =?iso-8859-1?Q?8k31p2RSHKwBmjsRYahfeT506X/+FWQOG95aPnqrCKKMb5ikRA0roqU8Wm?= =?iso-8859-1?Q?pWhPdoPsxQ0mKuA9uL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-1?Q?EqXYLgMs0cGyTzuDuADc+wwytoP2YtjzBe6hv3Pe0YC7Q1vs1vvv5IsHIg?= =?iso-8859-1?Q?FyK2+A1tCHYevYWIt7qsaL7tuL2jSZhB9RtJOJX0TNE0eYohJCDBP4/bMp?= =?iso-8859-1?Q?+RSjnXVNAcf7yXPIrL1vC1ogMepfsU4R+7tSn1LKWxmbIZmJA8pz3kvhrN?= =?iso-8859-1?Q?aedW9Z8dVYnJJNYYcthY+uCyN6KiuQBk3dJ9n7gQRrU6NoZ8ZMY0WTaZ4D?= =?iso-8859-1?Q?5MtnWrtWvYJlMpVgtv0oK0O7Kr7BFQmaD3hbIqXOFq390tvGs+Mb4BuKU6?= =?iso-8859-1?Q?jW4g2LqfdiYXvN68L1HcCu/mqbg934P6D+EcnwKeMLU5PsQp06UeEzBp4K?= =?iso-8859-1?Q?lUqtII6Qf7/pfcM60b4Mr1cog9ePkvVCcgl528MGNAaP9Z8ECPuuqL/hhi?= =?iso-8859-1?Q?nGCAdRDxEs229DYTy1Jt7+6wc+2UZ3gBpQh3dbTeO8srSmplx/Q8QiDFU5?= =?iso-8859-1?Q?biOOO+3VipCnf8DtnY9GCaRSrCEt4SHCZ2W4nk3Cv0JqvaaFMGtAN37Q?= =?iso-8859-1?Q?=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1efd792d-2472-469a-801b-08dbe9faf58a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2023 19:00:27.5142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fQFb7Yn5MtVxaT3DdZmAyrj7jo5TgMrGjDz84LEVKt5Wb+wFdapjk8ALlcimJpDi5coxoQFxhi2rMTpX+UFKVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8694 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 11:01:06 -0800 (PST) On Mon, Nov 20, 2023 at 09:37:23AM -0800, Jakub Kicinski wrote: > On Mon, 20 Nov 2023 16:23:16 +0200 Vladimir Oltean wrote: > > 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"? > > What about my use case of having a NIC which can stamp at a low rate > at the PHY (for PTP) and high rate at the DMA block (for congestion > control)? Both stamp points have the same PHC index. 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. 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?ry's patch set - and implicitly compatible with it, since as you say, the device-wide timestamping layer - PHC index - does not really change. If I'm not wrong and the MAC-or-DMA timestamp selection is NIC-wide (which diverges from your problem description), then neither K?ry'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. 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?ry's work, as far as I see it. 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?