[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pn8zncqo.fsf@kurt>
Date: Mon, 13 Jul 2020 08:35:43 +0200
From: Kurt Kanzenbach <kurt@...utronix.de>
To: Richard Cochran <richardcochran@...il.com>
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 Sat Jul 11 2020, Richard Cochran wrote:
> 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!
Indeed. Never thought about it.
Thanks,
Kurt
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists