On Wed, Apr 12, 2017 at 11:54 AM, David Miller <davem@xxxxxxxxxxxxx> wrote: > > +static struct static_key generic_xdp_needed __read_mostly; > + > +static int generic_xdp_install(struct net_device *dev, struct netdev_xdp *xdp) > +{ > + struct bpf_prog *new = xdp->prog; > + int ret = 0; > + > + switch (xdp->command) { > + case XDP_SETUP_PROG: { > + struct bpf_prog *old = rtnl_dereference(dev->xdp_prog); > + > + rcu_assign_pointer(dev->xdp_prog, new); > + if (old) > + bpf_prog_put(old); > + > + if (old && !new) > + static_key_slow_dec(&generic_xdp_needed); > + else if (new && !old) > + static_key_slow_inc(&generic_xdp_needed); I think we need to call dev_disable_lro(dev) to disable LRO also when a BPF program is installed. > + break; > + } > + > + case XDP_QUERY_PROG: > + xdp->prog_attached = !!rcu_access_pointer(dev->xdp_prog); > + break; > + > + default: > + ret = -EINVAL; > + break; > + } > + > + return ret; > +} > +