Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Jesper Dangaard Brouer
On Tue, 14 Feb 2017 22:08:10 + Edward Cree wrote: > To me, the sensible interface (which makes the batching explicit to > the driver, which I think is necessary) is to have an int (or maybe > unsigned int, which is the return type of xdp_hookfn, I'm not sure > which is intended) member in

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Tom Herbert
On Tue, Feb 14, 2017 at 2:08 PM, Edward Cree wrote: > On 14/02/17 21:07, Tom Herbert wrote: >> Off the top of my head... I'd say may we might be able to have a >> minimally invasive interface with something like: >> >> XDP_RUN(hook, xdp, drv_xdp_handle_action) >> >> This replaces xdp_run and retur

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Edward Cree
On 14/02/17 21:07, Tom Herbert wrote: > Off the top of my head... I'd say may we might be able to have a > minimally invasive interface with something like: > > XDP_RUN(hook, xdp, drv_xdp_handle_action) > > This replaces xdp_run and return codes are processed in the called > functions. Its a macr

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Tom Herbert
On Tue, Feb 14, 2017 at 12:47 PM, Tom Herbert wrote: > On Tue, Feb 14, 2017 at 12:31 PM, Jesper Dangaard Brouer > wrote: >> On Wed, 8 Feb 2017 15:41:20 -0800 >> Tom Herbert wrote: >> >>> +static inline int __xdp_run_one_hook(struct xdp_hook *hook, >>> + struct xd

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Tom Herbert
On Tue, Feb 14, 2017 at 12:31 PM, Jesper Dangaard Brouer wrote: > On Wed, 8 Feb 2017 15:41:20 -0800 > Tom Herbert wrote: > >> +static inline int __xdp_run_one_hook(struct xdp_hook *hook, >> + struct xdp_buff *xdp) >> +{ >> + void *priv = rcu_dereference(hook->

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-14 Thread Jesper Dangaard Brouer
On Wed, 8 Feb 2017 15:41:20 -0800 Tom Herbert wrote: > +static inline int __xdp_run_one_hook(struct xdp_hook *hook, > + struct xdp_buff *xdp) > +{ > + void *priv = rcu_dereference(hook->priv); > + > + if (hook->is_bpf) { > + /* Run BPF programs

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-10 Thread David Miller
From: Tom Herbert Date: Thu, 9 Feb 2017 20:55:34 -0800 > On Thu, Feb 9, 2017 at 7:33 PM, David Miller wrote: >> From: Tom Herbert >> Date: Thu, 9 Feb 2017 18:29:54 -0800 >> >>> So we have thousands or LOC coming into drivers every day anyway with >>> all those properties anyway, so this "restri

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Jason Wang
On 2017年02月10日 10:30, Tom Herbert wrote: On Thu, Feb 9, 2017 at 5:48 PM, David Miller wrote: From: Tom Herbert Date: Thu, 9 Feb 2017 15:08:22 -0800 Okay, how about this... I'll add a configuration option like XDP_ALLOW_OTHER_HOOKS. The default will be to disallow setting any hook other tha

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 7:33 PM, David Miller wrote: > From: Tom Herbert > Date: Thu, 9 Feb 2017 18:29:54 -0800 > >> So we have thousands or LOC coming into drivers every day anyway with >> all those properties anyway, so this "restricted" environment solves >> at best 1% of the problem. > > What

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread David Miller
From: Tom Herbert Date: Thu, 9 Feb 2017 15:08:22 -0800 > Okay, how about this... I'll add a configuration option like > XDP_ALLOW_OTHER_HOOKS. The default will be to disallow setting any > hook other than a BPF. If it is set, then we'll accept other hooks > to be run. This way mostly restrict the

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread David Miller
From: Tom Herbert Date: Thu, 9 Feb 2017 18:29:54 -0800 > So we have thousands or LOC coming into drivers every day anyway with > all those properties anyway, so this "restricted" environment solves > at best 1% of the problem. What you must understand is that no matter what someone outside of up

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread David Miller
From: Tom Herbert Date: Thu, 9 Feb 2017 14:45:04 -0800 > On Thu, Feb 9, 2017 at 2:34 PM, David Miller wrote: >> From: Tom Herbert >> Date: Thu, 9 Feb 2017 14:26:50 -0800 >> >>> On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: From: Tom Herbert Date: Wed, 8 Feb 2017 15:41:20 -0800

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 5:48 PM, David Miller wrote: > From: Tom Herbert > Date: Thu, 9 Feb 2017 15:08:22 -0800 > >> Okay, how about this... I'll add a configuration option like >> XDP_ALLOW_OTHER_HOOKS. The default will be to disallow setting any >> hook other than a BPF. If it is set, then we'll

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 5:42 PM, David Miller wrote: > From: Tom Herbert > Date: Thu, 9 Feb 2017 14:45:04 -0800 > >> On Thu, Feb 9, 2017 at 2:34 PM, David Miller wrote: >>> From: Tom Herbert >>> Date: Thu, 9 Feb 2017 14:26:50 -0800 >>> On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: >>

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 2:34 PM, David Miller wrote: > From: Tom Herbert > Date: Thu, 9 Feb 2017 14:26:50 -0800 > >> On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: >>> From: Tom Herbert >>> Date: Wed, 8 Feb 2017 15:41:20 -0800 >>> These hooks are also generic to allow for XDP/BPF progr

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 2:34 PM, David Miller wrote: > From: Tom Herbert > Date: Thu, 9 Feb 2017 14:26:50 -0800 > >> On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: >>> From: Tom Herbert >>> Date: Wed, 8 Feb 2017 15:41:20 -0800 >>> These hooks are also generic to allow for XDP/BPF progr

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread David Miller
From: Tom Herbert Date: Thu, 9 Feb 2017 14:26:50 -0800 > On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: >> From: Tom Herbert >> Date: Wed, 8 Feb 2017 15:41:20 -0800 >> >>> These hooks are also generic to allow for XDP/BPF programs as well >>> as non-BPF code (e.g. kernel code can be writte

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Tom Herbert
On Thu, Feb 9, 2017 at 2:17 PM, David Miller wrote: > From: Tom Herbert > Date: Wed, 8 Feb 2017 15:41:20 -0800 > >> These hooks are also generic to allow for XDP/BPF programs as well >> as non-BPF code (e.g. kernel code can be written in a module). > > I don't think we should even remotely consid

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread David Miller
From: Tom Herbert Date: Wed, 8 Feb 2017 15:41:20 -0800 > These hooks are also generic to allow for XDP/BPF programs as well > as non-BPF code (e.g. kernel code can be written in a module). I don't think we should even remotely consider surrendering the XDP hook to module code. We restrict it to

RE: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-09 Thread Mintz, Yuval
> + * Fields: > + * > + * priority - priority for insertion into set. The set is ordered lowest to > + * highest priority. > + * is_bpf - indicates that the hook is a BPF program (priv refers to a > + * bpf_prog structure. This allows calling the BPF program directly > + * from xdp_run wi

Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-08 Thread Jiri Pirko
Thu, Feb 09, 2017 at 12:41:20AM CET, t...@herbertland.com wrote: >This patch creates an infrastructure for registering and running code at >XDP hooks in drivers. This extends and generalizes the original XDP/BPF >interface. Specifically, it defines a generic xdp_hook structure and a >set of hooks t

[PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP

2017-02-08 Thread Tom Herbert
This patch creates an infrastructure for registering and running code at XDP hooks in drivers. This extends and generalizes the original XDP/BPF interface. Specifically, it defines a generic xdp_hook structure and a set of hooks that can be assigned to devices or napi instances. These hooks are al