From nobody Fri Dec 19 19:16:39 2025 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 ABAE4C4332F for ; Tue, 14 Nov 2023 11:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233132AbjKNLah (ORCPT ); Tue, 14 Nov 2023 06:30:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbjKNL3f (ORCPT ); Tue, 14 Nov 2023 06:29:35 -0500 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 C2A0F1734; Tue, 14 Nov 2023 03:29:06 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4F98E60005; Tue, 14 Nov 2023 11:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1699961345; 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=vnq8HvrunTey94JHLjmUCZTuhtnpviKD1zBNTOQPuFc=; b=LIGzi6rC7Qnb9pW5nsJlojtWEfSdoiBlYy+LF19YPKgbZ/FZv5iIrsdUoLM+vUIzFxR8XU UbJuZBGgWa7e4hJvNaVqLvvLz7XoNMjp55GNhyV8xsGmoH7seapknaFbcBSxjOUnKVY7DM ICmZsoyf56Dho5D3LhqoeOeIfeBrXgT+C15aHi/rQFK+sCtWA+ijNpu1i2eFXFfHMgwpbc 1jvAOc/Nm42kdIS+ZNkbE91+6UcMjrkhvSM9rabW9CLuvLnxzdM6P0A97pINCdYjBlSETa LnpRMph2X9q+YvSkFuR/shXcRg6NR1XVy2G2BTMtiUnHNsg7/4g1dI02i/2uYg== From: Kory Maincent Date: Tue, 14 Nov 2023 12:28:40 +0100 Subject: [PATCH net-next v7 12/16] net: Replace hwtstamp_source by timestamping layer MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231114-feature_ptp_netnext-v7-12-472e77951e40@bootlin.com> References: <20231114-feature_ptp_netnext-v7-0-472e77951e40@bootlin.com> In-Reply-To: <20231114-feature_ptp_netnext-v7-0-472e77951e40@bootlin.com> To: Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , 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 , Vladimir Oltean Cc: Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maxime Chevallier , Kory Maincent X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Change in v6: - Follow timestamping layer naming update. Change in v7: - Fix a temporary build error of undeclared ts_layer enum value. --- 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 2635ef8958c8..fbe56b1bb386 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 MAC_TIMESTAMPING && + cfg->source !=3D PHY_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 MAC_TIMESTAMPING) { if (!port->lan966x->ptp) return -EOPNOTSUPP; =20 diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h index eb01c37e71e0..bb289c2ad376 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; + enum timestamping_layer 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 9a66cf5015f2..267cd00269d0 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 ? PHY_TIMESTAMPING : MAC_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