Skip to content

Commit

Permalink
net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow
Browse files Browse the repository at this point in the history
[ Upstream commit 0d2ffdc ]

Before calling timecounter_cyc2time(), clock->lock must be taken.
Use mlx5_timecounter_cyc2time instead which guarantees a safe access.

Fixes: afc98a0 ("net/mlx5: Update ptp_clock_event foreach PPS event")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Eran Ben Elisha authored and gregkh committed Oct 29, 2020
1 parent 50185a1 commit e757a39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ static int mlx5_pps_event(struct notifier_block *nb,
switch (clock->ptp_info.pin_config[pin].func) {
case PTP_PF_EXTTS:
ptp_event.index = pin;
ptp_event.timestamp = timecounter_cyc2time(&clock->tc,
be64_to_cpu(eqe->data.pps.time_stamp));
ptp_event.timestamp =
mlx5_timecounter_cyc2time(clock,
be64_to_cpu(eqe->data.pps.time_stamp));
if (clock->pps_info.enabled) {
ptp_event.type = PTP_CLOCK_PPSUSR;
ptp_event.pps_times.ts_real =
Expand Down

0 comments on commit e757a39

Please sign in to comment.