Commit 89e4a376 authored by Björn Töpel's avatar Björn Töpel Committed by Alexei Starovoitov

xsk: Move defines only used by AF_XDP internals to xsk.h

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: default avatarBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200520192103.355233-5-bjorn.topel@gmail.com
parent a71506a4
...@@ -17,13 +17,6 @@ struct net_device; ...@@ -17,13 +17,6 @@ struct net_device;
struct xsk_queue; struct xsk_queue;
struct xdp_buff; 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 { struct xdp_umem_page {
void *addr; void *addr;
dma_addr_t dma; dma_addr_t dma;
...@@ -35,13 +28,6 @@ struct xdp_umem_fq_reuse { ...@@ -35,13 +28,6 @@ struct xdp_umem_fq_reuse {
u64 handles[]; 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 xdp_umem {
struct xsk_queue *fq; struct xsk_queue *fq;
struct xsk_queue *cq; struct xsk_queue *cq;
......
...@@ -4,6 +4,20 @@ ...@@ -4,6 +4,20 @@
#ifndef XSK_H_ #ifndef XSK_H_
#define 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 { struct xdp_ring_offset_v1 {
__u64 producer; __u64 producer;
__u64 consumer; __u64 consumer;
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <linux/if_xdp.h> #include <linux/if_xdp.h>
#include <net/xdp_sock.h> #include <net/xdp_sock.h>
#include "xsk.h"
struct xdp_ring { struct xdp_ring {
u32 producer ____cacheline_aligned_in_smp; u32 producer ____cacheline_aligned_in_smp;
u32 consumer ____cacheline_aligned_in_smp; u32 consumer ____cacheline_aligned_in_smp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment