Re: [PATCH net-next v4 2/3] virtio_net: add optional flow dissection in virtio_net_hdr_to_skb
From: Jason Wang <hidden>
Date: 2021-06-10 04:14:01
在 2021/6/10 下午12:05, Alexei Starovoitov 写道:
On Wed, Jun 9, 2021 at 8:53 PM Jason Wang [off-list ref] wrote:quoted
It works but it couples virtio with bpf.Jason, I think your main concern is that it makes virtio_net_hdr into uapi?
Actually not. Note that, vnet header is already a part of uAPI (include/uapi/linux/virtio_net.h). The concern is that is may confuse the userspace since we will have two sets of vnet header uapi (and they are already out of sync).
That's not the case. __sk_buff is uapi, but pointers to sockets and other kernel data structures are not. Yes. It's a bit weird that uapi struct has a pointer to kernel internal, but I don't see it as a deal breaker.
Yes, but looking at the existing fields of __sk_buff. All are pretty generic fields that are device agnostic. This patch breaks this.
Tracing progs have plenty of such cases. In networking there is tcp-bpf where everything is kernel internal and non-uapi. So after this patch virtio_net_hdr is free to change without worrying about bpf progs reading it.
So I wonder why not simply use helpers to access the vnet header like how tcp-bpf access the tcp header? Thanks