[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACKFLikqDDLDSywxTNJoktpO0ViggH=Lbzebw27RaUPSGp0knQ@mail.gmail.com>
Date: Wed, 12 Apr 2017 23:48:22 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: David Miller <davem@...emloft.net>
Cc: Netdev <netdev@...r.kernel.org>, xdp-newbies@...r.kernel.org
Subject: Re: [PATCH v3 net-next RFC] Generic XDP
On Wed, Apr 12, 2017 at 11:54 AM, David Miller <davem@...emloft.net> 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;
> +}
> +
Powered by blists - more mailing lists