From: Philipp Sudakas <filzador@gmail.com>
To: Ronak Doshi <ronak.doshi@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>
Cc: netdev@vger.kernel.org, Philipp Sudakas <filzador@gmail.com>
Subject: [PATCH net 2/2] vmxnet3: keep the XDP program across device resets
Date: Sun, 22 Nov 2026 03:28:47 +0300 [thread overview]
Message-ID: <20261122002847.616-3-filzador@gmail.com> (raw)
In-Reply-To: <20261122002847.616-1-filzador@gmail.com>
vmxnet3_rq_cleanup_all() clears adapter->xdp_bpf_prog. It is called
from vmxnet3_quiesce_dev(), so on every MTU change, down/up, ring
resize, reset work and resume. After that the driver no longer runs
XDP, while the core still reports the program as attached, and the
driver's reference to the program is never dropped: a later detach
finds xdp_bpf_prog already NULL and returns early.
Seen on 6.12.117 and 7.2.12: after "ip link set dev X mtu 1400",
"ip link set dev X down; ip link set dev X up" or
"ethtool -G X rx 512", the attached program is no longer called, and
each detached program stays loaded.
Do not clear the pointer there. The program is exchanged and released
by vmxnet3_xdp_set(), which also runs when the device is unregistered.
Rx rings are then recreated in XDP mode after a reset, as
vmxnet3_xdp_enabled() stays true.
Since the program now survives an MTU change, reject an MTU above
VMXNET3_XDP_MAX_MTU while XDP is attached, as vmxnet3_xdp_set()
already refuses to attach a program at such an MTU.
The problem was found and analysed, and this patch drafted, with the
help of an AI coding assistant. It was reproduced and tested on the
reporter's lab systems as described in the cover letter.
Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.")
Signed-off-by: Philipp Sudakas <filzador@gmail.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index fb98eb7..e84bf11 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2104,7 +2104,6 @@ vmxnet3_rq_cleanup_all(struct vmxnet3_adapter *adapter)
for (i = 0; i < adapter->num_rx_queues; i++)
vmxnet3_rq_cleanup(&adapter->rx_queue[i], adapter);
- rcu_assign_pointer(adapter->xdp_bpf_prog, NULL);
}
@@ -3663,6 +3662,11 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
int err = 0;
+ if (vmxnet3_xdp_enabled(adapter) && new_mtu > VMXNET3_XDP_MAX_MTU) {
+ netdev_err(netdev, "MTU %d too large for XDP\n", new_mtu);
+ return -EINVAL;
+ }
+
/*
* Reset_work may be in the middle of resetting the device, wait for its
* completion.
--
2.47.3
prev parent reply other threads:[~2026-11-22 0:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 0:28 [PATCH net 0/2] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset Philipp Sudakas
2026-11-22 0:28 ` [PATCH net 1/2] vmxnet3: drop XDP frames that do not fit in one rx buffer Philipp Sudakas
2026-11-22 0:28 ` Philipp Sudakas [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=20261122002847.616-3-filzador@gmail.com \
--to=filzador@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=ronak.doshi@broadcom.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