Lines Matching refs:mdev

43 	struct mlx4_en_dev *mdev =  in mlx4_en_read_clock()  local
45 struct mlx4_dev *dev = mdev->dev; in mlx4_en_read_clock()
61 u64 mlx4_en_get_hwtstamp(struct mlx4_en_dev *mdev, u64 timestamp) in mlx4_en_get_hwtstamp() argument
67 seq = read_seqbegin(&mdev->clock_lock); in mlx4_en_get_hwtstamp()
68 nsec = timecounter_cyc2time(&mdev->clock, timestamp); in mlx4_en_get_hwtstamp()
69 } while (read_seqretry(&mdev->clock_lock, seq)); in mlx4_en_get_hwtstamp()
74 void mlx4_en_fill_hwtstamps(struct mlx4_en_dev *mdev, in mlx4_en_fill_hwtstamps() argument
79 hwts->hwtstamp = mlx4_en_get_hwtstamp(mdev, timestamp); in mlx4_en_fill_hwtstamps()
88 void mlx4_en_remove_timestamp(struct mlx4_en_dev *mdev) in mlx4_en_remove_timestamp() argument
90 if (mdev->ptp_clock) { in mlx4_en_remove_timestamp()
91 ptp_clock_unregister(mdev->ptp_clock); in mlx4_en_remove_timestamp()
92 mdev->ptp_clock = NULL; in mlx4_en_remove_timestamp()
93 mlx4_info(mdev, "removed PHC\n"); in mlx4_en_remove_timestamp()
104 void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev) in mlx4_en_ptp_overflow_check() argument
106 bool timeout = time_is_before_jiffies(mdev->last_overflow_check + in mlx4_en_ptp_overflow_check()
111 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_ptp_overflow_check()
112 timecounter_read(&mdev->clock); in mlx4_en_ptp_overflow_check()
113 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_ptp_overflow_check()
114 mdev->last_overflow_check = jiffies; in mlx4_en_ptp_overflow_check()
132 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_adjfine() local
135 mult = (u32)adjust_by_scaled_ppm(mdev->nominal_c_mult, scaled_ppm); in mlx4_en_phc_adjfine()
137 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_phc_adjfine()
138 timecounter_read(&mdev->clock); in mlx4_en_phc_adjfine()
139 mdev->cycles.mult = mult; in mlx4_en_phc_adjfine()
140 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_phc_adjfine()
154 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_adjtime() local
158 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_phc_adjtime()
159 timecounter_adjtime(&mdev->clock, delta); in mlx4_en_phc_adjtime()
160 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_phc_adjtime()
176 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_gettime() local
181 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_phc_gettime()
182 ns = timecounter_read(&mdev->clock); in mlx4_en_phc_gettime()
183 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_phc_gettime()
201 struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, in mlx4_en_phc_settime() local
207 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_phc_settime()
208 timecounter_init(&mdev->clock, &mdev->cycles, ns); in mlx4_en_phc_settime()
209 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_phc_settime()
261 void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) in mlx4_en_init_timestamp() argument
263 struct mlx4_dev *dev = mdev->dev; in mlx4_en_init_timestamp()
270 if (mdev->ptp_clock) in mlx4_en_init_timestamp()
273 seqlock_init(&mdev->clock_lock); in mlx4_en_init_timestamp()
275 memset(&mdev->cycles, 0, sizeof(mdev->cycles)); in mlx4_en_init_timestamp()
276 mdev->cycles.read = mlx4_en_read_clock; in mlx4_en_init_timestamp()
277 mdev->cycles.mask = CLOCKSOURCE_MASK(48); in mlx4_en_init_timestamp()
278 mdev->cycles.shift = freq_to_shift(dev->caps.hca_core_clock); in mlx4_en_init_timestamp()
279 mdev->cycles.mult = in mlx4_en_init_timestamp()
280 clocksource_khz2mult(1000 * dev->caps.hca_core_clock, mdev->cycles.shift); in mlx4_en_init_timestamp()
281 mdev->nominal_c_mult = mdev->cycles.mult; in mlx4_en_init_timestamp()
283 write_seqlock_irqsave(&mdev->clock_lock, flags); in mlx4_en_init_timestamp()
284 timecounter_init(&mdev->clock, &mdev->cycles, in mlx4_en_init_timestamp()
286 write_sequnlock_irqrestore(&mdev->clock_lock, flags); in mlx4_en_init_timestamp()
289 mdev->ptp_clock_info = mlx4_en_ptp_clock_info; in mlx4_en_init_timestamp()
290 snprintf(mdev->ptp_clock_info.name, 16, "mlx4 ptp"); in mlx4_en_init_timestamp()
292 mdev->ptp_clock = ptp_clock_register(&mdev->ptp_clock_info, in mlx4_en_init_timestamp()
293 &mdev->pdev->dev); in mlx4_en_init_timestamp()
294 if (IS_ERR(mdev->ptp_clock)) { in mlx4_en_init_timestamp()
295 mdev->ptp_clock = NULL; in mlx4_en_init_timestamp()
296 mlx4_err(mdev, "ptp_clock_register failed\n"); in mlx4_en_init_timestamp()
297 } else if (mdev->ptp_clock) { in mlx4_en_init_timestamp()
298 mlx4_info(mdev, "registered PHC clock\n"); in mlx4_en_init_timestamp()