Subject: Re: [PATCH net-next v5 11/13] net: lan966x: add PCIe FDMA XDP support

From: Jakub Kicinski <[email-masked]>
Date: Fri, 22 May 2026 19:01:26 -0700

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.

> +}
> +#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;
> +	}