Re: [PATCH net-next v3 3/6] net: bcmgenet: add basic XDP support (PASS/DROP)
From: Nicolai Buchwitz
Date: Mon Mar 30 2026 - 18:01:45 EST
On 30.3.2026 20:15, Mohsin Bashir wrote:
+static int bcmgenet_xdp_setup(struct net_device *dev,
+ struct netdev_bpf *xdp)
+{
+ struct bcmgenet_priv *priv = netdev_priv(dev);
+ struct bpf_prog *old_prog;
+ struct bpf_prog *prog = xdp->prog;
+
+ if (prog && dev->mtu > PAGE_SIZE - GENET_RX_HEADROOM -
+ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) {
+ NL_SET_ERR_MSG_MOD(xdp->extack,
+ "MTU too large for single-page XDP buffer");
+ return -EOPNOTSUPP;
+ }
The MTU check here is great. But I do not see support for .ndo_change_mtu. This would allow users to change MTU size AFTER the program is attached.
Good point. I had planned to add ndo_change_mtu in a follow-up series, but this leaves a gap where MTU can be changed while XDP is attached.
Options:
1. Add a minimal ndo_change_mtu to this series that only rejects MTU changes incompatible with XDP, default behavior otherwise
2. Reject any MTU change while XDP is attached
3. Defer to the ndo_change_mtu follow-up series
Thoughts?
Thanks
Nicolai