From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Milena Olech <milena.olech@intel.com>, intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com,
Milena Olech <milena.olech@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>
Subject: Re: [PATCH iwl-net 09/10] idpf: add support for Rx timestamping
Date: Thu, 14 Nov 2024 15:53:38 -0500 [thread overview]
Message-ID: <67366352c2c5b_3379ce29475@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20241113154616.2493297-10-milena.olech@intel.com>
Milena Olech wrote:
> Add Rx timestamp function when the Rx timestamp value is read directly
> from the Rx descriptor. Add supported Rx timestamp modes.
>
> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Signed-off-by: Milena Olech <milena.olech@intel.com>
> ---
> drivers/net/ethernet/intel/idpf/idpf_ptp.c | 74 ++++++++++++++++++++-
> drivers/net/ethernet/intel/idpf/idpf_txrx.c | 30 +++++++++
> drivers/net/ethernet/intel/idpf/idpf_txrx.h | 7 +-
> 3 files changed, 109 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_ptp.c b/drivers/net/ethernet/intel/idpf/idpf_ptp.c
> index f34642d10768..f9f7613f2a6d 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_ptp.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_ptp.c
> @@ -317,12 +317,41 @@ static int idpf_ptp_gettimex64(struct ptp_clock_info *info,
> return 0;
> }
>
> +/**
> + * idpf_ptp_update_phctime_rxq_grp - Update the cached PHC time for a given Rx
> + * queue group.
Why does each receive group have a separate cached value?
They're all caches of the same device clock.
> + * @grp: receive queue group in which Rx timestamp is enabled
> + * @split: Indicates whether the queue model is split or single queue
> + * @systime: Cached system time
> + */
> +static void
> +idpf_ptp_update_phctime_rxq_grp(const struct idpf_rxq_group *grp, bool split,
> + u64 systime)
> +{
> + struct idpf_rx_queue *rxq;
> + u16 i;
> +
> + if (!split) {
> + for (i = 0; i < grp->singleq.num_rxq; i++) {
> + rxq = grp->singleq.rxqs[i];
> + if (rxq)
> + WRITE_ONCE(rxq->cached_phc_time, systime);
> + }
> + } else {
> + for (i = 0; i < grp->splitq.num_rxq_sets; i++) {
> + rxq = &grp->splitq.rxq_sets[i]->rxq;
> + if (rxq)
> + WRITE_ONCE(rxq->cached_phc_time, systime);
> + }
> + }
> +}
> +
> +/**
> + * idpf_ptp_set_rx_tstamp - Enable or disable Rx timestamping
> + * @vport: Virtual port structure
> + * @rx_filter: bool value for whether timestamps are enabled or disabled
> + */
> +static void idpf_ptp_set_rx_tstamp(struct idpf_vport *vport, int rx_filter)
> +{
> + vport->tstamp_config.rx_filter = rx_filter;
> +
> + if (rx_filter == HWTSTAMP_FILTER_NONE)
> + return;
Should this clear the bit if it was previously set, instead of returning immediately?
> +
> + for (u16 i = 0; i < vport->num_rxq_grp; i++) {
> + struct idpf_rxq_group *grp = &vport->rxq_grps[i];
> + u16 j;
> +
> + if (idpf_is_queue_model_split(vport->rxq_model)) {
> + for (j = 0; j < grp->singleq.num_rxq; j++)
> + idpf_queue_set(PTP, grp->singleq.rxqs[j]);
> + } else {
> + for (j = 0; j < grp->splitq.num_rxq_sets; j++)
> + idpf_queue_set(PTP,
> + &grp->splitq.rxq_sets[j]->rxq);
> + }
> + }
> +}
> +static void
> +idpf_rx_hwtstamp(const struct idpf_rx_queue *rxq,
> + const struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc,
> + struct sk_buff *skb)
> +{
> + u64 cached_time, ts_ns;
> + u32 ts_high;
> +
> + if (!(rx_desc->ts_low & VIRTCHNL2_RX_FLEX_TSTAMP_VALID))
> + return;
> +
> + cached_time = READ_ONCE(rxq->cached_phc_time);
> +
> + ts_high = le32_to_cpu(rx_desc->ts_high);
> + ts_ns = idpf_ptp_tstamp_extend_32b_to_64b(cached_time, ts_high);
> +
> + *skb_hwtstamps(skb) = (struct skb_shared_hwtstamps) {
> + .hwtstamp = ns_to_ktime(ts_ns),
> + };
Simpler: skb_hwtstamps(skb)->hwtstamp = ns_to_ktime(ts_ns);
next prev parent reply other threads:[~2024-11-14 20:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 15:46 [PATCH iwl-net 00/10] initial PTP support Milena Olech
2024-11-13 15:46 ` [PATCH iwl-net 01/10] idpf: " Milena Olech
2024-11-14 11:01 ` Vadim Fedorenko
2024-11-14 17:27 ` Willem de Bruijn
2024-11-15 12:38 ` Simon Horman
2024-11-15 13:43 ` [Intel-wired-lan] " Paul Menzel
2024-11-15 16:07 ` Olech, Milena
2024-11-13 15:46 ` [PATCH iwl-net 02/10] virtchnl: add PTP virtchnl definitions Milena Olech
2024-11-14 17:28 ` Willem de Bruijn
2024-11-18 12:57 ` [Intel-wired-lan] " Olech, Milena
2024-11-15 12:42 ` Simon Horman
2024-11-13 15:46 ` [PATCH iwl-net 03/10] idpf: move virtchnl structures to the header file Milena Olech
2024-11-14 20:02 ` Willem de Bruijn
2024-11-13 15:46 ` [PATCH iwl-net 04/10] idpf: negotiate PTP capabilies and get PTP clock Milena Olech
2024-11-14 12:17 ` Vadim Fedorenko
2024-11-14 20:57 ` Willem de Bruijn
2024-11-15 16:34 ` [Intel-wired-lan] " Olech, Milena
2024-11-14 20:20 ` Willem de Bruijn
2024-11-18 14:36 ` [Intel-wired-lan] " Olech, Milena
2024-11-18 15:21 ` Willem de Bruijn
2024-11-14 23:26 ` Willem de Bruijn
2024-11-15 12:51 ` Simon Horman
2024-11-13 15:46 ` [PATCH iwl-net 05/10] idpf: add mailbox access to read PTP clock time Milena Olech
2024-11-14 20:22 ` Willem de Bruijn
2024-11-13 15:46 ` [PATCH iwl-net 06/10] idpf: add PTP clock configuration Milena Olech
2024-11-14 20:27 ` Willem de Bruijn
2024-11-13 15:46 ` [PATCH iwl-net 07/10] idpf: add Tx timestamp capabilities negotiation Milena Olech
2024-11-14 20:49 ` Willem de Bruijn
2024-11-15 12:45 ` Simon Horman
2024-11-15 13:45 ` Simon Horman
2024-11-13 15:46 ` [PATCH iwl-net 08/10] idpf: add Tx timestamp flows Milena Olech
2024-11-14 12:52 ` Vadim Fedorenko
2024-11-18 15:07 ` Olech, Milena
2024-11-18 17:24 ` Vadim Fedorenko
2024-11-14 23:20 ` Willem de Bruijn
2024-11-18 15:18 ` [Intel-wired-lan] " Olech, Milena
2024-11-18 15:52 ` Willem de Bruijn
2024-11-13 15:46 ` [PATCH iwl-net 09/10] idpf: add support for Rx timestamping Milena Olech
2024-11-14 20:53 ` Willem de Bruijn [this message]
2024-11-18 15:31 ` Olech, Milena
2024-11-18 15:53 ` Willem de Bruijn
2024-11-13 15:46 ` [PATCH iwl-net 10/10] idpf: change the method for mailbox workqueue allocation Milena Olech
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=67366352c2c5b_3379ce29475@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=milena.olech@intel.com \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.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