Skip to contentSkip to conversation

mlx5: Reject requests to enable time stamping on both edges.

PATCH In review Richard Cochran 2 participants 2 messages Nov 14, 2019 – Nov 15, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 12/13 mlx5: Reject requests to enable time stamping on both edges.

This driver enables rising edge or falling edge, but not both, and so this patch validates that the request contains only one of the two edges.

---
 drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +6 -0
index 819097d9b583..43f97601b500 100644
@@ -243,6 +243,12 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp,
 				PTP_STRICT_FLAGS))
 		return -EOPNOTSUPP;
 
+	/* Reject requests to enable time stamping on both edges. */
+	if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
+	    (rq->extts.flags & PTP_ENABLE_FEATURE) &&
+	    (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
+		return -EOPNOTSUPP;
+
 	if (rq->extts.index >= clock->ptp_info.n_pins)
 		return -EINVAL;
 
Signature · 1 line
2.20.1
Reviewed-by on v1 12/13
#1 lore raw
Quoted 18 lines · Richard Cochran

This driver enables rising edge or falling edge, but not both, and so this patch validates that the request contains only one of the two edges.

---
 drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +0 -0
index 819097d9b583..43f97601b500 100644
@@ -243,6 +243,12 @@ static int mlx5_extts_configure(struct
 ptp_clock_info *ptp,
 				PTP_STRICT_FLAGS))

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c static int mlx5_extts_configure(struct · line 254

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +6 -0
 		return -EOPNOTSUPP;
 
+	/* Reject requests to enable time stamping on both edges. */
+	if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
+	    (rq->extts.flags & PTP_ENABLE_FEATURE) &&
+	    (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
+		return -EOPNOTSUPP;
+
 	if (rq->extts.index >= clock->ptp_info.n_pins)
 		return -EINVAL;