Skip to content

Commit 2e0645a

Browse files
jacob-kellerdavem330
authored andcommitted
mlx5: reject unsupported external timestamp flags
Fix the mlx5 core PTP support to explicitly reject any future flags that get added to the external timestamp request ioctl. In order to maintain currently functioning code, this patch accepts all three current flags. This is because the PTP_RISING_EDGE and PTP_FALLING_EDGE flags have unclear semantics and each driver seems to have interpreted them slightly differently. [ RC: I'm not 100% sure what this driver does, but if I'm not wrong it follows the dp83640: flags Meaning ---------------------------------------------------- -------------------------- PTP_ENABLE_FEATURE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_FALLING_EDGE Time stamp falling edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE|PTP_FALLING_EDGE Time stamp falling edge ] Cc: Feras Daoud <[email protected]> Cc: Eugenia Emantayev <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Richard Cochran <[email protected]> Reviewed-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6edd110 commit 2e0645a

File tree

1 file changed

+6
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/lib

1 file changed

+6
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp,
236236
if (!MLX5_PPS_CAP(mdev))
237237
return -EOPNOTSUPP;
238238

239+
/* Reject requests with unsupported flags */
240+
if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
241+
PTP_RISING_EDGE |
242+
PTP_FALLING_EDGE))
243+
return -EOPNOTSUPP;
244+
239245
if (rq->extts.index >= clock->ptp_info.n_pins)
240246
return -EINVAL;
241247

0 commit comments

Comments
 (0)