netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Yangbo Lu <yangbo.lu@nxp.com>
Cc: netdev@vger.kernel.org, Claudiu Manoil <claudiu.manoil@freescale.com>
Subject: Re: [PATCH 3/3] gianfar: fix endianness for hardware timestamp
Date: Mon, 22 Feb 2016 09:48:03 +0100	[thread overview]
Message-ID: <20160222084801.GC2138@netboy> (raw)
In-Reply-To: <1456123773-1016-4-git-send-email-yangbo.lu@nxp.com>

On Mon, Feb 22, 2016 at 02:49:33PM +0800, Yangbo Lu wrote:
> @@ -2708,6 +2708,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
>  			struct skb_shared_hwtstamps shhwtstamps;
>  			u64 *ns = (u64 *)(((uintptr_t)skb->data + 0x10) &
>  					  ~0x7UL);
> +			*ns = be64_to_cpu(*ns);
>  
>  			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
>  			shhwtstamps.hwtstamp = ns_to_ktime(*ns);

There is no point in modifying the buffer data in place.

Instead, do this:

			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
			shhwtstamps.hwtstamp = ns_to_ktime(be64_to_cpu(*ns));

or this:

			u64 ns, *ptr = (u64 *)(((uintptr_t)skb->data + 0x10) &
					       ~0x7UL);
			ns = be64_to_cpu(*ptr);

			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
			shhwtstamps.hwtstamp = ns_to_ktime(ns);

> @@ -3037,6 +3038,7 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb)
>  	if (priv->hwts_rx_en) {
>  		struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
>  		u64 *ns = (u64 *) skb->data;
> +		*ns = be64_to_cpu(*ns);
>  
>  		memset(shhwtstamps, 0, sizeof(*shhwtstamps));
>  		shhwtstamps->hwtstamp = ns_to_ktime(*ns);

Same here.

Thanks,
Richard

  reply	other threads:[~2016-02-22  8:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  6:49 [PATCH 0/3] Patchset for gianfar ptp driver Yangbo Lu
2016-02-22  6:49 ` [PATCH 1/3] ARM: dts: ls1021a: add 1588 timer node Yangbo Lu
2016-02-22  8:49   ` Richard Cochran
2016-02-24  9:24     ` Yangbo Lu
2016-02-22  6:49 ` [PATCH 2/3] gianfar_ptp: fix endianness in get_of_u32() Yangbo Lu
2016-02-22  8:35   ` Richard Cochran
2016-02-24  9:23     ` Yangbo Lu
2016-02-22  8:50   ` Richard Cochran
2016-02-22  6:49 ` [PATCH 3/3] gianfar: fix endianness for hardware timestamp Yangbo Lu
2016-02-22  8:48   ` Richard Cochran [this message]
2016-02-24  9:24     ` Yangbo Lu
2016-02-24 10:14       ` YOSHIFUJI Hideaki
2016-02-22  8:51   ` Richard Cochran
2016-02-22  8:32 ` [PATCH 0/3] Patchset for gianfar ptp driver Richard Cochran
2016-02-24  9:21   ` Yangbo Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160222084801.GC2138@netboy \
    --to=richardcochran@gmail.com \
    --cc=claudiu.manoil@freescale.com \
    --cc=netdev@vger.kernel.org \
    --cc=yangbo.lu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).