Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Steffen Trumtrar
Thu, 12 Nov 2026 11:19
[PATCH net-next v5 5/9] virtio-net: support receive timestamp
Author: Steffen Trumtrar
Date: Thu, 12 Nov 2026 11:19
Date: Thu, 12 Nov 2026 11:19
372 lines
24298 bytes
24298 bytes
Add optional hardware rx timestamp offload for virtio-net.
Introduce the virtio feature VIRTIO_NET_F_RX_TSTAMP. If negotiated, the
virtio-net header grows by room for a 64 bit TAI timestamp (header
size 40 bytes), stored in struct virtio_net_common_hdr. The layout is
cumulative: the field is at the same offset whether or not the
features before it were negotiated. The fixed layout needs
VIRTIO_F_VERSION_1, so the feature is cleared without it.
Implement ndo_hwtstamp_get/set so the timestamping can be enabled
and disabled at runtime with SIOCSHWTSTAMP. The driver cannot filter
what the device timestamps, so any rx filter other than NONE becomes
ALL. The timestamp is read before the packet is handed to the XDP
program or the stack, and attached to the skb with skb_hwtstamps().
It is a raw TAI value; there is no PHC.
The header size is negotiated per device and also applies to
transmitted packets. xmit_skb() clears the whole header, so the device
sees a zero tstamp.
On receive in big packet mode, the header is placed in front of the
data in the first page. Grow padded_vnet_hdr to 48 bytes so the
40 byte header still fits there.
Tested in a guest with a patched QEMU:
guest: ./timestamping eth0 \
SOF_TIMESTAMPING_RAW_HARDWARE \
SOF_TIMESTAMPING_RX_HARDWARE
host: nc -4 -u 192.168.1.1 319
Based on work by Willem de Bruijn.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
drivers/net/virtio_net.c | 131 +++++++++++++++++++++++++++++++++++-----
include/linux/virtio_net.h | 10 +++
include/uapi/linux/virtio_net.h | 1 +
3 files changed, 127 insertions(+), 15 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 23e7f62a6ff64..57b7c32625dfb 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -20,6 +20,7 @@
#include <linux/filter.h>
#include <linux/kernel.h>
#include <linux/dim.h>
+#include <linux/unaligned.h>
#include <net/route.h>
#include <net/xdp.h>
#include <net/net_failover.h>
@@ -418,6 +419,12 @@ struct virtnet_info {
u32 rss_hash_types_supported;
u32 rss_hash_types_saved;
+ /* Device passes time stamps to the driver */
+ bool rx_tstamp_supported;
+ bool rx_tstamp_enabled;
+
+ struct kernel_hwtstamp_config tstamp_config;
+
/* Has control virtqueue */
bool has_cvq;
@@ -482,15 +489,17 @@ static_assert(offsetof(struct virtnet_info, rss_trailer.hash_key_data) ==
offsetof(struct virtnet_info, rss_hash_key_data));
struct padded_vnet_hdr {
- struct virtio_net_hdr_v1_hash hdr;
+ struct virtio_net_common_hdr hdr;
/*
* hdr is in a separate sg buffer, and data sg buffer shares same page
* with this header sg. This padding makes next sg 16 byte aligned
* after the header.
*/
- char padding[12];
+ char padding[8];
};
+static_assert(sizeof(struct padded_vnet_hdr) % 16 == 0);
+
/*
* The vnet header sits in the headroom in front of xdp->data, which the
* XDP program may overwrite with bpf_xdp_adjust_head() or
@@ -520,7 +529,7 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp,
unsigned int *xdp_xmit,
struct virtnet_rq_stats *stats);
static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *rq,
- struct sk_buff *skb, u8 flags);
+ struct sk_buff *skb, u8 flags, ktime_t tstamp);
static struct sk_buff *virtnet_skb_append_frag(struct receive_queue *rq,
struct sk_buff *head_skb,
struct sk_buff *curr_skb,
@@ -1299,14 +1308,25 @@ static struct sk_buff *virtnet_receive_xsk_merge(struct net_device *dev, struct
return NULL;
}
+static inline ktime_t virtnet_record_rx_tstamp(const struct virtnet_info *vi,
+ const struct virtio_net_common_hdr *hdr)
+{
+ if (!READ_ONCE(vi->rx_tstamp_enabled))
+ return 0;
+
+ return ns_to_ktime(get_unaligned_le64(hdr->tstamp));
+}
+
static void virtnet_receive_xsk_buf(struct virtnet_info *vi, struct receive_queue *rq,
void *buf, u32 len,
unsigned int *xdp_xmit,
struct virtnet_rq_stats *stats)
{
struct net_device *dev = vi->dev;
+ struct virtio_net_common_hdr *hdr;
struct sk_buff *skb = NULL;
struct xdp_buff *xdp;
+ ktime_t tstamp;
u8 flags;
len -= vi->hdr_len;
@@ -1324,7 +1344,9 @@ static void virtnet_receive_xsk_buf(struct virtnet_info *vi, struct receive_queu
return;
}
- flags = ((struct virtio_net_common_hdr *)(xdp->data - vi->hdr_len))->hdr.flags;
+ hdr = (struct virtio_net_common_hdr *)(xdp->data - vi->hdr_len);
+ flags = hdr->hdr.flags;
+ tstamp = virtnet_record_rx_tstamp(vi, hdr);
if (!vi->mergeable_rx_bufs)
skb = virtnet_receive_xsk_small(dev, vi, rq, xdp, xdp_xmit, stats);
@@ -1332,7 +1354,7 @@ static void virtnet_receive_xsk_buf(struct virtnet_info *vi, struct receive_queu
skb = virtnet_receive_xsk_merge(dev, vi, rq, xdp, xdp_xmit, stats);
if (skb)
- virtnet_receive_done(vi, rq, skb, flags);
+ virtnet_receive_done(vi, rq, skb, flags, tstamp);
}
static int virtnet_add_recvbuf_xsk(struct virtnet_info *vi, struct receive_queue *rq,
@@ -2540,7 +2562,7 @@ static void virtio_skb_set_hash(const struct virtio_net_hdr_v1_hash *hdr_hash,
}
static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *rq,
- struct sk_buff *skb, u8 flags)
+ struct sk_buff *skb, u8 flags, ktime_t tstamp)
{
struct virtio_net_common_hdr *hdr;
struct net_device *dev = vi->dev;
@@ -2549,6 +2571,9 @@ static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *
if (dev->features & NETIF_F_RXHASH && vi->has_rss_hash_report)
virtio_skb_set_hash(&hdr->hash_v1_hdr, skb);
+ if (tstamp)
+ skb_hwtstamps(skb)->hwtstamp = tstamp;
+
hdr->hdr.flags = flags;
if (virtio_net_handle_csum_offload(skb, &hdr->hdr, vi->rx_tnl_csum)) {
net_warn_ratelimited("%s: bad csum: flags: %x, gso_type: %x rx_tnl_csum %d\n",
@@ -2587,8 +2612,10 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
unsigned int *xdp_xmit,
struct virtnet_rq_stats *stats)
{
+ struct virtio_net_common_hdr *hdr;
struct net_device *dev = vi->dev;
struct sk_buff *skb;
+ ktime_t tstamp;
u8 flags;
if (unlikely(len < vi->hdr_len + ETH_HLEN)) {
@@ -2618,23 +2645,27 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
*/
if (vi->mergeable_rx_bufs) {
- flags = ((struct virtio_net_common_hdr *)buf)->hdr.flags;
+ hdr = buf;
+ flags = hdr->hdr.flags;
+ tstamp = virtnet_record_rx_tstamp(vi, hdr);
skb = receive_mergeable(dev, vi, rq, buf, ctx, len, xdp_xmit,
stats);
} else if (vi->big_packets) {
- void *p = page_address((struct page *)buf);
-
- flags = ((struct virtio_net_common_hdr *)p)->hdr.flags;
+ hdr = page_address((struct page *)buf);
+ flags = hdr->hdr.flags;
+ tstamp = virtnet_record_rx_tstamp(vi, hdr);
skb = receive_big(dev, vi, rq, buf, len, stats);
} else {
- flags = ((struct virtio_net_common_hdr *)buf)->hdr.flags;
+ hdr = buf;
+ flags = hdr->hdr.flags;
+ tstamp = virtnet_record_rx_tstamp(vi, hdr);
skb = receive_small(dev, vi, rq, buf, ctx, len, xdp_xmit, stats);
}
if (unlikely(!skb))
return;
- virtnet_receive_done(vi, rq, skb, flags);
+ virtnet_receive_done(vi, rq, skb, flags, tstamp);
}
static int virtnet_rq_submit(struct receive_queue *rq, char *buf,
@@ -5575,6 +5606,27 @@ static int virtnet_get_per_queue_coalesce(struct net_device *dev,
return 0;
}
+static int virtnet_get_ts_info(struct net_device *dev,
+ struct kernel_ethtool_ts_info *info)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+
+ /* setup default software timestamp */
+ ethtool_op_get_ts_info(dev, info);
+
+ if (vi->rx_tstamp_supported) {
+ info->so_timestamping |=
+ SOF_TIMESTAMPING_RX_HARDWARE |
+ SOF_TIMESTAMPING_RAW_HARDWARE;
+
+ info->tx_types = BIT(HWTSTAMP_TX_OFF);
+ info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
+ BIT(HWTSTAMP_FILTER_ALL);
+ }
+
+ return 0;
+}
+
static void virtnet_init_settings(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
@@ -5670,7 +5722,7 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.get_ethtool_stats = virtnet_get_ethtool_stats,
.set_channels = virtnet_set_channels,
.get_channels = virtnet_get_channels,
- .get_ts_info = ethtool_op_get_ts_info,
+ .get_ts_info = virtnet_get_ts_info,
.get_link_ksettings = virtnet_get_link_ksettings,
.set_link_ksettings = virtnet_set_link_ksettings,
.set_coalesce = virtnet_set_coalesce,
@@ -6269,6 +6321,43 @@ static void virtnet_tx_timeout(struct net_device *dev, unsigned int txqueue)
jiffies_to_usecs(jiffies - READ_ONCE(txq->trans_start)));
}
+static int virtnet_hwtstamp_get(struct net_device *dev,
+ struct kernel_hwtstamp_config *config)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+
+ if (!vi->rx_tstamp_supported)
+ return -EOPNOTSUPP;
+
+ *config = vi->tstamp_config;
+
+ return 0;
+}
+
+static int virtnet_hwtstamp_set(struct net_device *dev,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+
+ if (!vi->rx_tstamp_supported)
+ return -EOPNOTSUPP;
+
+ if (config->tx_type != HWTSTAMP_TX_OFF) {
+ NL_SET_ERR_MSG_MOD(extack, "TX timestamping is not supported");
+ return -ERANGE;
+ }
+
+ /* The driver cannot filter, any filter becomes ALL */
+ if (config->rx_filter != HWTSTAMP_FILTER_NONE)
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
+
+ WRITE_ONCE(vi->rx_tstamp_enabled, config->rx_filter == HWTSTAMP_FILTER_ALL);
+ vi->tstamp_config = *config;
+
+ return 0;
+}
+
static int virtnet_init_irq_moder(struct virtnet_info *vi)
{
u8 profile_flags = 0, coal_flags = 0;
@@ -6329,6 +6418,8 @@ static const struct net_device_ops virtnet_netdev = {
.ndo_get_phys_port_name = virtnet_get_phys_port_name,
.ndo_set_features = virtnet_set_features,
.ndo_tx_timeout = virtnet_tx_timeout,
+ .ndo_hwtstamp_set = virtnet_hwtstamp_set,
+ .ndo_hwtstamp_get = virtnet_hwtstamp_get,
};
static void virtnet_config_changed_work(struct work_struct *work)
@@ -6740,6 +6831,10 @@ static int virtnet_validate(struct virtio_device *vdev)
__virtio_clear_bit(vdev, VIRTIO_NET_F_STANDBY);
}
+ /* The fixed header layout with tstamp at offset 32 needs VERSION_1 */
+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
+ __virtio_clear_bit(vdev, VIRTIO_NET_F_RX_TSTAMP);
+
return 0;
}
@@ -6932,6 +7027,9 @@ static int virtnet_probe(struct virtio_device *vdev)
if (virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT))
vi->has_rss_hash_report = true;
+ if (virtio_has_feature(vdev, VIRTIO_NET_F_RX_TSTAMP))
+ vi->rx_tstamp_supported = true;
+
if (virtio_has_feature(vdev, VIRTIO_NET_F_RSS)) {
vi->has_rss = true;
@@ -6965,8 +7063,10 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->xdp_metadata_ops = &virtnet_xdp_metadata_ops;
}
- if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO) ||
- virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO))
+ if (vi->rx_tstamp_supported)
+ vi->hdr_len = offsetofend(struct virtio_net_common_hdr, tstamp);
+ else if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO) ||
+ virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO))
vi->hdr_len = sizeof(struct virtio_net_hdr_v1_hash_tunnel);
else if (vi->has_rss_hash_report)
vi->hdr_len = sizeof(struct virtio_net_hdr_v1_hash);
@@ -7309,6 +7409,7 @@ static unsigned int features[] = {
VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM,
VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM,
+ VIRTIO_NET_F_RX_TSTAMP,
};
static unsigned int features_legacy[] = {
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index a6de308b8f25e..2abd8a614a23f 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -17,6 +17,16 @@ struct virtio_net_common_hdr {
struct virtio_net_hdr_v1_hash hash_v1_hdr;
struct virtio_net_hdr_v1_hash_tunnel tnl_hdr;
};
+ /*
+ * The wire layout is fixed and cumulative: a field sits at the same
+ * offset whether or not the features before it were negotiated; unused
+ * bytes are padding. tstamp is thus always at offset 32 and only
+ * present (header size 40) if VIRTIO_NET_F_RX_TSTAMP was negotiated.
+ * The negotiated header size tells how much of this struct is
+ * on the wire. Only ever append new fields at the end.
+ */
+ __u8 reserved[8]; /* outer_nh_offset, ipsec_resource_hdr (not implemented) */
+ __le16 tstamp[4]; /* le64 TAI receive time in ns, 0 if none */
};
static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type)
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 1db45b01532b5..15e8e408d50fb 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -56,6 +56,7 @@
#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
* Steering */
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
+#define VIRTIO_NET_F_RX_TSTAMP 49 /* Device sends TAI receive time */
#define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide device-level statistics. */
#define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */
#define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */
--
2.56.0
Re: [PATCH net-next v5 5/9] virtio-net: support receive timestamp
Author: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:55
Date: Mon, 16 Nov 2026 13:55
174 lines
15527 bytes
15527 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 (1) ยท Medium: 1 ยท Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Feature bit and wire layout are chosen without citing the
virtio spec.
- [Low] The feature bit is exported to userspace but the header layout it
enables is not.
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch
extends it.
--
virtio-net: support receive timestamp
This adds a VIRTIO_NET_F_RX_TSTAMP feature (bit 49) to virtio-net. When
it is negotiated, the vnet header grows to 40 bytes and carries a le64 TAI
receive timestamp at offset 32, which is attached to skbs through
skb_hwtstamps(). Timestamping is switched on and off at runtime with
ndo_hwtstamp_get/set.
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 23e7f62a6ff64..57b7c32625dfb 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
[ ... ]
> @@ -1324,7 +1344,9 @@ static void virtnet_receive_xsk_buf(struct virtnet_info *vi, struct receive_queu
> return;
> }
>
> - flags = ((struct virtio_net_common_hdr *)(xdp->data - vi->hdr_len))->hdr.flags;
> + hdr = (struct virtio_net_common_hdr *)(xdp->data - vi->hdr_len);
> + flags = hdr->hdr.flags;
> + tstamp = virtnet_record_rx_tstamp(vi, hdr);
[Severity: High]
This is a pre-existing issue, but this patch adds a new read from the same
region. On the AF_XDP zero-copy path, is the vnet header in front of
xdp->data ever synced for the CPU?
virtnet_add_recvbuf_xsk() posts the descriptor hdr_len bytes before the xsk
DMA address:
addr = xsk_buff_xdp_get_dma(xsk_buffs[i]) - vi->hdr_len;
buf_to_xdp() only calls xsk_buff_dma_sync_for_cpu(), which ends up in:
include/net/xsk_buff_pool.h:xp_dma_sync_for_cpu() {
dma_sync_single_for_cpu(xskb->pool->dev, xskb->dma,
xskb->pool->frame_len,
DMA_BIDIRECTIONAL);
}
That range starts at xskb->dma, so it does not cover the hdr_len bytes the
device wrote in front of it.
Under swiotlb bouncing (for example SEV/TDX guests with
VIRTIO_F_ACCESS_PLATFORM, or swiotlb=force),
__swiotlb_sync_single_for_cpu() copies back only the synced range.
Non-coherent DMA has the same problem. In both cases the CPU reads stale
bytes from the umem page, and userspace or bpf_xdp_adjust_meta() may have
written those bytes.
virtnet_record_rx_tstamp() now reads hdr->tstamp from that region, and
virtnet_receive_done() reports the value through skb_hwtstamps(). Could a
stale or user-controlled value end up reported as the hardware timestamp?
The same gap already affects hdr->hdr.flags (VIRTIO_NET_HDR_F_DATA_VALID)
and num_buffers in virtnet_receive_xsk_merge(). If num_buffers reads as 0,
the while (--num_buf) loop in xsk_append_merge_buffer() wraps the u32, then
consumes and drops buffers that belong to the following packets.
Would syncing the header range too, starting at the posted address
(xskb->dma - vi->hdr_len), fix all of these?
[ ... ]
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index a6de308b8f25e..2abd8a614a23f 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -17,6 +17,16 @@ struct virtio_net_common_hdr {
> struct virtio_net_hdr_v1_hash hash_v1_hdr;
> struct virtio_net_hdr_v1_hash_tunnel tnl_hdr;
> };
> + /*
> + * The wire layout is fixed and cumulative: a field sits at the same
> + * offset whether or not the features before it were negotiated; unused
> + * bytes are padding. tstamp is thus always at offset 32 and only
> + * present (header size 40) if VIRTIO_NET_F_RX_TSTAMP was negotiated.
> + * The negotiated header size tells how much of this struct is
> + * on the wire. Only ever append new fields at the end.
> + */
> + __u8 reserved[8]; /* outer_nh_offset, ipsec_resource_hdr (not implemented) */
> + __le16 tstamp[4]; /* le64 TAI receive time in ns, 0 if none */
> };
[Severity: Low]
Should this layout be exported in include/uapi/linux/virtio_net.h along
with the feature bit?
VIRTIO_NET_F_RX_TSTAMP is now in the uAPI header. The 40 byte layout it
turns on (reserved[8] at offset 24, le64 tstamp at offset 32) is defined
only in this kernel-internal struct. The earlier patch in the series,
"virtio-net: move virtio_net_common_hdr to virtio_net.h", moved it here,
and the series never adds a uAPI struct.
Other features that extend the header have exported wire structs. Examples
are struct virtio_net_hdr_v1_hash for VIRTIO_NET_F_HASH_REPORT and struct
virtio_net_hdr_v1_hash_tunnel for the UDP tunnel GSO bits.
Device implementations that import the uAPI header (QEMU standard-headers,
vhost-user and DPDK backends) get the bit but no definition of the offset
and size they have to produce.
reserved[] stands in for outer_nh_offset and ipsec_resource_hdr, and
neither field is in the uAPI. The cumulative layout claim therefore can't
be checked against any exported definition.
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index 1db45b01532b5..15e8e408d50fb 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -56,6 +56,7 @@
> #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
> * Steering */
> #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
> +#define VIRTIO_NET_F_RX_TSTAMP 49 /* Device sends TAI receive time */
[Severity: Medium]
Is bit 49, and this header layout, reserved in the virtio spec?
The commit message does not reference an OASIS virtio-comment change. The
only device it was tested with is "a patched QEMU". The tun patch in this
series says it is "not intended to be merged" and links an out-of-tree QEMU
branch.
A gap in this header doesn't mean a bit is free in the spec. Bit 51 is also
unassigned here, and bits 46/47 are already reused as
VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_MAPPED and
VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM_MAPPED. Willem de Bruijn's earlier
timestamp work used bits that the spec later gave to USO and notification
coalescing.
Placing the timestamp at offset 32 also relies on outer_nh_offset and
ipsec_resource_hdr, which are not implemented here.
Suppose the spec gives bit 49, or the timestamp offset, to something else.
A device offering bit 49 would then make virtnet_probe() choose:
if (vi->rx_tstamp_supported)
vi->hdr_len = offsetofend(struct virtio_net_common_hdr, tstamp);
for both RX and TX. RX would strip the wrong number of bytes, TX would send
a header of the wrong size, and unrelated bytes would be reported as
hardware timestamps.
The vhost-net patch later in the series also advertises the bit to
userspace. That would make it negotiated ABI as soon as this is merged.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-v6-7-topic-virtio-net-ptp-v5-0-7ab67b572f4f%40pengutronix.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads