Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp510656lqp; Wed, 12 Jun 2024 08:08:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXq+pRw9gd25j3faZfXKL3zxptgLF7Up2M8vY4fNvrTrvjyBltdwq2KQ7LEGkp6p/KhM01mwKHIB3luasbmmNTOOLzjxWLW0UD6Ker2Sw== X-Google-Smtp-Source: AGHT+IGfVI10hDGqUMSl8c01oWLTPo+/9fOQH/7ZIUy52kf3P/CZ1V8NCtg9fJiALPKBuzDSydPt X-Received: by 2002:a17:906:7fd1:b0:a6f:377f:5c0e with SMTP id a640c23a62f3a-a6f377f5c8emr379046766b.0.1718204937960; Wed, 12 Jun 2024 08:08:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718204937; cv=pass; d=google.com; s=arc-20160816; b=uHALQs/ewwztNj4fGyq7eTSh/YV0SJ6eYmYgRJeKgVEDqEs9pJJcjugKk66VDRRWdt M5nL5W5bgbDbUpXjh3LYFyNzWh6Y9cg6wQfaCC1CUwCilBEkNTiiroI8NICld4w8n3bO nHBUUgBFl2KksjZSxujcAhIq8AKg5Rlsjifm3mjWnG9d/Oor6zl9lfI5WNIXsEkBx6GO 7fi2IQdRkefjHAooT1NiGLAlCMF2wVVOIB9LPSG8y0ke2vY6SyYYGER6CdKfqra4FpWP Qzu6dz0R4lGVef9PDFxLBnR2vWkIxR6GmkGPstNsGNu7zIctRzPp0r3BmNOWPM8E5Xum Octw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=YXhuPfMb8JiYCutfiZUlVCVpb7e9NN3nMxofwfDJxZk=; fh=vtlcgQ30nO0QjQR7y1Wfn7g9c11A+T6SWcSZ6WixcJI=; b=tALxE1c22+uHKet7FS6hPRJRNIcFY9One4UDtPMIjLnRzg7VQFiIT+uzyVNtw3uDZ+ d73CBtBKXZB6Qq8Y2yUXltgNxs5NkK0pJ6x7EB1mTcZA6sd21sqjqBvAXoqcibpvZzrX Fqyo0HrvFUZXnqZhDkHHgXzml+VGgiYeWXULqXdYKQV8YBA5xEd0/SaNCqA1AX4kvFwd foh60F/ToNs6es9XUJ5a5chODOHDTYtlPG7qydx8/+uW7SSfwmnt6NvFk+rncqkw9JHG KTsEqWrGX3YhyvpfyOFU73SxPv9MHPZy6/4nyU7z49qJ6fPhnYpX+F3czyHkb7JU/S6A Af0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IXzgo1Uu; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-211748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6eff672f18si454173466b.220.2024.06.12.08.08.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 08:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IXzgo1Uu; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-211748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 41E8C1F23585 for ; Wed, 12 Jun 2024 15:08:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB6A31822D1; Wed, 12 Jun 2024 15:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="IXzgo1Uu" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FF2F181313; Wed, 12 Jun 2024 15:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718204710; cv=none; b=o3dUMFsRvWNnCLRdch71deb9GOs2+kGSLwm6HshGUnKoPNKwNhgBlQrRk86jkGjgw+MnFDrvVxe/8HoYTqfbQTMdb8xQps470zkspX6+1VWymPmtppa9lChzmjA8yfdwbwQsvKo+vQArEv+O0YLBBCS7rHG4G2qb25rERwbF82I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718204710; c=relaxed/simple; bh=7yhAM6xH9kCUFSvDoP+AEJuCocl7K81S23eYIiV8v30=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghxBq4SQhJWWZmGzZDps9Ac1WwaYQe6xTBV08ILPzLmyLIqsFsH7u8iwFaQZ8ugHuc0KmzzQ0z67MkLmS/571eOHjwruBsno23eQ4c2CVOhYYYE23OCwcDxOHlFGQQr6744EaUquSOwOjTobje5ja4yzU8267CGIWLEwgP227i4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=IXzgo1Uu; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C3D7D40012; Wed, 12 Jun 2024 15:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718204706; 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=YXhuPfMb8JiYCutfiZUlVCVpb7e9NN3nMxofwfDJxZk=; b=IXzgo1UuqK0KUZkl3kZPUHcR7OVraTlpqWhVRSnYRhnbzlpB6t2z/vVRs1k/r9V3K57DEI KKt9SNgk+oQQJZfYRWtxnWewdeRRVPuUtsRdHoxgYObfjsPGyVWM0Vn2ieFO4rRLwx2X1F BWf84w7Pw0pex6m2aX98YZhTpxEs6AvZLQTUTocHnS1HjSTbS73EC6zEdwGO8WzhwDguv4 s0thMGnMdfeXCrv110JhGMmgxxQIZfgsvlXQ/0VAGrg9w5JD8CG4tQOgz/BaR2/SdALygD d/U2fS0yQNvVAFE18VUTN2yLni48GaxUj27KRC1iHveVLdJFhoQLV26nkcDV5Q== From: Kory Maincent Date: Wed, 12 Jun 2024 17:04:10 +0200 Subject: [PATCH net-next v15 10/14] net: netdevsim: ptp_mock: Convert to netdev_ptp_clock_register Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240612-feature_ptp_netnext-v15-10-b2a086257b63@bootlin.com> References: <20240612-feature_ptp_netnext-v15-0-b2a086257b63@bootlin.com> In-Reply-To: <20240612-feature_ptp_netnext-v15-0-b2a086257b63@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 , Rahul Rameshbabu , Kory Maincent X-Mailer: b4 0.13.0 X-GND-Sasl: kory.maincent@bootlin.com The hardware registration clock for net device is now using netdev_ptp_clock_register to save the net_device pointer within the PTP clock xarray. netdevsim is registering its ptp through the mock driver. It is the only driver using the mock driver to register a ptp clock. Convert the mock driver to the new API. Reviewed-by: Rahul Rameshbabu Signed-off-by: Kory Maincent --- Changes in v8: - New patch --- drivers/net/netdevsim/netdev.c | 19 +++++++++++-------- drivers/ptp/ptp_mock.c | 4 ++-- include/linux/ptp_mock.h | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index c22897bf5509..51ba5e75740e 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -662,17 +662,12 @@ static int nsim_init_netdevsim(struct netdevsim *ns) struct mock_phc *phc; int err; - phc = mock_phc_create(&ns->nsim_bus_dev->dev); - if (IS_ERR(phc)) - return PTR_ERR(phc); - - ns->phc = phc; ns->netdev->netdev_ops = &nsim_netdev_ops; ns->netdev->stat_ops = &nsim_stat_ops; err = nsim_udp_tunnels_info_create(ns->nsim_dev, ns->netdev); if (err) - goto err_phc_destroy; + return err; rtnl_lock(); err = nsim_queue_init(ns); @@ -690,8 +685,18 @@ static int nsim_init_netdevsim(struct netdevsim *ns) if (err) goto err_ipsec_teardown; rtnl_unlock(); + + phc = mock_phc_create(ns->netdev); + if (IS_ERR(phc)) { + err = PTR_ERR(phc); + goto err_register_netdevice; + } + + ns->phc = phc; return 0; +err_register_netdevice: + unregister_netdevice(ns->netdev); err_ipsec_teardown: nsim_ipsec_teardown(ns); nsim_macsec_teardown(ns); @@ -701,8 +706,6 @@ static int nsim_init_netdevsim(struct netdevsim *ns) err_utn_destroy: rtnl_unlock(); nsim_udp_tunnels_info_destroy(ns->netdev); -err_phc_destroy: - mock_phc_destroy(ns->phc); return err; } diff --git a/drivers/ptp/ptp_mock.c b/drivers/ptp/ptp_mock.c index e7b459c846a2..1dcbe7426746 100644 --- a/drivers/ptp/ptp_mock.c +++ b/drivers/ptp/ptp_mock.c @@ -115,7 +115,7 @@ int mock_phc_index(struct mock_phc *phc) } EXPORT_SYMBOL_GPL(mock_phc_index); -struct mock_phc *mock_phc_create(struct device *dev) +struct mock_phc *mock_phc_create(struct net_device *dev) { struct mock_phc *phc; int err; @@ -147,7 +147,7 @@ struct mock_phc *mock_phc_create(struct device *dev) spin_lock_init(&phc->lock); timecounter_init(&phc->tc, &phc->cc, 0); - phc->clock = ptp_clock_register(&phc->info, dev); + phc->clock = netdev_ptp_clock_register(&phc->info, dev); if (IS_ERR(phc->clock)) { err = PTR_ERR(phc->clock); goto out_free_phc; diff --git a/include/linux/ptp_mock.h b/include/linux/ptp_mock.h index 72eb401034d9..e226011071f8 100644 --- a/include/linux/ptp_mock.h +++ b/include/linux/ptp_mock.h @@ -13,13 +13,13 @@ struct mock_phc; #if IS_ENABLED(CONFIG_PTP_1588_CLOCK_MOCK) -struct mock_phc *mock_phc_create(struct device *dev); +struct mock_phc *mock_phc_create(struct net_device *dev); void mock_phc_destroy(struct mock_phc *phc); int mock_phc_index(struct mock_phc *phc); #else -static inline struct mock_phc *mock_phc_create(struct device *dev) +static inline struct mock_phc *mock_phc_create(struct net_device *dev) { return NULL; } -- 2.34.1