bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn.topel@gmail.com>
To: ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
	kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	magnus.karlsson@intel.com, jonathan.lemon@gmail.com,
	jeffrey.t.kirsher@intel.com
Cc: "Björn Töpel" <bjorn.topel@intel.com>,
	maximmi@mellanox.com, maciej.fijalkowski@intel.com
Subject: [PATCH bpf-next v4 04/15] xsk: move defines only used by AF_XDP internals to xsk.h
Date: Wed, 20 May 2020 11:47:31 +0200	[thread overview]
Message-ID: <20200520094742.337678-5-bjorn.topel@gmail.com> (raw)
In-Reply-To: <20200520094742.337678-1-bjorn.topel@gmail.com>

From: Björn Töpel <bjorn.topel@intel.com>

Move the XSK_NEXT_PG_CONTIG_{MASK,SHIFT}, and
XDP_UMEM_USES_NEED_WAKEUP defines from xdp_sock.h to the AF_XDP
internal xsk.h file. Also, start using the BIT{,_ULL} macro instead of
explicit shifts.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
 include/net/xdp_sock.h | 14 --------------
 net/xdp/xsk.h          | 14 ++++++++++++++
 net/xdp/xsk_queue.h    |  2 ++
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index 6a986dcbc336..fb7fe3060175 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -17,13 +17,6 @@ struct net_device;
 struct xsk_queue;
 struct xdp_buff;
 
-/* Masks for xdp_umem_page flags.
- * The low 12-bits of the addr will be 0 since this is the page address, so we
- * can use them for flags.
- */
-#define XSK_NEXT_PG_CONTIG_SHIFT 0
-#define XSK_NEXT_PG_CONTIG_MASK (1ULL << XSK_NEXT_PG_CONTIG_SHIFT)
-
 struct xdp_umem_page {
 	void *addr;
 	dma_addr_t dma;
@@ -35,13 +28,6 @@ struct xdp_umem_fq_reuse {
 	u64 handles[];
 };
 
-/* Flags for the umem flags field.
- *
- * The NEED_WAKEUP flag is 1 due to the reuse of the flags field for public
- * flags. See inlude/uapi/include/linux/if_xdp.h.
- */
-#define XDP_UMEM_USES_NEED_WAKEUP (1 << 1)
-
 struct xdp_umem {
 	struct xsk_queue *fq;
 	struct xsk_queue *cq;
diff --git a/net/xdp/xsk.h b/net/xdp/xsk.h
index d6a0979050e6..455ddd480f3d 100644
--- a/net/xdp/xsk.h
+++ b/net/xdp/xsk.h
@@ -4,6 +4,20 @@
 #ifndef XSK_H_
 #define XSK_H_
 
+/* Masks for xdp_umem_page flags.
+ * The low 12-bits of the addr will be 0 since this is the page address, so we
+ * can use them for flags.
+ */
+#define XSK_NEXT_PG_CONTIG_SHIFT 0
+#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
+
+/* Flags for the umem flags field.
+ *
+ * The NEED_WAKEUP flag is 1 due to the reuse of the flags field for public
+ * flags. See inlude/uapi/include/linux/if_xdp.h.
+ */
+#define XDP_UMEM_USES_NEED_WAKEUP BIT(1)
+
 struct xdp_ring_offset_v1 {
 	__u64 producer;
 	__u64 consumer;
diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h
index 648733ec24ac..a322a7dac58c 100644
--- a/net/xdp/xsk_queue.h
+++ b/net/xdp/xsk_queue.h
@@ -10,6 +10,8 @@
 #include <linux/if_xdp.h>
 #include <net/xdp_sock.h>
 
+#include "xsk.h"
+
 struct xdp_ring {
 	u32 producer ____cacheline_aligned_in_smp;
 	u32 consumer ____cacheline_aligned_in_smp;
-- 
2.25.1


  parent reply	other threads:[~2020-05-20  9:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  9:47 [PATCH bpf-next v4 00/15] Introduce AF_XDP buffer allocation API Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 01/15] xsk: fix xsk_umem_xdp_frame_sz() Björn Töpel
2020-05-20 13:18   ` Jesper Dangaard Brouer
2020-05-20 14:34     ` Björn Töpel
2020-05-21  4:29       ` Jesper Dangaard Brouer
2020-05-21 18:06         ` Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 02/15] xsk: move xskmap.c to net/xdp/ Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 03/15] xsk: move driver interface to xdp_sock_drv.h Björn Töpel
2020-05-20 16:57   ` Jakub Kicinski
2020-05-20 17:18     ` Björn Töpel
2020-05-20  9:47 ` Björn Töpel [this message]
2020-05-20  9:47 ` [PATCH bpf-next v4 05/15] xsk: introduce AF_XDP buffer allocation API Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 06/15] i40e: refactor rx_bi accesses Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 07/15] i40e: separate kernel allocated rx_bi rings from AF_XDP rings Björn Töpel
2020-05-20 17:02   ` Jakub Kicinski
2020-05-20 17:19     ` Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 08/15] i40e, xsk: migrate to new MEM_TYPE_XSK_BUFF_POOL Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 09/15] ice, " Björn Töpel
2020-05-20 17:03   ` Jakub Kicinski
2020-05-20 17:20     ` Björn Töpel
2020-05-20 18:49     ` Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 10/15] ixgbe, " Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 11/15] mlx5, " Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 12/15] xsk: remove MEM_TYPE_ZERO_COPY and corresponding code Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 13/15] xdp: simplify xdp_return_{frame,frame_rx_napi,buff} Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 14/15] xsk: explicitly inline functions and move definitions Björn Töpel
2020-05-20  9:47 ` [PATCH bpf-next v4 15/15] MAINTAINERS, xsk: update AF_XDP section after moves/adds Björn Töpel

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=20200520094742.337678-5-bjorn.topel@gmail.com \
    --to=bjorn.topel@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /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).