Blob Blame History Raw
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Tue, 22 Dec 2020 22:09:28 +0100
Patch-mainline: v5.12-rc1
Subject: net, xdp: Introduce xdp_init_buff utility routine
Git-commit: 43b5169d8355ccf26d726fbc75f083b2429113e4
References: bsc#1193507

Introduce xdp_init_buff utility routine to initialize xdp_buff fields
const over NAPI iterations (e.g. frame_sz or rxq pointer). Rely on
xdp_init_buff in all XDP capable drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Shay Agroskin <shayagr@amazon.com>
Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
Acked-by: Marcin Wojtas <mw@semihalf.com>
Link: https://lore.kernel.org/bpf/7f8329b6da1434dc2b05a77f2e800b29628a8913.1608670965.git.lorenzo@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Olaf Hering <ohering@suse.de>
---
 include/net/xdp.h                                   | 7 +++++++
 28 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/include/net/xdp.h b/include/net/xdp.h
index 600acb307db6..8a589f7e08e0 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -76,6 +76,12 @@ struct xdp_buff {
 	u32 flags;
 };
 
+static __always_inline void
+xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq)
+{
+	xdp->rxq = rxq;
+}
+
 struct netdev_bpf;
 int xdp_attachment_query(struct xdp_attachment_info *info,
 			 struct netdev_bpf *bpf);