[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211104172843.GA32548@hoboy.vegasvil.org>
Date: Thu, 4 Nov 2021 10:28:43 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Martin Kaistra <martin.kaistra@...utronix.de>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
John Stultz <john.stultz@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>,
Russell King <linux@...linux.org.uk>,
Marc Kleine-Budde <mkl@...gutronix.de>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 4/7] net: dsa: b53: Add PHC clock support
On Thu, Nov 04, 2021 at 02:31:58PM +0100, Martin Kaistra wrote:
> +static void b53_ptp_overflow_check(struct work_struct *work)
> +{
> + struct delayed_work *dw = to_delayed_work(work);
> + struct b53_device *dev =
> + container_of(dw, struct b53_device, overflow_work);
> +
> + mutex_lock(&dev->ptp_mutex);
> + timecounter_read(&dev->tc);
> + mutex_unlock(&dev->ptp_mutex);
> +
> + schedule_delayed_work(&dev->overflow_work, B53_PTP_OVERFLOW_PERIOD);
> +}
> +
> +int b53_ptp_init(struct b53_device *dev)
> +{
> + mutex_init(&dev->ptp_mutex);
> +
> + INIT_DELAYED_WORK(&dev->overflow_work, b53_ptp_overflow_check);
...
> @@ -97,4 +101,14 @@ struct b53_device {
> bool vlan_enabled;
> unsigned int num_ports;
> struct b53_port *ports;
> +
> + /* PTP */
> + bool broadsync_hd;
> + struct ptp_clock *ptp_clock;
> + struct ptp_clock_info ptp_clock_info;
> + struct cyclecounter cc;
> + struct timecounter tc;
> + struct mutex ptp_mutex;
> +#define B53_PTP_OVERFLOW_PERIOD (HZ / 2)
> + struct delayed_work overflow_work;
Instead of generic work, consider implementing
ptp_clock_info::do_aux_work instead.
The advantage is that you get a named kernel thread that can be given
scheduling priority administratively.
Thanks,
Richard
Powered by blists - more mailing lists