[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210525123711.GB27498@hoboy.vegasvil.org>
Date: Tue, 25 May 2021 05:37:11 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Yangbo Lu <yangbo.lu@....com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Claudiu Manoil <claudiu.manoil@....com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next, v2, 7/7] enetc: support PTP domain timestamp
conversion
On Fri, May 21, 2021 at 12:36:19PM +0800, Yangbo Lu wrote:
> @@ -472,13 +473,36 @@ static void enetc_get_tx_tstamp(struct enetc_hw *hw, union enetc_tx_bd *txbd,
> *tstamp = (u64)hi << 32 | tstamp_lo;
> }
>
> -static void enetc_tstamp_tx(struct sk_buff *skb, u64 tstamp)
> +static int enetc_ptp_parse_domain(struct sk_buff *skb, u8 *domain)
> +{
> + unsigned int ptp_class;
> + struct ptp_header *hdr;
> +
> + ptp_class = ptp_classify_raw(skb);
> + if (ptp_class == PTP_CLASS_NONE)
> + return -EINVAL;
> +
> + hdr = ptp_parse_header(skb, ptp_class);
> + if (!hdr)
> + return -EINVAL;
> +
> + *domain = hdr->domain_number;
This is really clunky. We do NOT want to have drivers starting to
handle the PTP. That is the job of the user space stack.
Instead, the conversion from raw time stamp to vclock time stamp
should happen in the core infrastructure. That way, no driver hacks
will be needed, and it will "just work" everywhere.
We need a way to associate a given socket with a particular vclock.
Perhaps we can extend the SO_TIMESTAMPING API to allow that.
> + return 0;
> +}
Thanks,
Richard
Powered by blists - more mailing lists