On Sat, 25 Nov 2017 00:24:50 +0100, Daniel Borkmann wrote: > > +static void dev_xdp_uninstall(struct net_device *dev) > > +{ > > + struct netdev_bpf xdp; > > + bpf_op_t ndo_bpf; > > Can you add a comment here stating that generic XDP does not > need to be handled since we drop the prog from free_netdev()? > Potentially we could also drop the generic one from here, that > way we'd make no difference and have a dev_xdp_install() and > one dev_xdp_uninstall() for all kind of attach types. Given > generic XDP should simulate native XDP anyway, probably better > to just do that.
I will move the freeing of generic XDP here and add a simple test to the last patch. Thanks! > > + ndo_bpf = dev->netdev_ops->ndo_bpf; > > + if (!ndo_bpf) > > + return; > > + > > + __dev_xdp_query(dev, ndo_bpf, &xdp); > > + if (xdp.prog_attached == XDP_ATTACHED_NONE) > > + return; > > + > > + /* Program removal should always succeed */ > > + WARN_ON(dev_xdp_install(dev, ndo_bpf, NULL, xdp.prog_flags, NULL)); > > +}