Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1835794lqe; Tue, 9 Apr 2024 01:32:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUX1EYziHEmuMPcjeGOu51oY7fpdjKNPoGrBNvILGUSNc1FdW7CYhxG046KgsiZzWiL8pNSWDDMNbO5+GffusChLSGAcRtZt+tS2RKZRA== X-Google-Smtp-Source: AGHT+IGlnUAiEZ/wBp4wAFyNFLhSIflvpMx6dm7ePEjP5smxIRNUosh1F2hYVF1vSvTJhperbCTI X-Received: by 2002:a17:902:cf04:b0:1e4:7ca3:8a33 with SMTP id i4-20020a170902cf0400b001e47ca38a33mr2963824plg.17.1712651534875; Tue, 09 Apr 2024 01:32:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712651534; cv=pass; d=google.com; s=arc-20160816; b=W2QKoOmVQg38i41Nng0nwxW7VFpfmnOnu5ZYGSj54Ogb092U/e00LQJaPEcLdGy5OE Rw5gOmbSwQakSIXzZNfaZPDmWIKrBb23JpWmlf/nbaOd0sBVEg57uXJD7XKTJdEmfR7G LBRMR1JAmsENpYXmfyeiUXDdd2popZinX04IqIU0c7AK9+36LYRwomA1UFpxF2icueDA ZwaFKFu9Kry8hkeMpe/UkYNlf40roNPJOx6N+zUhYYpzz4qbnOYRu7GzFxFtxLKFPzfJ n8FNjxW1Kt1wkNXKRD4pdGKM9Bat4FzmPkFLcFDLJ6dOD0zWs/NwkavRTcxHLkDGDFAL NjYQ== 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=ES3Hzm2djU1rN6Hk2bzxHWrUY1Jv7REvk6nG0DNeQv4=; fh=vtlcgQ30nO0QjQR7y1Wfn7g9c11A+T6SWcSZ6WixcJI=; b=TWT7PZ5X4ChWmcchqgL/Cc8QXwz9YLU/KTNhAEP76ZhxiDCopTfrI0VHCfrYuM9gOp On6GCgowvSRF6IFE9uA+G6Bopg3cqv7e+AP7I2ZSvHc2/rPO5UvA72J0qM1c0QdMHmof Yko7AcV6649OFoMZ2B9IflA6BAEIsW0tBudljssR2H5KIz1ZuL/fuRpm5AtQ+RkuEOnS 8YIjzJfMXRcNA5H+MQQKMcLJONT/2ZR5qMAb+0OeDxZkalDFLG4xZLM+tVtun3aJRquL dmMNIYgq83BoSZBv87NMEcjiPPsrA8Roi10gSLeyJ4vOdrlV9SJIh6Y0lk5hNU7+Np1N cBWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KFYpal4V; 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-136469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l10-20020a170903120a00b001dedba3a6dbsi8474634plh.358.2024.04.09.01.32.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 01:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KFYpal4V; 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-136469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136469-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8679628199D for ; Tue, 9 Apr 2024 08:32:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2707612DDBA; Tue, 9 Apr 2024 08:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KFYpal4V" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 DDB4A12A14F; Tue, 9 Apr 2024 08:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712651241; cv=none; b=Y+yZOe89OkBcPPNeAG1Fh4IdzSl2x8l7f+2gDjBhcof8dDDfXkPqkpuIX96ID+HRLXGCOK9QwhQOFTmWqgP1Pn+iF3gP6Lm0kAslhtCvyHUwEQ8mlMdnsL9XS944L2b1JUya60Dp+TPWRqVzIcJE0eWtOR2MGRfLkTrGxv8Szzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712651241; c=relaxed/simple; bh=lLjexWaZDoedCAGOjG4VuX8BKtf924kbhZ+DSXlqNb8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=STtTGb6PC5OXRjiHypVbqUFUzLSgd+v1izh/Rp4GGqgtWSN18zikBkJudJQY22uDgx0aR0iH9oud4pC/hOslku+15W5dZ79660Rm7O4KhdHbckBQdD4Lw9MrLRg27j6vVTfnwFvCp74TxvPEZJCnQV9AghxncBzTs3jfiXjQtq8= 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=KFYpal4V; arc=none smtp.client-ip=217.70.183.199 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 0FCA7FF813; Tue, 9 Apr 2024 08:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712651237; 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=ES3Hzm2djU1rN6Hk2bzxHWrUY1Jv7REvk6nG0DNeQv4=; b=KFYpal4V+yKK6zpC+hdeADBFAmLJy0Sab1IUme+uekQXPsIam9IB8zmOQLGx0q93KdqC9U CeeblzWPDQ3Ngkr8R9CS3Iz33yGphBJswsSJX147KFJOO7FkBlCROkdoY14xgnFQdFuIgx ZUj3QteJmcs293pWbcDCRlQZ9Io6U+rFuhIKEVcy556wU6uGr34UAg3GLpcfhk/YVbY4ND +CvvCBsUCIwXlaj5ovZLX6O6xbZvMCoWG4PawFgp768cMeETDrkN3GFlN3DFv28gjN8FMR kQ9y5T1j+ewIPnRuRHDNX+Rt/pv3mEYFsfnI+RRnY5QUShuAu4pENOesqsCqqA== From: Kory Maincent Date: Tue, 09 Apr 2024 10:26:32 +0200 Subject: [PATCH net-next v10 10/13] 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: <20240409-feature_ptp_netnext-v10-10-0fa2ea5c89a9@bootlin.com> References: <20240409-feature_ptp_netnext-v10-0-0fa2ea5c89a9@bootlin.com> In-Reply-To: <20240409-feature_ptp_netnext-v10-0-0fa2ea5c89a9@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 d7ba447db17c..58bc54949956 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -402,17 +402,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_bpf_init(ns); @@ -426,8 +421,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); @@ -435,8 +440,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