From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: "Steffen Trumtrar" <s.trumtrar@pengutronix.de>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Richard Cochran" <richardcochran@gmail.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"Eugenio Pérez" <eperezma@redhat.com>
Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: Re: [PATCH RFC v2 1/2] tun: support rx-tstamp
Date: Sun, 01 Feb 2026 16:00:49 -0500 [thread overview]
Message-ID: <willemdebruijn.kernel.391644a186dc6@gmail.com> (raw)
In-Reply-To: <20260129-v6-7-topic-virtio-net-ptp-v2-1-30a27dc52760@pengutronix.de>
Steffen Trumtrar wrote:
> Demonstrate support for new virtio-net features
>
> VIRTIO_NET_HDR_F_TSTAMP
>
> This is not intended to be merged.
>
> A full feature test also requires a patched qemu binary that knows
> these features and negotiates correct vnet_hdr_sz in
> virtio_net_set_mrg_rx_bufs. See
> https://github.com/strumtrar/qemu/tree/v10.2.0/virtio-rx-stamps
>
> Not-yet-signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> drivers/net/tun.c | 30 ++++++++++++++++++------------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 8192740357a09..aa988a9c4bc99 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2065,23 +2065,29 @@ static ssize_t tun_put_user(struct tun_struct *tun,
> }
>
> if (vnet_hdr_sz) {
> - struct virtio_net_hdr_v1_hash_tunnel hdr;
> - struct virtio_net_hdr *gso;
> + struct virtio_net_hdr_v1_hash_tunnel_ts hdr;
This patch refers to a struct that does not exist yet, so this cannot
compile?
> +
> + memset(&hdr, 0, sizeof(hdr));
>
> ret = tun_vnet_hdr_tnl_from_skb(tun->flags, tun->dev, skb,
> - &hdr);
> + (struct virtio_net_hdr_v1_hash_tunnel *)&hdr);
> if (ret)
> return ret;
>
> - /*
> - * Drop the packet if the configured header size is too small
> - * WRT the enabled offloads.
> - */
> - gso = (struct virtio_net_hdr *)&hdr;
> - ret = __tun_vnet_hdr_put(vnet_hdr_sz, tun->dev->features,
> - iter, gso);
> - if (ret)
> - return ret;
> + if (vnet_hdr_sz >= sizeof(struct virtio_net_hdr_v1_hash_tunnel_ts)) {
> + __le64 tstamp = cpu_to_le64(ktime_get_ns());
> +
> + hdr.tstamp_0 = (tstamp & 0x000000000000ffffULL) >> 0;
> + hdr.tstamp_1 = (tstamp & 0x00000000ffff0000ULL) >> 16;
> + hdr.tstamp_2 = (tstamp & 0x0000ffff00000000ULL) >> 32;
> + hdr.tstamp_3 = (tstamp & 0xffff000000000000ULL) >> 48;
> + }
> +
> + if (unlikely(iov_iter_count(iter) < vnet_hdr_sz))
> + return -EINVAL;
> +
> + if (unlikely(copy_to_iter(&hdr, vnet_hdr_sz, iter) != vnet_hdr_sz))
> + return -EFAULT;
> }
>
> if (vlan_hlen) {
>
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-02-01 21:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 8:06 [PATCH RFC v2 0/2] virtio-net: add flow filter for receive timestamps Steffen Trumtrar
2026-01-29 8:06 ` [PATCH RFC v2 1/2] tun: support rx-tstamp Steffen Trumtrar
2026-02-01 21:00 ` Willem de Bruijn [this message]
2026-01-29 8:06 ` [PATCH RFC v2 2/2] virtio-net: support receive timestamp Steffen Trumtrar
2026-01-29 9:48 ` Xuan Zhuo
2026-01-29 10:08 ` Steffen Trumtrar
2026-01-29 11:03 ` Xuan Zhuo
2026-02-01 21:05 ` Willem de Bruijn
2026-02-02 7:34 ` Steffen Trumtrar
2026-02-02 7:59 ` Michael S. Tsirkin
2026-02-02 17:40 ` Willem de Bruijn
2026-02-03 3:24 ` Jason Wang
2026-02-04 17:55 ` Willem de Bruijn
2026-02-04 18:44 ` Michael S. Tsirkin
2026-02-05 2:52 ` Jason Wang
2026-01-29 13:27 ` [syzbot ci] Re: virtio-net: add flow filter for receive timestamps syzbot ci
2026-02-01 21:00 ` [PATCH RFC v2 0/2] " Willem de Bruijn
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=willemdebruijn.kernel.391644a186dc6@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=s.trumtrar@pengutronix.de \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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