Lines Matching refs:nsec

153 static u64 mlxsw_sp1_ptp_ns2cycles(const struct timecounter *tc, u64 nsec)  in mlxsw_sp1_ptp_ns2cycles()  argument
155 u64 cycles = (u64) nsec; in mlxsw_sp1_ptp_ns2cycles()
164 mlxsw_sp1_ptp_phc_settime(struct mlxsw_sp1_ptp_clock *clock, u64 nsec) in mlxsw_sp1_ptp_phc_settime() argument
172 next_sec = div_u64(nsec, NSEC_PER_SEC) + 1; in mlxsw_sp1_ptp_phc_settime()
209 u64 nsec; in mlxsw_sp1_ptp_adjtime() local
213 nsec = timecounter_read(&clock->tc); in mlxsw_sp1_ptp_adjtime()
216 return mlxsw_sp1_ptp_phc_settime(clock, nsec); in mlxsw_sp1_ptp_adjtime()
224 u64 cycles, nsec; in mlxsw_sp1_ptp_gettimex() local
228 nsec = timecounter_cyc2time(&clock->tc, cycles); in mlxsw_sp1_ptp_gettimex()
231 *ts = ns_to_timespec64(nsec); in mlxsw_sp1_ptp_gettimex()
240 u64 nsec = timespec64_to_ns(ts); in mlxsw_sp1_ptp_settime() local
243 timecounter_init(&clock->tc, &clock->cycles, nsec); in mlxsw_sp1_ptp_settime()
244 nsec = timecounter_read(&clock->tc); in mlxsw_sp1_ptp_settime()
247 return mlxsw_sp1_ptp_phc_settime(clock, nsec); in mlxsw_sp1_ptp_settime()
276 u64 overflow_cycles, nsec, frac = 0; in mlxsw_sp1_ptp_clock_init() local
305 nsec = cyclecounter_cyc2ns(&clock->cycles, overflow_cycles, 0, &frac); in mlxsw_sp1_ptp_clock_init()
306 clock->overflow_period = nsecs_to_jiffies(nsec); in mlxsw_sp1_ptp_clock_init()
360 mlxsw_sp2_ptp_phc_settime(struct mlxsw_sp_ptp_clock *clock, u64 nsec) in mlxsw_sp2_ptp_phc_settime() argument
366 sec = div_u64_rem(nsec, NSEC_PER_SEC, &nsec_rem); in mlxsw_sp2_ptp_phc_settime()
395 u64 nsec; in mlxsw_sp2_ptp_adjtime() local
397 nsec = mlxsw_sp2_ptp_read_utc(clock, NULL); in mlxsw_sp2_ptp_adjtime()
398 nsec += delta; in mlxsw_sp2_ptp_adjtime()
400 return mlxsw_sp2_ptp_phc_settime(clock, nsec); in mlxsw_sp2_ptp_adjtime()
415 u64 nsec; in mlxsw_sp2_ptp_gettimex() local
417 nsec = mlxsw_sp2_ptp_read_utc(clock, sts); in mlxsw_sp2_ptp_gettimex()
418 *ts = ns_to_timespec64(nsec); in mlxsw_sp2_ptp_gettimex()
428 u64 nsec = timespec64_to_ns(ts); in mlxsw_sp2_ptp_settime() local
430 return mlxsw_sp2_ptp_phc_settime(clock, nsec); in mlxsw_sp2_ptp_settime()
621 u64 nsec; in mlxsw_sp1_packet_timestamp() local
624 nsec = timecounter_cyc2time(&clock->tc, timestamp); in mlxsw_sp1_packet_timestamp()
627 hwtstamps.hwtstamp = ns_to_ktime(nsec); in mlxsw_sp1_packet_timestamp()
1408 u64 ts_sec, ts_nsec, nsec; in mlxsw_sp2_ptp_hwtstamp_fill() local
1410 WARN_ON_ONCE(!cb->cqe_ts.sec && !cb->cqe_ts.nsec); in mlxsw_sp2_ptp_hwtstamp_fill()
1420 ts_nsec = cb->cqe_ts.nsec; in mlxsw_sp2_ptp_hwtstamp_fill()
1422 nsec = ts_sec * NSEC_PER_SEC + ts_nsec; in mlxsw_sp2_ptp_hwtstamp_fill()
1424 hwtstamps->hwtstamp = ns_to_ktime(nsec); in mlxsw_sp2_ptp_hwtstamp_fill()