From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Mina Almasry <almasrymina@google.com>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, YiFei Zhu <zhuyifei@google.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH net-next v1] idpf: export RX hardware timestamping information to XDP
Date: Wed, 17 Dec 2025 15:35:52 +0100 [thread overview]
Message-ID: <e4946f5e-49a8-4e52-832b-b2e62d7d2e0d@intel.com> (raw)
In-Reply-To: <c2580ef0-3e44-468d-8675-203de5c82ac9@intel.com>
From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Wed, 17 Dec 2025 15:33:40 +0100
> From: Mina Almasry <almasrymina@google.com>
> Date: Sat, 22 Nov 2025 14:08:36 +0000
>
>> From: YiFei Zhu <zhuyifei@google.com>
>>
>> The logic is similar to idpf_rx_hwtstamp, but the data is exported
>> as a BPF kfunc instead of appended to an skb.
>>
>> A idpf_queue_has(PTP, rxq) condition is added to check the queue
>> supports PTP similar to idpf_rx_process_skb_fields.
>>
>> Cc: intel-wired-lan@lists.osuosl.org
>>
>> Signed-off-by: YiFei Zhu <zhuyifei@google.com>
>> Signed-off-by: Mina Almasry <almasrymina@google.com>
>> ---
>> drivers/net/ethernet/intel/idpf/xdp.c | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/idpf/xdp.c b/drivers/net/ethernet/intel/idpf/xdp.c
>> index 21ce25b0567f..850389ca66b6 100644
>> --- a/drivers/net/ethernet/intel/idpf/xdp.c
>> +++ b/drivers/net/ethernet/intel/idpf/xdp.c
>> @@ -2,6 +2,7 @@
>> /* Copyright (C) 2025 Intel Corporation */
>>
>> #include "idpf.h"
>> +#include "idpf_ptp.h"
>> #include "idpf_virtchnl.h"
>> #include "xdp.h"
>> #include "xsk.h"
>> @@ -369,6 +370,31 @@ int idpf_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
>> idpf_xdp_tx_finalize);
>> }
>>
>> +static int idpf_xdpmo_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp)
Also please put this function *after* rx_hash() to...
>> +{
>> + const struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc;
>
> Sorry I know it's a late comment...
>
> Could you please you the optimized descriptor structure from idpf/xdp.h
> instead of the regular one? To be consistent with the Rx hash timestamp
> function and give more room for optimization.
>
>> + const struct libeth_xdp_buff *xdp = (typeof(xdp))ctx;
>> + const struct idpf_rx_queue *rxq;
>> + u64 cached_time, ts_ns;
>> + u32 ts_high;
>> +
>> + rx_desc = xdp->desc;
>> + rxq = libeth_xdp_buff_to_rq(xdp, typeof(*rxq), xdp_rxq);
>> +
>> + if (!idpf_queue_has(PTP, rxq))
>> + return -ENODATA;
>> + if (!(rx_desc->ts_low & VIRTCHNL2_RX_FLEX_TSTAMP_VALID))
>> + return -ENODATA;
>> +
>> + 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);
>> +
>> + *timestamp = ts_ns;
>> + return 0;
>> +}
>> +
>> static int idpf_xdpmo_rx_hash(const struct xdp_md *ctx, u32 *hash,
>> enum xdp_rss_hash_type *rss_type)
>> {
>> @@ -392,6 +418,7 @@ static int idpf_xdpmo_rx_hash(const struct xdp_md *ctx, u32 *hash,
>> }
>>
>> static const struct xdp_metadata_ops idpf_xdpmo = {
>> + .xmo_rx_timestamp = idpf_xdpmo_rx_timestamp,
>> .xmo_rx_hash = idpf_xdpmo_rx_hash,
...keep the alphabetic sorting here.
>> };
>>
>>
>> base-commit: e05021a829b834fecbd42b173e55382416571b2c
Thanks,
Olek
prev parent reply other threads:[~2025-12-17 14:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 14:08 [PATCH net-next v1] idpf: export RX hardware timestamping information to XDP Mina Almasry
2025-11-24 8:33 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-11-24 10:51 ` YiFei Zhu
2025-11-24 11:37 ` Loktionov, Aleksandr
2025-12-01 1:27 ` Mina Almasry
2025-12-01 7:29 ` Loktionov, Aleksandr
2025-12-17 14:33 ` Alexander Lobakin
2025-12-17 14:35 ` Alexander Lobakin [this message]
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=e4946f5e-49a8-4e52-832b-b2e62d7d2e0d@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=sdf@fomichev.me \
--cc=zhuyifei@google.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