Skip to content

Commit

Permalink
net: macb: Add separate definition for PPM fraction
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harini Katakam authored and David S. Miller committed Jun 29, 2019
1 parent 79293f4 commit a8ee4dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/cadence/macb_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a8ee4dc

Please sign in to comment.