From nobody Fri Jan 2 20:34:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 381B7E95A9E for ; Mon, 9 Oct 2023 15:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377852AbjJIPxH (ORCPT ); Mon, 9 Oct 2023 11:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377841AbjJIPwm (ORCPT ); Mon, 9 Oct 2023 11:52:42 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39ABD195; Mon, 9 Oct 2023 08:52:32 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 63CAF1C0015; Mon, 9 Oct 2023 15:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696866750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wPtxSHc5kpsl/meOkJ1+JSY5q157KHdOe13rw3OA8+0=; b=S9mkSIlotahwxWU9oQA5FxOoPRbeOFzGDpQ38dPwB/Kk4+rqUW7rqapQjM2qXwIYTW4BOO FQszwaQs0qNkOYVscGZqPrf3NUgInpbJZiNNvj+8OykOuSSezkjuBp2Owri6C0bj3iMqO+ AWE194HSvw/YVU6A3Qu8D3Ll1dUiBUC1tZipz0/KVwjyJtGPZobnMXhikePrqH81wlJ9gj hPz8AruBd2izW/0D7IzEB3PfnAx8mKI9sczK84voEqoEv8uMiaxCeULSxFEFCehJhE9ZIs AGxYJF2c7zVn4mLzjrI1p59MHMwpTclEhgqbazwja9/jv7xbt6CT8czXUQb1IA== From: =?UTF-8?q?K=C3=B6ry=20Maincent?= To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Thomas Petazzoni , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Jay Vosburgh , Andy Gospodarek , Nicolas Ferre , Claudiu Beznea , Horatiu Vultur , UNGLinuxDriver@microchip.com, Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , Richard Cochran , Radu Pirea , Willem de Bruijn , Vladimir Oltean , Michael Walle , Jacob Keller , Maxime Chevallier , Kory Maincent Subject: [PATCH net-next v5 12/16] net: Replace hwtstamp_source by timestamping layer Date: Mon, 9 Oct 2023 17:51:34 +0200 Message-Id: <20231009155138.86458-13-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231009155138.86458-1-kory.maincent@bootlin.com> References: <20231009155138.86458-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kory Maincent Replace hwtstamp_source which is only used by the kernel_hwtstamp_config structure by the more widely use timestamp_layer structure. This is done to prepare the support of selectable timestamping source. Signed-off-by: Kory Maincent --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++--- include/linux/net_tstamp.h | 11 +++-------- net/core/dev_ioctl.c | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/driver= s/net/ethernet/microchip/lan966x/lan966x_main.c index 8e4101628fbd..83c1177469e2 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -470,15 +470,15 @@ static int lan966x_port_hwtstamp_set(struct net_devic= e *dev, struct lan966x_port *port =3D netdev_priv(dev); int err; =20 - if (cfg->source !=3D HWTSTAMP_SOURCE_NETDEV && - cfg->source !=3D HWTSTAMP_SOURCE_PHYLIB) + if (cfg->source !=3D NETDEV_TIMESTAMPING && + cfg->source !=3D PHYLIB_TIMESTAMPING) return -EOPNOTSUPP; =20 err =3D lan966x_ptp_setup_traps(port, cfg); if (err) return err; =20 - if (cfg->source =3D=3D HWTSTAMP_SOURCE_NETDEV) { + if (cfg->source =3D=3D NETDEV_TIMESTAMPING) { if (!port->lan966x->ptp) return -EOPNOTSUPP; =20 diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h index eb01c37e71e0..2c1af19d5421 100644 --- a/include/linux/net_tstamp.h +++ b/include/linux/net_tstamp.h @@ -5,11 +5,6 @@ =20 #include =20 -enum hwtstamp_source { - HWTSTAMP_SOURCE_NETDEV, - HWTSTAMP_SOURCE_PHYLIB, -}; - /** * struct kernel_hwtstamp_config - Kernel copy of struct hwtstamp_config * @@ -20,8 +15,8 @@ enum hwtstamp_source { * a legacy implementation of a lower driver * @copied_to_user: request was passed to a legacy implementation which al= ready * copied the ioctl request back to user space - * @source: indication whether timestamps should come from the netdev or f= rom - * an attached phylib PHY + * @source: indication whether timestamps should come from software, the n= etdev + * or from an attached phylib PHY * * Prefer using this structure for in-kernel processing of hardware * timestamping configuration, over the inextensible struct hwtstamp_config @@ -33,7 +28,7 @@ struct kernel_hwtstamp_config { int rx_filter; struct ifreq *ifr; bool copied_to_user; - enum hwtstamp_source source; + u32 source; }; =20 static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config= *kernel_cfg, diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 342a667858ac..45cc1ea9b195 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -332,7 +332,7 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, bool changed =3D false; int err; =20 - cfg->source =3D phy_ts ? HWTSTAMP_SOURCE_PHYLIB : HWTSTAMP_SOURCE_NETDEV; + cfg->source =3D phy_ts ? PHYLIB_TIMESTAMPING : NETDEV_TIMESTAMPING; =20 if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) { err =3D ops->ndo_hwtstamp_get(dev, &old_cfg); --=20 2.25.1