bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, davem@davemloft.net, ast@kernel.org,
	brouer@redhat.com, daniel@iogearbox.net,
	lorenzo.bianconi@redhat.com, echaudro@redhat.com,
	sameehj@amazon.com, kuba@kernel.org
Subject: [RFC net-next 01/22] xdp: introduce mb in xdp_buff/xdp_frame
Date: Thu, 23 Jul 2020 13:42:13 +0200	[thread overview]
Message-ID: <1d3c0f39d41fd8268523c190c36fa7934d3b2e01.1595503780.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1595503780.git.lorenzo@kernel.org>

Introduce multi-buffer bit (mb) in xdp_frame/xdp_buffer to specify
if shared_info area has been properly initialized for non-linear
xdp buffers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 include/net/xdp.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/net/xdp.h b/include/net/xdp.h
index dbe9c60797e1..2ef6935c5646 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -72,7 +72,8 @@ struct xdp_buff {
 	void *data_hard_start;
 	struct xdp_rxq_info *rxq;
 	struct xdp_txq_info *txq;
-	u32 frame_sz; /* frame size to deduce data_hard_end/reserved tailroom*/
+	u32 frame_sz:31; /* frame size to deduce data_hard_end/reserved tailroom*/
+	u32 mb:1; /* xdp non-linear buffer */
 };
 
 /* Reserve memory area at end-of data area.
@@ -96,7 +97,8 @@ struct xdp_frame {
 	u16 len;
 	u16 headroom;
 	u32 metasize:8;
-	u32 frame_sz:24;
+	u32 frame_sz:23;
+	u32 mb:1; /* xdp non-linear frame */
 	/* Lifetime of xdp_rxq_info is limited to NAPI/enqueue time,
 	 * while mem info is valid on remote CPU.
 	 */
@@ -141,6 +143,7 @@ void xdp_convert_frame_to_buff(struct xdp_frame *frame, struct xdp_buff *xdp)
 	xdp->data_end = frame->data + frame->len;
 	xdp->data_meta = frame->data - frame->metasize;
 	xdp->frame_sz = frame->frame_sz;
+	xdp->mb = frame->mb;
 }
 
 static inline
@@ -167,6 +170,7 @@ int xdp_update_frame_from_buff(struct xdp_buff *xdp,
 	xdp_frame->headroom = headroom - sizeof(*xdp_frame);
 	xdp_frame->metasize = metasize;
 	xdp_frame->frame_sz = xdp->frame_sz;
+	xdp_frame->mb = xdp->mb;
 
 	return 0;
 }
-- 
2.26.2


  reply	other threads:[~2020-07-23 11:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 11:42 [RFC net-next 00/22] Introduce mb bit in xdp_buff/xdp_frame Lorenzo Bianconi
2020-07-23 11:42 ` Lorenzo Bianconi [this message]
2020-07-23 13:51   ` [RFC net-next 01/22] xdp: introduce mb " Jubran, Samih
2020-07-23 11:42 ` [RFC net-next 02/22] xdp: initialize xdp_buff mb bit to 0 in netif_receive_generic_xdp Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 03/22] net: virtio_net: initialize mb bit of xdp_buff to 0 Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 04/22] net: xen-netfront: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 05/22] net: veth: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 06/22] net: hv_netvsc: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 07/22] net: bnxt: initialize mb bit in " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 08/22] net: dpaa2: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 09/22] net: ti: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 10/22] net: nfp: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 11/22] net: mvpp2: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 12/22] net: sfc: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 13/22] net: qede: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 14/22] net: amazon: ena: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 15/22] net: cavium: thunder: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 16/22] net: socionext: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 17/22] net: tun: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 18/22] net: ixgbe: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 19/22] net: ice: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 20/22] net: i40e: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 21/22] net: mlx5: " Lorenzo Bianconi
2020-07-23 11:42 ` [RFC net-next 22/22] net: mlx4: " Lorenzo Bianconi
2020-07-28 14:48 ` [RFC net-next 00/22] Introduce mb bit in xdp_buff/xdp_frame Jesper Dangaard Brouer
2020-07-28 15:10   ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d3c0f39d41fd8268523c190c36fa7934d3b2e01.1595503780.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=echaudro@redhat.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sameehj@amazon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).