Article View: linux.kernel.netdev
Article #17230Re: [PATCH net-next v5 8/9] virtio-net: add XDP rx timestamp metadata
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:55
Date: Mon, 16 Nov 2026 13:55
101 lines
11941 bytes
11941 bytes
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
Technical Details
Message-ID:
<179483730942.3136.8459645121543996993@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364396-linux-kernel-netdev=dewy.ruReferences:
<20261112-v6-7-topic-virtio-net-ptp-v5-8-7ab67b572f4f@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364396-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 8/9] virtio-net: add XDP rx timestamp metadata Date: Mon, 16 Nov 2026 13:55:09 +0000 Organization: Usenet Network Message-ID: <179483730942.3136.8459645121543996993@kernel.org> References: <20261112-v6-7-topic-virtio-net-ptp-v5-8-7ab67b572f4f@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2079707"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:+6cIa5q3UWxo4RpNw1xM04iRSXs= sha256:fJlfZkuh5RgZlyzYvZ8gThb1jPpjBLU3Esw2ABaDsXI= sha1:7TdWQq+fOOvXPt8dCZeKHXRurl0= sha256:fIx8uYBkPMUMIbEjRSvwHSI2AsFVG4eyRUgME8FlwGg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 054A2114C60; Mon, 16 Nov 2026 16:57:36 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VuzX-DRcwGzn; Mon, 16 Nov 2026 16:57:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364396-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 1B6E3114C5D; Mon, 16 Nov 2026 16:57:24 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 2466623847; Mon, 16 Nov 2026 13:57:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794837322; b=qsYuvMHjM08/8TW21n3wUQKFMUvbvJDLCyFyx0CdRSx0S1Le6Z1s1vkMz9F0xbR6SJga RRH5WyC1oNhqmhxlLsp+WdYtF/nqoFEOq+snJA3sMWe8JUUhF/BLbYWbMKCehCsE/bfWt HM5tntkBo0KJz/x5XJGnjIzssWG17nA+XwzfjXenx6uy3OLTqzKNlfwONOJf2xJ6GJam3 vE1SIn+6g3WoOvp3Paq0IoSIr+IsrtV3lqlSe1/0gZfCu3PGW1u0CMLUNpXVIf1MCmDKv 2yhBneF+2cts+aZE00URVH0fOcGI0ojZd8Ykvq0dQsxKe2N3gPDZEJC9QHD0VaqByIg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837322; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=6+wHABsofSehspfHzJdUbQ94+anC5ikK+6WkhLo4zaw=; b=1pLrJe/EI8bYPlfQLtyLvQi65huo4RHwzV6agA4hPCup+43iPzaiN3rlugvkkgepnxQm 1eSa3tG0NMbQqQH53+6NZFRj/RmO/hsT5ZwX8lpIcCBTxn0zccIV9jeM87gdiCKx9A2rl hP7zEfp388rySx40HZCuYJcYQbs/x09fmJ2V7ZLUp15jJ8pN8osA78+8YwTQ7SLqb7UT3 L8e7jKEPfleF96AadCvlZz6pj9W4vzaKa5+6DfewTcsObCNfPPH8S87B2KMI4b5ezKrKN XuUxpbed8cr4LwFy2ZXQR+HOvgqKfNMZ9K+g1gCQnao9FJhvnf7gdF6ygPGZTRgVCDA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L7yzx6Ao; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD4C6606F119; Mon, 16 Nov 2026 13:55:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L7yzx6Ao X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794837312; b=Y8hntPbUjqsSnwpvwzUUNseJOEy29MHI/Lw8eu8+VeoSlCN4M1X9HmIJIgrUr+lHNt8C xJA1RWndL1hGTLm8JTGxTDS9t1lqjfyK+c9dXVFhW67pPewNgjD/qS8ehidJxzwOTOfqE 7Bcau5orPyPlbInvpfON7/DO3jq/42y17h0KGohQ00jn2zdzDYVM0BDFk0CQkpPvNMI7a 4IFcEl20iCKx3TwQj9feaWPheJS8+8NCRTRGbTY5F1K5ZgBFfUi5GJ2lwiE8I1unY10mw jj1TnIRuEQVAw1bJhkpagvEqP4hg5xcOjFgDZ/eeBgiIRyXKbP6EC0SYX0IzyzRRXMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837312; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=6+wHABsofSehspfHzJdUbQ94+anC5ikK+6WkhLo4zaw=; b=cCs2UPKWKrriEU4XCmfzP3szlwteol6O+GNvbjeG0Yp0AbPhqHJDBDe9TjrXyYKCns2Z t07/jMWAhn2xzrKa+64a6PG+EjrLKDAMkNnHHU9f6MRBg6IZUZ8PwNYrFd61LtRIQLxa9 nOnTS5x/pcw0ab/S08oNCKgTJcjMDEj7h1+qNwiJpaC8drD1Ws650rz4e9gmbP4e0V58B 1L/FgBwdh0tEsOic7MZzvU9SfEjPQ/EdNxCH9LyLR71z1qXxGEo3EV7eL03RYGMAX5Kz4 xr+W+zCf4gp3LINgdi1a8rTez5/1Z8gNng+/VbRQzJa54EMTkUug6ZqSFuyQ9aqk+8A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L7yzx6Ao; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC7FF60A263B; Mon, 16 Nov 2026 13:55:11 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2F1B1F000C5; Mon, 16 Nov 2026 13:55:09 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837311; bh=6+wHABsofSehspfHzJdUbQ94+anC5ikK+6WkhLo4zaw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=L7yzx6AoOEKCrIvuoPnMTexmPn/vRZbU4PYAgBs7j+XWA1B7SlgMP6vFMlAkSo+4f vjgqsAB/0id9qHJfOjnnPkfda6xeY84Zo/kihMjsldg+ULJ63/+sUrXpfKXRQYOHlW 5jvwxiAnvaUhVlm4K4/U+GhgUEK6FEL4JkuLAlcfYakM8MY7p0f+rnC+XRouLSR/Lw 7OSObnpJO5pNYnOhJx23mUo2/uD4zF/rq4tcZtjnzlB77UM+YgYtNmIVGVXrdu0YSX bEGImEUmAe/Bqi8JP9ZD1Xk0XJcQrNc+0sVwSYvTOp8Zf8mULRxXe/mNeH5pOMpHKQ xUPCBfrgn1ysA== X-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 X-In-Reply-To: <20261112-v6-7-topic-virtio-net-ptp-v5-8-7ab67b572f4f@pengutronix.de> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list