Subject: Re: [PATCH v3 net-next RFC] Generic XDP

From: Jesper Dangaard Brouer <[email-masked]>
Date: Fri, 14 Apr 2017 11:05:25 +0200

On Thu, 13 Apr 2017 11:37:22 -0400 (EDT)
David Miller <[email-masked]> wrote:

> From: Alexei Starovoitov <[email-masked]>
> Date: Wed, 12 Apr 2017 21:20:38 -0700
> 
> > On Wed, Apr 12, 2017 at 02:54:15PM -0400, David Miller wrote:  
[...]
> 
> If the capability is variable, it must be communicated to the user
> somehow at program load time.
> 
> We are consistently finding that there is this real need to
> communicate XDP capabilities, or somehow verify that the needs
> of an XDP program can be satisfied by a given implementation.

I fully agree that we need some way to express capabilities[1]

[1] http://prototype-kernel.readthedocs.io/en/latest/networking/XDP/design/design.html#capabilities-negotiation

> Maximum headroom is just one.

[...]
> 
> We can only optimize this and elide things when we have a facility in
> the future for the program to express it's needs precisely.  I think
> we will have to add some control structure to XDP programs that can
> be filled in for this purpose.

I fully agree that we need some control structure to XDP programs.  My
previous attempt was shot-down due to performance concerns of an extra
pointer dereference. As I explained before, this is not a concern as
the dereference will happen once per N packets in the NAPI loop.

Plus now we see a need to elide things based on facilities the XDP
program choose to use/enable, for performance reasons.  I would prefer
keeping these facility settings in control structure to XDP programs,
instead of pulling in derived bits runtime.   Again remember, adding
if/branch statements checking for facilities, should have little
performance impact as the branch predictor should guess correctly given
we process N packets in the NAPI loop with same facilities.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer