Re: [PATCH net-next v5 11/13] net: lan966x: add PCIe FDMA XDP support
From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-05-23 02:01:27
Also in:
bpf, linux-arm-kernel, lkml
On Wed, 20 May 2026 10:12:23 +0200 Daniel Machon wrote:
#if IS_ENABLED(CONFIG_MCHP_LAN966X_PCI)
extern const struct lan966x_fdma_ops lan966x_fdma_pci_ops;
+
+static inline bool lan966x_is_pci(struct lan966x *lan966x)
+{
+ return lan966x->ops == &lan966x_fdma_pci_ops;return IS_ENABLED(CONFIG_MCHP_LAN966X_PCI) && lan966x->ops == &lan966x_fdma_pci_ops; compiler will eliminate the reference to the ops as dead code and linker will not complain that its object is missing.
quoted hunk ↗ jump to hunk
+} +#else +static inline bool lan966x_is_pci(struct lan966x *lan966x) +{ + return false; +} #endif int lan966x_lag_port_join(struct lan966x_port *port,diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c index 9ee61db8690b..b470f731e25c 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c@@ -24,6 +24,16 @@ static int lan966x_xdp_setup(struct net_device *dev, struct netdev_bpf *xdp) old_prog = xchg(&port->xdp_prog, xdp->prog); new_xdp = lan966x_xdp_present(lan966x); + /* PCIe FDMA uses contiguous buffers, so no page_pool reload + * is needed. Drain NAPI before freeing the old program so + * no in-flight poll holds a stale pointer. + */
Not sure what this does. BPF programs are under RCU, they are not immediately freed (if that's that you mean..)
+ if (lan966x_is_pci(lan966x)) {
+ if (old_prog)
+ napi_synchronize(&lan966x->napi);
+ goto out;
+ }