From: netdev-bot+sashiko@kernel.org
To: s.trumtrar@pengutronix.de
Cc: mst@redhat.com, xuanzhuo@linux.alibaba.com, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com,
willemdebruijn.kernel@gmail.com, andrew+netdev@lunn.ch,
eperezma@redhat.com, jasowangio@gmail.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, edumazet@kernel.org, andrew@lunn.ch,
horms@kernel.org, kory.maincent@bootlin.com,
liangchen.linux@gmail.com, hengqi@linux.alibaba.com,
virtualization@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
kvm@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH net-next v5 8/9] virtio-net: add XDP rx timestamp metadata
Date: Mon, 16 Nov 2026 13:55:09 +0000 [thread overview]
Message-ID: <179483730942.3136.8459645121543996993@kernel.org> (raw)
In-Reply-To: <20261112-v6-7-topic-virtio-net-ptp-v5-8-7ab67b572f4f@pengutronix.de>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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] virtnet_probe() now reports XDP rx-metadata capabilities the
device does not have.
--
virtio-net: add XDP rx timestamp metadata
This adds an xmo_rx_timestamp callback to virtio-net, so XDP programs can
read the rx timestamp with bpf_xdp_metadata_rx_timestamp(). The timestamp
is copied into struct virtnet_xdp_buff before the program runs. The
metadata ops are now also installed when VIRTIO_NET_F_RX_TSTAMP is the
only one of these features negotiated.
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 57b7c32625dfb..46be686e34b79 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
[ ... ]
> @@ -6896,8 +6899,21 @@ static int virtnet_xdp_rx_hash(const struct xdp_md *_ctx, u32 *hash,
[ ... ]
> static const struct xdp_metadata_ops virtnet_xdp_metadata_ops = {
> .xmo_rx_hash = virtnet_xdp_rx_hash,
> + .xmo_rx_timestamp = virtnet_xdp_rx_timestamp,
> };
>
> static int virtnet_probe(struct virtio_device *vdev)
> @@ -7063,6 +7079,10 @@ static int virtnet_probe(struct virtio_device *vdev)
> dev->xdp_metadata_ops = &virtnet_xdp_metadata_ops;
> }
>
> + /* rx_hash returns -ENODATA without NETIF_F_RXHASH */
> + if (vi->rx_tstamp_supported)
> + dev->xdp_metadata_ops = &virtnet_xdp_metadata_ops;
> +
[Severity: Medium]
virtnet_probe() installs the same virtnet_xdp_metadata_ops table in both
places. Does that change what netdev netlink reports for devices that
have only one of the two features?
netdev_nl_dev_fill() sets an xdp-rx-metadata-features bit for every
xmo_* pointer that is not NULL:
net/core/netdev-genl.c:netdev_nl_dev_fill() {
...
#define XDP_METADATA_KFUNC(_, flag, __, xmo) \
if (netdev->xdp_metadata_ops && netdev->xdp_metadata_ops->xmo) \
xdp_rx_meta |= flag;
...
}
Documentation/netlink/specs/netdev.yaml describes the timestamp bit as
"Device is capable of exposing receive HW timestamp via
bpf_xdp_metadata_rx_timestamp()".
Take an existing device that negotiates VIRTIO_NET_F_RSS or
VIRTIO_NET_F_HASH_REPORT, but not VIRTIO_NET_F_RX_TSTAMP. It still gets
the table from the has_rss || has_rss_hash_report block above. After this
patch, that table has xmo_rx_timestamp, so the device now reports the
timestamp capability.
Can such a device ever deliver a timestamp? virtnet_hwtstamp_set()
rejects the request:
if (!vi->rx_tstamp_supported)
return -EOPNOTSUPP;
So rx_tstamp_enabled stays false and virtnet_record_rx_tstamp() always
returns 0. As a result, virtnet_xdp_rx_timestamp() always returns
-ENODATA.
virtnet_get_ts_info() also does not set SOF_TIMESTAMPING_RX_HARDWARE in
this case. The ethtool and netdev netlink answers then disagree.
The opposite case is the one the new comment mentions. A device with only
VIRTIO_NET_F_RX_TSTAMP never gets NETIF_F_RXHASH. It now reports the hash
capability, but virtnet_xdp_rx_hash() always returns -ENODATA.
Would separate xdp_metadata_ops tables, chosen by which features were
negotiated, keep the reported bits accurate? The commit message covers
the rx_hash case, but not the change for existing RSS/hash-only devices.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-v6-7-topic-virtio-net-ptp-v5-0-7ab67b572f4f%40pengutronix.de
next prev parent reply other threads:[~2026-11-16 13:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 11:19 [PATCH net-next v5 0/9] virtio-net: add receive timestamp support Steffen Trumtrar
2026-11-12 11:19 ` [PATCH net-next v5 1/9] net: ethtool: tsconfig: allow hardware timestamping without a PHC Steffen Trumtrar
2026-11-12 11:19 ` [PATCH net-next v5 2/9] virtio-net: zero the whole tx header Steffen Trumtrar
2026-11-16 13:55 ` netdev-bot+sashiko
2026-11-12 11:19 ` [PATCH net-next v5 3/9] virtio-net: copy the XDP rx hash before the program runs Steffen Trumtrar
2026-11-12 11:19 ` [PATCH net-next v5 4/9] virtio-net: move virtio_net_common_hdr to virtio_net.h Steffen Trumtrar
2026-11-12 11:19 ` [PATCH net-next v5 5/9] virtio-net: support receive timestamp Steffen Trumtrar
2026-11-16 13:55 ` netdev-bot+sashiko
2026-11-12 11:19 ` [PATCH net-next v5 6/9] virtio-net: assert header sizes Steffen Trumtrar
2026-11-12 11:19 ` [PATCH net-next v5 7/9] vhost-net: support VIRTIO_NET_F_RX_TSTAMP Steffen Trumtrar
2026-11-16 13:55 ` netdev-bot+sashiko
2026-11-12 11:19 ` [PATCH net-next v5 8/9] virtio-net: add XDP rx timestamp metadata Steffen Trumtrar
2026-11-16 13:55 ` netdev-bot+sashiko [this message]
2026-11-12 11:19 ` [PATCH net-next v5 9/9] tun: add rx timestamp to the vnet header Steffen Trumtrar
2026-11-16 13:55 ` netdev-bot+sashiko
2026-11-12 11:26 ` [PATCH net-next v5 0/9] virtio-net: add receive timestamp support netdev-bot+sinfo
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=179483730942.3136.8459645121543996993@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=hengqi@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=liangchen.linux@gmail.com \
--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=sdf@fomichev.me \
--cc=virtualization@lists.linux.dev \
--cc=willemdebruijn.kernel@gmail.com \
--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