Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1406120rdh; Fri, 24 Nov 2023 11:46:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzkcF2ABvkwJ4ZDkGYuq/jV1LzXbm/imbRxILiyQTgqlCtIF9rxgYgEDqXPuEoedW7xQqK X-Received: by 2002:a05:6a21:3987:b0:18b:5aab:93bd with SMTP id ad7-20020a056a21398700b0018b5aab93bdmr6156896pzc.4.1700855213072; Fri, 24 Nov 2023 11:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700855213; cv=none; d=google.com; s=arc-20160816; b=z4+pxtawRhWtaOlwgKDPmRYSlCtAxCMeXGn1eEQjPxZUlDCOurKujpsZ8o0E/BEDSx USrSnTka92KG4U9fcW5I5OkxI2ue2UmW+I1qARcNk48Lh0LmY05+Y+qW7ugAu/hiJha1 FgEA78tJtPzCFGiT5rTFIUvWqeabRJBFKDFCi9kfGxQARWZtmmNv2pvYKBWB6Cu6VPu2 jzxOPn84p75i/fAI03HHVREvepZqTQQpH6/ikKJgmcxf+XToh/FO8MGWmSqda1wf+ngv ZkREH0ZKgJ7O8TwNF40c3CZx3rv7EuGGsgTznPNImiTZfGTeg7rGRwPoVZc28LoBMa2C jRqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xj3LV0uh4tcYVh+QVdDebQdSeI5pw/VXJnEd0vmrfC4=; fh=RpRB5kewBHu8eXAlCbfDYBAY0khsNMkEf8w5BdmLF7E=; b=KO93d0jWCLz+RAy2dlzY+xWnqNRdl+S0Ngy+KHFBXRfoLVe5nC36rlAw5Z1Hbn9d9c 6ShFpcYklRDBQMiGysmfGE4/FCPOb7+AWUkKBG/vHOMAgscquY0knwKquOmoDk+ZMtOU zsDI2SDcq0zti6Obyid5HR9ZJX1xhkJu0lNFl3PFnnDEslf9LMNQtYrP+Ebp0z9+S7E+ lYZv9KrkXx46Jhba/D7Tah7ASEX94W3v+qvvZlCJIJiuBddFYhag3Zzjra1/QQjedTZt neKabCG6bEeojea68AKXzWJbxYH2gcHN9YkRmEZFQWsxuwxIKOMfw9MkKZnlEYL0mIxM EI8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UBNL18Xm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ck21-20020a056a02091500b0056a36ac322fsi4354297pgb.514.2023.11.24.11.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 11:46:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UBNL18Xm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CC9A08085985; Fri, 24 Nov 2023 11:46:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346011AbjKXTqV (ORCPT + 99 others); Fri, 24 Nov 2023 14:46:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345941AbjKXTqT (ORCPT ); Fri, 24 Nov 2023 14:46:19 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3939A93 for ; Fri, 24 Nov 2023 11:46:26 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-35c767a9e76so38825ab.1 for ; Fri, 24 Nov 2023 11:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700855185; x=1701459985; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xj3LV0uh4tcYVh+QVdDebQdSeI5pw/VXJnEd0vmrfC4=; b=UBNL18XmfyQr9hxl9uZSj/Uu9yD0QINYBtxB02DqWOWOsSWxMNQoilhhj5K102oiMs 5l7KIXgjh2SAZEkcF7u6rKIO38JFVyXufNtrenuAv5DGGbn784r3iDH7PozZfYMIXVfF ubOSTC3K4tSGHiL7x33nDKs03558dr8o0PSkgG/1zCzXNQeC/iMCIS1Ogq6pLAPO0JSN RsYtwObcOWGnCcu3j5Iv60mQE96/xXUFmPd7r2+7Af4+aPVqJ/+t84hOnAuN3ATTTFl/ NRGnlRFskfbjwt7xCd0TGDqCeUPY5JyVvvrCl44VW8vJcRJ+cJFYriNljp7oAm5uW1/t Qi0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700855185; x=1701459985; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xj3LV0uh4tcYVh+QVdDebQdSeI5pw/VXJnEd0vmrfC4=; b=H1ww0kAG2i+teVZa/f1i8pVlEMVJFw79Zuq8FjFBpwFgqGpxx5JCTtGFfuS5qzWDra j5tC8MBLoZ7wQk4Jwj4ZIgvAkKI50nks4vck7hVcbHLXtj4twqKvkQpFSQ99Tj14BAy/ 8bqlX+Ip27eQovDDkVe/v6VHrlWIcX8/bQtBI68gqF7E+pcH9u66NEwrErX8T+HD+o7j 3wfQV8fsVUIoVcGmQbta15vXwA+NRxxiVZTHaFimtkxKYiM5MOuXF/oRleZEL8CbyQmB HQBcsZ1bzZWW33ZYMDsekiOEEofrkoLY9S6yFbMdCEtotOBcBkHus9VEYnmqr/1vOT7w GvyQ== X-Gm-Message-State: AOJu0YwHSlkLstw2iJEjuK47N1CD2gG6NRuFTwlqGanh9CrTEjxgBHed NbnnIBK4VA5RwXFWNRxmEvVKPc89eaFIJrAELvKK9A== X-Received: by 2002:a05:6e02:1a0c:b0:35a:faac:aee0 with SMTP id s12-20020a056e021a0c00b0035afaacaee0mr497567ild.29.1700855185427; Fri, 24 Nov 2023 11:46:25 -0800 (PST) MIME-Version: 1.0 References: <20231120220549.cvsz2ni3wj7mcukh@skbuf> <20231121183114.727fb6d7@kmaincent-XPS-13-7390> <20231121094354.635ee8cd@kernel.org> <20231122144453.5eb0382f@kmaincent-XPS-13-7390> <20231122140850.li2mvf6tpo3f2fhh@skbuf> <20231122143618.cqyb45po7bon2xzg@skbuf> <20231122085459.1601141e@kernel.org> <20231122165955.tujcadked5bgqjet@skbuf> <20231122095525.1438eaa3@kernel.org> <20231124172754.tneftor7uobrul5f@skbuf> In-Reply-To: <20231124172754.tneftor7uobrul5f@skbuf> From: Willem de Bruijn Date: Fri, 24 Nov 2023 14:45:46 -0500 Message-ID: Subject: Re: [PATCH net-next v7 15/16] net: ethtool: ts: Let the active time stamping layer be selectable To: Vladimir Oltean Cc: Jakub Kicinski , =?UTF-8?Q?K=C3=B6ry_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 , Mahesh Bandewar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Fri, 24 Nov 2023 11:46:37 -0800 (PST) On Fri, Nov 24, 2023 at 12:28=E2=80=AFPM Vladimir Oltean wrote: > > Hi Willem, > > On Wed, Nov 22, 2023 at 01:11:02PM -0500, Willem de Bruijn wrote: > > There already is a disconnect between configuring hardware timestamp > > generation. Through the ioctl, which is a global admin-only interface. > > And requesting timestamps with SO_TIMESTAMPING. > > > > Today the user of ptp4l already has to know that the admin has > > configured the right RX and TX filters. That is no different if > > multiple filters can be installed? (PHY for PTP, DMA for everything > > else). > > Are you saying that ptp4l doesn't configure the RX and TX filters by > itself, just the admin had to do that? Because it does. > https://github.com/richardcochran/linuxptp/blob/master/sk.c#L59 > > I'm not seeing the disconnect. SO_TIMESTAMPING is for the socket, > SIOCSHWTSTAMP is for the configuration at the device level. > > It _is_ different if multiple filters can be installed, because either > we let things be (and ptp4l issues the same ioctl which affects the > default hwtstamp provider, which may or may not coincide with what we > intend), or we teach ptp4l to deal with the multitude of providers that > a port may have. I see. By disconnect, I meant that the socket option is unprivileged and can be set by many processes, while the ioctl is a global privileged setting, so must be under control of a single admin. But I did not know that ptp4l can take on both those roles for PTP. Perhaps multiple SIOCSHWTSTAMP rules can coexist, up to one per level: HWTSTAMP_FILTER_PTP_V2_EVENT, level=3DPHY HWTSTAMP_FILTER_ALL, level, level=3DDMA Then ptp4l can manage all levels except the DMA level. And DMA timestamps can be configured independently by another admin. If only one timestamp can be communicated to the host, the earliest match must takes precedence. Jakub pointed out how one device handles this by having a separate queue for PHY timestamped packets. This does not address the issue that packets with different precision skb_shinfo(skb)->hwtstamps->hwtstamp may now exist in the system. All packets reaching ptp4l sockets must have a high resolution source, but there is no explicit annotation to ensure or check this. This is fully based on trusting the HWSTAMP_FILTER. Expanding the skb infra and cmsg might be follow-on work.