net: macb: Add separate definition for PPM fraction
authorHarini Katakam <harini.katakam@xilinx.com>
Thu, 27 Jun 2019 06:20:59 +0000 (11:50 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Jun 2019 18:09:18 +0000 (11:09 -0700)
The scaled ppm parameter passed to _adjfine() contains a 16 bit
fraction. This just happens to be the same as SUBNSINCR_SIZE now.
Hence define this separately.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_ptp.c

index 6ff123da6a140042b69b21420ee3e753b7e210aa..b3b2a00b620dd8ecd59eb1b30ce3f535386cbb61 100644 (file)
@@ -834,6 +834,9 @@ struct gem_tx_ts {
 /* limit RX checksum offload to TCP and UDP packets */
 #define GEM_RX_CSUM_CHECKED_MASK               2
 
+/* Scaled PPM fraction */
+#define PPM_FRACTION   16
+
 /* struct macb_tx_skb - data about an skb which is being transmitted
  * @skb: skb currently being transmitted, only set for the last buffer
  *       of the frame
index 0a8aca8d3634b5322b7b53bf58b7f763674fdf44..6276eac8056b4150865cd72359305d1576dbf0dd 100644 (file)
@@ -135,7 +135,7 @@ static int gem_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
         * (temp / USEC_PER_SEC) + 0.5
         */
        adj += (USEC_PER_SEC >> 1);
-       adj >>= GEM_SUBNSINCR_SIZE; /* remove fractions */
+       adj >>= PPM_FRACTION; /* remove fractions */
        adj = div_u64(adj, USEC_PER_SEC);
        adj = neg_adj ? (word - adj) : (word + adj);