netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: yangbo.lu@nxp.com, David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	mlichvar@redhat.com,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v1 5/6] ptp: Support late timestamp determination
Date: Fri, 25 Mar 2022 21:51:45 +0100	[thread overview]
Message-ID: <CANr-f5yY1WvzbHjG_mmHAemLSMQj2Jm5Qg3tXQUvUo4oeQQHbA@mail.gmail.com> (raw)
In-Reply-To: <20220325000826.GB18007@hoboy.vegasvil.org>

> > > > > diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> > > > > index 54b9f54ac0b2..b7a8cf27c349 100644
> > > > > --- a/drivers/ptp/ptp_clock.c
> > > > > +++ b/drivers/ptp/ptp_clock.c
> > > > > @@ -450,6 +450,33 @@ void ptp_cancel_worker_sync(struct ptp_clock *ptp)
> > > > >  }
> > > > >  EXPORT_SYMBOL(ptp_cancel_worker_sync);
> > > > >
> > > > > +ktime_t ptp_get_timestamp(int index,
> > > > > +                       const struct skb_shared_hwtstamps *hwtstamps,
> > > > > +                       bool cycles)
> > > > > +{
> > > > > +     char name[PTP_CLOCK_NAME_LEN] = "";
> > > > > +     struct ptp_clock *ptp;
> > > > > +     struct device *dev;
> > > > > +     ktime_t ts;
> > > > > +
> > > > > +     snprintf(name, PTP_CLOCK_NAME_LEN, "ptp%d", index);
> > > > > +     dev = class_find_device_by_name(ptp_class, name);
> > > >
> > > > This seems expensive for every single Rx frame in a busy PTP network.
> > > > Can't this be cached in the socket?
> > > I thought that PTP packages are rare and that bloating the socket is
> > > not welcome.
> >
> > Some PTP profiles use insanely high frame rates.  like G.8275.1 with
> > Sync and Delay Req at 16/sec each.  times the number of clients.
>
> times the number of vclocks/Domains.

Getting the physical clock in __sock_recv_timestamp() is the expensive path.
The network device is already available __sock_recv_timestamp(). Timestamp
determination based on address/cookie could be done by the network device
instead of the physical clock. In my opinion, that would be a good fit, because
timestamp generation is already a task of the network device and implementation
would be faster/simpler. What do you think?

Gerhard

  reply	other threads:[~2022-03-25 20:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 21:07 [PATCH net-next v1 0/6] ptp: Support hardware clocks with additional free running time Gerhard Engleder
2022-03-22 21:07 ` [PATCH net-next v1 1/6] ptp: Add cycles support for virtual clocks Gerhard Engleder
2022-03-24 13:43   ` Richard Cochran
2022-03-24 19:39     ` Gerhard Engleder
2022-03-22 21:07 ` [PATCH net-next v1 2/6] ptp: Request cycles for TX timestamp Gerhard Engleder
2022-03-24 13:49   ` Richard Cochran
2022-03-24 13:55     ` Miroslav Lichvar
2022-03-24 19:43     ` Gerhard Engleder
2022-03-22 21:07 ` [PATCH net-next v1 3/6] ptp: Pass hwtstamp to ptp_convert_timestamp() Gerhard Engleder
2022-03-24 13:50   ` Richard Cochran
2022-03-22 21:07 ` [PATCH net-next v1 4/6] ethtool: Add kernel API for PHC index Gerhard Engleder
2022-03-24 13:51   ` Richard Cochran
2022-03-22 21:07 ` [PATCH net-next v1 5/6] ptp: Support late timestamp determination Gerhard Engleder
2022-03-23  0:54   ` kernel test robot
2022-03-23  1:05   ` kernel test robot
2022-03-23  2:06   ` kernel test robot
2022-03-24 14:01   ` Richard Cochran
2022-03-24 19:52     ` Gerhard Engleder
2022-03-25  0:04       ` Richard Cochran
2022-03-25  0:08         ` Richard Cochran
2022-03-25 20:51           ` Gerhard Engleder [this message]
2022-03-26  0:27   ` Vinicius Costa Gomes
2022-03-22 21:07 ` [PATCH net-next v1 6/6] tsnep: Add physical clock cycles support Gerhard Engleder
2022-03-25  0:01 ` [PATCH net-next v1 0/6] ptp: Support hardware clocks with additional free running time Vinicius Costa Gomes
2022-03-25 22:01   ` Gerhard Engleder

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=CANr-f5yY1WvzbHjG_mmHAemLSMQj2Jm5Qg3tXQUvUo4oeQQHbA@mail.gmail.com \
    --to=gerhard@engleder-embedded.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=vinicius.gomes@intel.com \
    --cc=yangbo.lu@nxp.com \
    /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).