Skip to contentSkip to conversation

mv88e6xxx: reject unsupported external timestamp flags

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

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

PATCH 3/13 mv88e6xxx: reject unsupported external timestamp flags

From: Jacob Keller <[email protected]>

Fix the mv88e6xxx 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.

For the record, the semantics of this driver are:

  flags                                                 Meaning
  ----------------------------------------------------  --------------------------
  PTP_ENABLE_FEATURE                                    Time stamp falling 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 rising edge
---
 drivers/net/dsa/mv88e6xxx/ptp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/dsa/mv88e6xxx/ptp.c +6 -0
index 073cbd0bb91b..076e622a64d6 100644
@@ -273,6 +273,12 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
 	int pin;
 	int err;
 
+	/* Reject requests with unsupported flags */
+	if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
+				PTP_RISING_EDGE |
+				PTP_FALLING_EDGE))
+		return -EOPNOTSUPP;
+
 	pin = ptp_find_pin(chip->ptp_clock, PTP_PF_EXTTS, rq->extts.index);
 
 	if (pin < 0)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 25 lines

-----Original Message-----
From: Richard Cochran <[email protected]>
Sent: Thursday, November 14, 2019 10:45 AM
To: netdev at vger.kernel.org
Cc: intel-wired-lan at lists.osuosl.org; David Miller <[email protected]>; Brandon Streiff <[email protected]>; Hall, Christopher S <[email protected]>; Eugenia Emantayev <[email protected]>; Felipe Balbi <[email protected]>; Feras Daoud <[email protected]>; Keller, Jacob E <[email protected]>; Kirsher, Jeffrey T <[email protected]>; Sergei Shtylyov <[email protected]>; Stefan Sorensen <[email protected]>
Subject: [PATCH net 03/13] mv88e6xxx: reject unsupported external timestamp flags

From: Jacob Keller <[email protected]>

Fix the mv88e6xxx 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.

Quoted 5 lines

For the record, the semantics of this driver are:

  flags                                                 Meaning
  ----------------------------------------------------  --------------------------
  PTP_ENABLE_FEATURE                                    Time stamp falling edge

For the new version of the ioctl this isn't possible, but we still support the v1 ioctl which would still have this mode. Ok.

Quoted 5 lines
  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

rising edge

Thanks,
Jake