From: Richard Cochran <richardcochran@gmail.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: netdev@vger.kernel.org,
Intel Wired LAN <intel-wired-lan@lists.osuosl.org>,
Jeffrey Kirsher <jeffrey.t.kirsher@intel.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
"David S . Miller" <davem@davemloft.net>,
Christopher Hall <christopher.s.hall@intel.com>
Subject: Re: [net-next v2 2/2] net: reject ptp requests with unsupported flags
Date: Wed, 25 Sep 2019 21:02:23 -0700 [thread overview]
Message-ID: <20190926040222.GB21883@localhost> (raw)
In-Reply-To: <20190926022820.7900-3-jacob.e.keller@intel.com>
On Wed, Sep 25, 2019 at 07:28:20PM -0700, Jacob Keller wrote:
> This patch may not be correct for individual drivers, especially
> regarding the rising vs falling edge flags. I interpreted the default
> behavior to be to timestamp the rising edge of a pin transition.
So I think this patch goes too far. It breaks the implied ABI.
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index fd3071f55bd3..2867a2581a36 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -521,6 +521,10 @@ static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp,
>
> switch (rq->type) {
> case PTP_CLK_REQ_EXTTS:
> + /* Reject requests with unsupported flags */
> + if (rq->extts.flags & ~(PTP_ENABLE_FEATURE | PTP_RISING_EDGE))
> + return -EOPNOTSUPP;
This HW always time stamps both edges, and that is not configurable.
Here you reject PTP_FALLING_EDGE, and that is clearly wrong. If the
driver had been really picky (my fault I guess), it should have always
insisted on (PTP_RISING_EDGE | PTP_FALLING_EDGE) being set together.
But it is too late to enforce that now, because it could break user
space programs.
I do agree with the sentiment of checking the flags at the driver
level, but this needs to be done case by case, with the drivers'
author's input.
(The req.perout.flags can be done unconditionally in all drivers,
since there were never any valid flags, but req.extts.flags needs
careful attention.)
Thanks,
Richard
next prev parent reply other threads:[~2019-09-26 4:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 2:28 [net-next v2 0/2] new PTP ioctl fixes Jacob Keller
2019-09-26 2:28 ` [net-next v2 1/2] ptp: correctly disable flags on old ioctls Jacob Keller
2019-09-26 3:43 ` Richard Cochran
2019-09-27 18:25 ` David Miller
2019-09-26 2:28 ` [net-next v2 2/2] net: reject ptp requests with unsupported flags Jacob Keller
2019-09-26 4:02 ` Richard Cochran [this message]
2019-09-26 17:41 ` Keller, Jacob E
2019-09-26 17:42 ` Keller, Jacob E
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190926040222.GB21883@localhost \
--to=richardcochran@gmail.com \
--cc=christopher.s.hall@intel.com \
--cc=davem@davemloft.net \
--cc=felipe.balbi@linux.intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).