Message ID | 20231019-feature_ptp_netnext-v6-7-71affc27b0e5@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp425462vqb; Thu, 19 Oct 2023 07:31:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCjrM7IeupFUBiiQjlfXs4rxktii7WcWFWbMZUa+qt6Ezz+5wMPfvGnkdOMSbTwT2kPpCl X-Received: by 2002:a17:903:2308:b0:1bb:b74c:88f6 with SMTP id d8-20020a170903230800b001bbb74c88f6mr2848843plh.16.1697725896008; Thu, 19 Oct 2023 07:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697725895; cv=none; d=google.com; s=arc-20160816; b=gIfg+tXcKtFOjqWsxeM4swyuho+/PUMmW75K/XjioAxu+qRhTwldVU9mYb8xqs/mFi rwh3djYO+EcmsjIYx1NYddTxXsOk27wlL3ufHnB0hpoBfcaNdvbfRCkuE2dqO8jfL+T6 CpQBhjtytJcxZS+pfrmhT/9ZkR1dcsiKfScZZvKQTxqXHJQMjqKPA3L3kM074vD028ni gmSJ3Ct0YpgW28bY7ki/TCpaKOZaaw3aHocAN3tHWQvaV4JyFlOe6hYSkL+F5cjXH9nH Yswh4/m6vWqqpRpuzYMIg7xf4kQoLbveOaSWh6fxL4XbYXYElkajNKEZ86WaUolhWzY5 8lzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=10SiBN/4Fj+hMV2c6j8AN3pqV9PZiveL87TjssWFLBw=; fh=IL4Om7kRbYP5ILTMWk7kzVj5RVF0+t2ztL6E2Yzsl4U=; b=xEnRENCYJj8pc9s3RAVEBmnkzG8/4AnqvELUS+I9RtUqB9J25Qp5TnSytDD2foP/AM rMPSfiJ4Qvqybh2pPJDZTwBq5JPnuGER2Cup+MjzuV9Ym5eizhX+bbBTc5FjDCWESWRU xFkcKXWjd1RJf2oEZOXi1dJN0oXXAIAErQGxKCNIfxIHtecFyu6UHu+JeKtgQLBi/G0e X8J60c4Yvr1mIOYCKtMoOa/O9MU/9a2EaD9BH40ESEPIJ+feu3PywMZ6FbTphbFUKFG6 zYGwfJQwKSFhRc8pZ6a2nu3bl3jZZjlFeQ6It5pi0Ju46yr2llKLwvKZXlUUcEDf6p9A pP1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=gSiwOFza; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id i16-20020a17090332d000b001c0c86a541asi2418865plr.375.2023.10.19.07.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 07:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=gSiwOFza; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 38FA28061B74; Thu, 19 Oct 2023 07:30:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346169AbjJSOaH (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 10:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346127AbjJSO3z (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 10:29:55 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5E4913A; Thu, 19 Oct 2023 07:29:50 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4241C6001E; Thu, 19 Oct 2023 14:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697725789; 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=10SiBN/4Fj+hMV2c6j8AN3pqV9PZiveL87TjssWFLBw=; b=gSiwOFzap7y0QDq9iIecJSd5Fjz/bJ4Ru8KF5DeoJwC/X9FNV5UtG7SL1MYEUWf2aX/jzA 0UkF7GyG/yXxTYmqT4NhakfwQTB1GhVjzzJdJ2rcXseek6WV0G6PxuReaDDRYIkmNg+fiL ccUBatSZlEuEBRGgpnTxvVgRU94WbfuEBvnwSVnYiv0AGVEYGGpiheiJ0Lv2w6lL1Pdpst bjfJAIPT+nsrL9in9TB/H/CuMAm2lyz0G9cWPXYIwI35wQsdmC2nt3WZXvHwgkZ92DUm82 G8iNmM4AJxjYAoWHvk1Ta73SEnaL8SOlQyF2F8jW3O0EOqgVEeeqg/yD7VnISQ== From: Kory Maincent <kory.maincent@bootlin.com> Date: Thu, 19 Oct 2023 16:29:22 +0200 Subject: [PATCH net-next v6 07/16] net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231019-feature_ptp_netnext-v6-7-71affc27b0e5@bootlin.com> References: <20231019-feature_ptp_netnext-v6-0-71affc27b0e5@bootlin.com> In-Reply-To: <20231019-feature_ptp_netnext-v6-0-71affc27b0e5@bootlin.com> To: Florian Fainelli <florian.fainelli@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Radu Pirea <radu-nicolae.pirea@oss.nxp.com>, Jay Vosburgh <j.vosburgh@gmail.com>, Andy Gospodarek <andy@greyhouse.net>, Nicolas Ferre <nicolas.ferre@microchip.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>, Willem de Bruijn <willemdebruijn.kernel@gmail.com>, Jonathan Corbet <corbet@lwn.net>, Horatiu Vultur <horatiu.vultur@microchip.com>, UNGLinuxDriver@microchip.com, Simon Horman <horms@kernel.org>, Vladimir Oltean <vladimir.oltean@nxp.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maxime Chevallier <maxime.chevallier@bootlin.com>, Kory Maincent <kory.maincent@bootlin.com> X-Mailer: b4 0.12.3 X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 07:30:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780194629238521999 X-GMAIL-MSGID: 1780194629238521999 |
Series |
net: Make timestamping selectable
|
|
Commit Message
Köry Maincent
Oct. 19, 2023, 2:29 p.m. UTC
Timestamping software or hardware flags are often used as a group,
therefore adding these masks will easier future use.
I did not use SOF_TIMESTAMPING_SYS_HARDWARE flag as it is deprecated and
not use at all.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
include/uapi/linux/net_tstamp.h | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Thu, Oct 19, 2023 at 10:29 AM Kory Maincent <kory.maincent@bootlin.com> wrote: > > Timestamping software or hardware flags are often used as a group, > therefore adding these masks will easier future use. This assumes that device support for timestamping is often symmetric: a device supports both rx and tx, or neither. All devices support software receive timestamping, as that timestamp is taken in the core network stack. But to support transmit timestamps drivers have to call sbk_tstamp_tx in their ndo_start_xmit. For hardware timestamping it may be more common to support both or neither, not sure. > I did not use SOF_TIMESTAMPING_SYS_HARDWARE flag as it is deprecated and > not use at all. > > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> > --- > include/uapi/linux/net_tstamp.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h > index a2c66b3d7f0f..df8091998c8d 100644 > --- a/include/uapi/linux/net_tstamp.h > +++ b/include/uapi/linux/net_tstamp.h > @@ -48,6 +48,14 @@ enum { > SOF_TIMESTAMPING_TX_SCHED | \ > SOF_TIMESTAMPING_TX_ACK) > > +#define SOF_TIMESTAMPING_SOFTWARE_MASK (SOF_TIMESTAMPING_RX_SOFTWARE | \ > + SOF_TIMESTAMPING_TX_SOFTWARE | \ > + SOF_TIMESTAMPING_SOFTWARE) > + > +#define SOF_TIMESTAMPING_HARDWARE_MASK (SOF_TIMESTAMPING_RX_HARDWARE | \ > + SOF_TIMESTAMPING_TX_HARDWARE | \ > + SOF_TIMESTAMPING_RAW_HARDWARE) > + > /** > * struct so_timestamping - SO_TIMESTAMPING parameter > * > > -- > 2.25.1 >
On Thu, 19 Oct 2023 10:48:04 -0400 Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote: > On Thu, Oct 19, 2023 at 10:29 AM Kory Maincent > <kory.maincent@bootlin.com> wrote: > > > > Timestamping software or hardware flags are often used as a group, > > therefore adding these masks will easier future use. > > This assumes that device support for timestamping is often symmetric: > a device supports both rx and tx, or neither. > > All devices support software receive timestamping, as that timestamp > is taken in the core network stack. But to support transmit timestamps > drivers have to call sbk_tstamp_tx in their ndo_start_xmit. Yes, and in that software only case they often call ethtool_op_get_ts_info to fill the timestamp info. There is several drivers that support hardware and software timestamp, these mask could be useful for these. In case of asymmetric support we can still use the SOF_TIMESTAMPING_RX/TX_SOFTWARE flags. I forgot to specify, in the commit message but this patch is mainly to ease the next patch of this series to deal with software/hardware time stamping. Maybe you prefer to have this squash into next patch as had suggested Florian in last version. Köry
On Tue, Oct 24, 2023 at 9:40 AM Köry Maincent <kory.maincent@bootlin.com> wrote: > > On Thu, 19 Oct 2023 10:48:04 -0400 > Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote: > > > On Thu, Oct 19, 2023 at 10:29 AM Kory Maincent > > <kory.maincent@bootlin.com> wrote: > > > > > > Timestamping software or hardware flags are often used as a group, > > > therefore adding these masks will easier future use. > > > > This assumes that device support for timestamping is often symmetric: > > a device supports both rx and tx, or neither. > > > > All devices support software receive timestamping, as that timestamp > > is taken in the core network stack. But to support transmit timestamps > > drivers have to call sbk_tstamp_tx in their ndo_start_xmit. > > Yes, and in that software only case they often call ethtool_op_get_ts_info to > fill the timestamp info. > > There is several drivers that support hardware and software timestamp, these > mask could be useful for these. In case of asymmetric support we can still use > the SOF_TIMESTAMPING_RX/TX_SOFTWARE flags. > > I forgot to specify, in the commit message but this patch is mainly to ease > the next patch of this series to deal with software/hardware time stamping. > Maybe you prefer to have this squash into next patch as had suggested Florian > in last version. Thanks. I did not see such use in net/ or in my experience of using setsockopt SO_TIMESTAMPING. But I had not considered net device get_ts_info. It would be useful there. Slight preference from me to keep this a separate patch, as it applies not only to the use case in your follow-on patch.
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h index a2c66b3d7f0f..df8091998c8d 100644 --- a/include/uapi/linux/net_tstamp.h +++ b/include/uapi/linux/net_tstamp.h @@ -48,6 +48,14 @@ enum { SOF_TIMESTAMPING_TX_SCHED | \ SOF_TIMESTAMPING_TX_ACK) +#define SOF_TIMESTAMPING_SOFTWARE_MASK (SOF_TIMESTAMPING_RX_SOFTWARE | \ + SOF_TIMESTAMPING_TX_SOFTWARE | \ + SOF_TIMESTAMPING_SOFTWARE) + +#define SOF_TIMESTAMPING_HARDWARE_MASK (SOF_TIMESTAMPING_RX_HARDWARE | \ + SOF_TIMESTAMPING_TX_HARDWARE | \ + SOF_TIMESTAMPING_RAW_HARDWARE) + /** * struct so_timestamping - SO_TIMESTAMPING parameter *