Skip to content

Commit 6edd110

Browse files
jacob-kellerdavem330
authored andcommitted
igb: reject unsupported external timestamp flags
Fix the igb 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. This HW always time stamps both edges: flags Meaning ---------------------------------------------------- -------------------------- PTP_ENABLE_FEATURE Time stamp both edges PTP_ENABLE_FEATURE|PTP_RISING_EDGE Time stamp both edges PTP_ENABLE_FEATURE|PTP_FALLING_EDGE Time stamp both edges PTP_ENABLE_FEATURE|PTP_RISING_EDGE|PTP_FALLING_EDGE Time stamp both edges Signed-off-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e8e9c98 commit 6edd110

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/intel/igb/igb_ptp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp,
521521

522522
switch (rq->type) {
523523
case PTP_CLK_REQ_EXTTS:
524+
/* Reject requests with unsupported flags */
525+
if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
526+
PTP_RISING_EDGE |
527+
PTP_FALLING_EDGE))
528+
return -EOPNOTSUPP;
529+
524530
if (on) {
525531
pin = ptp_find_pin(igb->ptp_clock, PTP_PF_EXTTS,
526532
rq->extts.index);

0 commit comments

Comments
 (0)