在 2021/6/10 下午12:19, Alexei Starovoitov 写道:
On Wed, Jun 9, 2021 at 9:13 PM Jason Wang [off-list ref] wrote:
quoted
So I wonder why not simply use helpers to access the vnet header like
how tcp-bpf access the tcp header?
Short answer - speed.
tcp-bpf accesses all uapi and non-uapi structs directly.
Ok, this makes sense. But instead of coupling device specific stuffs like vnet header and neediness into general flow_keys as a context.
It would be better to introduce a vnet header context which contains
1) vnet header
2) flow keys
3) other contexts like endian and virtio-net features
So we preserve the performance and decouple the virtio-net stuffs from general structures like flow_keys or __sk_buff.
Thanks