Subject: Re: [PATCH v1 1/6] net: Generalize udp based tunnel offload

From: Jamal Hadi Salim <[email-masked]>
Date: Tue, 8 Dec 2015 09:23:39 -0500

On 15-12-08 02:33 AM, John Fastabend wrote:
> On 15-12-02 04:15 PM, Tom Herbert wrote:

>>>
>>> Just keying off the last statement there...
>>>
>>> I think BPF programs are going to be hard to translate into hardware
>>> for most devices. The problem is the BPF programs in general lack
>>> structure. A parse graph would be much more friendly for hardware or
>>> at minimum the BPF program would need to be a some sort of
>>> well-structured program so a driver could turn that into a parse graph.
>>>
>> This might be relevant:
>> http://richard.systems/research/pdf/IEEE_HPSR_BPF_OPENFLOW.pdf
>>
>
> Thanks Tom interesting read but they seem to argue for a BPF engine in
> hardware which I'm still not convinced is necessary and the numbers
> provided are for a 1Gbps link where 10Gpbs/100Gbps+ would be more
> valuable.
>
> I am still leaning towards a fully programmable parse graph and a set
> of basic actions push/pop/set/fwd/etc. This would be useful for other
> features not just checksum offloads. I guess it doesn't necessarily
> exclude also having 1s complement logic though.

;-> I feel a little vindicated with this discussion.

Of course you can implement hardware using BPF! I think there is an
opportunity for someone to build such hardware, if one is not in
progress of being built yet.
A BPF hardware implementation is just a very different approach;
instead of it being a series of TCAM table hardware implementation
(and/or other  types of implementation which use DRAM etc), it becomes
CPU instructions. Surely one can cast the EBPF bytecode into an ASIC.
My disagreement with Tom is laying a stake that this is how hardware
features are to be exposed.
My disagreement with you is laying a stake in the ground that hardware
oughta be implemented using a series of Tubes^WTCAMS.
When i build a graphics card the API is not how the internal 
implementation works. Everbody conforms to the same driver APIs.
Likewise, we have Linux APIs - and switchdev
is the right direction. Write your driver to switchdev interfaces.
Let a thousand flowers bloom.

BTW: It is bordering on the abstraction-ridiculous when I see the
P4 claims to use ebpf and then somehow translate to use
classifier/actions.

cheers,
jamal