[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191114184507.18937-4-richardcochran@gmail.com>
Date: Thu, 14 Nov 2019 10:44:57 -0800
From: Richard Cochran <richardcochran@...il.com>
To: netdev@...r.kernel.org
Cc: intel-wired-lan@...ts.osuosl.org,
David Miller <davem@...emloft.net>,
Brandon Streiff <brandon.streiff@...com>,
Christopher Hall <christopher.s.hall@...el.com>,
Eugenia Emantayev <eugenia@...lanox.com>,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
Feras Daoud <ferasda@...lanox.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Jeffrey Kirsher <jeffrey.t.kirsher@...el.com>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
Stefan Sorensen <stefan.sorensen@...ctralink.com>
Subject: [PATCH net 03/13] mv88e6xxx: reject unsupported external timestamp flags
From: Jacob Keller <jacob.e.keller@...el.com>
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
Cc: Brandon Streiff <brandon.streiff@...com>
Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
Reviewed-by: Richard Cochran <richardcochran@...il.com>
---
drivers/net/dsa/mv88e6xxx/ptp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 073cbd0bb91b..076e622a64d6 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -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)
--
2.20.1
Powered by blists - more mailing lists