[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200711203810.GB27467@hoboy>
Date: Sat, 11 Jul 2020 13:38:10 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Kurt Kanzenbach <kurt@...utronix.de>
Cc: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Kamil Alkhouri <kamil.alkhouri@...offenburg.de>,
ilias.apalodimas@...aro.org, Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH v1 4/8] net: dsa: hellcreek: Add support for hardware
timestamping
On Fri, Jul 10, 2020 at 01:36:07PM +0200, Kurt Kanzenbach wrote:
> +static void hellcreek_get_rxts(struct hellcreek *hellcreek,
> + struct hellcreek_port_hwtstamp *ps,
> + struct sk_buff *skb, struct sk_buff_head *rxq,
> + int port)
> +{
> + struct skb_shared_hwtstamps *shwt;
> + struct sk_buff_head received;
> + unsigned long flags;
> +
> + /* The latched timestamp belongs to one of the received frames. */
> + __skb_queue_head_init(&received);
> +
> + /* Lock & disable interrupts */
> + spin_lock_irqsave(&rxq->lock, flags);
> +
> + /* Add the reception queue "rxq" to the "received" queue an reintialize
> + * "rxq". From now on, we deal with "received" not with "rxq"
> + */
> + skb_queue_splice_tail_init(rxq, &received);
> +
> + spin_unlock_irqrestore(&rxq->lock, flags);
> +
> + for (; skb; skb = __skb_dequeue(&received)) {
> + unsigned int type;
> + u8 *hdr;
> + u64 ns;
> +
> + /* Get nanoseconds from ptp packet */
> + type = SKB_PTP_TYPE(skb);
> + hdr = parse_ptp_header(skb, type);
> + ns = hellcreek_get_reserved_field(hdr);
You might consider clearing the reserved field at this point. Some
user space SW might consider non-zero reserved fields as corrupt!
(The LinuxPTP stack doesn't do this, but still maybe others are more
pedantic.)
Acked-by: Richard Cochran <richardcochran@...il.com>
Powered by blists - more mailing lists