gianfar: fix endianness for hardware timestamp
authorYangbo Lu <yangbo.lu@nxp.com>
Wed, 24 Feb 2016 09:26:56 +0000 (17:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Feb 2016 21:22:02 +0000 (16:22 -0500)
Fix endianness for the 64-bit hardware timestamp value with
be64_to_cpu to support both PowerPC platforms and ARM platforms.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/gianfar.c

index 1e1157fa77f41cc7a1afe6a59eebf1731d13f59c..a01e5a32b631299e9249dd5c914c092bd36f5842 100644 (file)
@@ -2706,7 +2706,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
                                          ~0x7UL);
 
                        memset(&shhwtstamps, 0, sizeof(shhwtstamps));
-                       shhwtstamps.hwtstamp = ns_to_ktime(*ns);
+                       shhwtstamps.hwtstamp = ns_to_ktime(be64_to_cpu(*ns));
                        skb_pull(skb, GMAC_FCB_LEN + GMAC_TXPAL_LEN);
                        skb_tstamp_tx(skb, &shhwtstamps);
                        gfar_clear_txbd_status(bdp);
@@ -3035,7 +3035,7 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb)
                u64 *ns = (u64 *) skb->data;
 
                memset(shhwtstamps, 0, sizeof(*shhwtstamps));
-               shhwtstamps->hwtstamp = ns_to_ktime(*ns);
+               shhwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*ns));
        }
 
        if (priv->padding)