[PATCH RFC bpf-next 39/52] net, xdp: make &xdp_attachment_info a bit more useful in drivers

From: Alexander Lobakin
Date: Tue Jun 28 2022 - 15:55:05 EST


Add a new field which will store an arbitrary 'driver cookie', the
closest usage is to store enum there corresponding to the metadata
types supported by a driver to shortcut them on hotpath.
In fact, it's just reusing the 4-byte padding at the end.
Also, make it possible to store BTF ID in LE rather than CPU
byteorder, so that drivers could save some cycles on [potential]
byteswapping on hotpath.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
---
include/net/xdp.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/net/xdp.h b/include/net/xdp.h
index d1fd809655be..5762ce18885f 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -380,8 +380,12 @@ void xdp_unreg_mem_model(struct xdp_mem_info *mem);

struct xdp_attachment_info {
struct bpf_prog *prog;
- u64 btf_id;
+ union {
+ __le64 btf_id_le;
+ u64 btf_id;
+ };
u32 meta_thresh;
+ u32 drv_cookie;
};

struct netdev_bpf;
--
2.36.1