From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [RFC net-next 3/6] net: xdp: make the stack take care of the tear down Date: Fri, 24 Nov 2017 19:28:48 -0800 Message-ID: <20171124192848.049a73f2@cakuba.netronome.com> References: <20171124023613.16855-1-jakub.kicinski@netronome.com> <20171124023613.16855-4-jakub.kicinski@netronome.com> <6b7dd6a9-3658-d1af-1d42-e898ccc10e5a@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, alexei.starovoitov@gmail.com, jiri@resnulli.us, Saeed Mahameed , Michael Chan , Ariel Elior , John Fastabend To: Daniel Borkmann Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:39642 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbdKYD2w (ORCPT ); Fri, 24 Nov 2017 22:28:52 -0500 Received: by mail-pl0-f67.google.com with SMTP id l16so5338666pli.6 for ; Fri, 24 Nov 2017 19:28:52 -0800 (PST) In-Reply-To: <6b7dd6a9-3658-d1af-1d42-e898ccc10e5a@iogearbox.net> Sender: netdev-owner@vger.kernel.org List-ID: 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)); > > +}