Skip to content

Commit 89e4a37

Browse files
Björn TöpelAlexei Starovoitov
authored andcommitted
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: Björn Töpel <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent a71506a commit 89e4a37

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

include/net/xdp_sock.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ struct net_device;
1717
struct xsk_queue;
1818
struct xdp_buff;
1919

20-
/* Masks for xdp_umem_page flags.
21-
* The low 12-bits of the addr will be 0 since this is the page address, so we
22-
* can use them for flags.
23-
*/
24-
#define XSK_NEXT_PG_CONTIG_SHIFT 0
25-
#define XSK_NEXT_PG_CONTIG_MASK (1ULL << XSK_NEXT_PG_CONTIG_SHIFT)
26-
2720
struct xdp_umem_page {
2821
void *addr;
2922
dma_addr_t dma;
@@ -35,13 +28,6 @@ struct xdp_umem_fq_reuse {
3528
u64 handles[];
3629
};
3730

38-
/* Flags for the umem flags field.
39-
*
40-
* The NEED_WAKEUP flag is 1 due to the reuse of the flags field for public
41-
* flags. See inlude/uapi/include/linux/if_xdp.h.
42-
*/
43-
#define XDP_UMEM_USES_NEED_WAKEUP (1 << 1)
44-
4531
struct xdp_umem {
4632
struct xsk_queue *fq;
4733
struct xsk_queue *cq;

net/xdp/xsk.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
#ifndef XSK_H_
55
#define XSK_H_
66

7+
/* Masks for xdp_umem_page flags.
8+
* The low 12-bits of the addr will be 0 since this is the page address, so we
9+
* can use them for flags.
10+
*/
11+
#define XSK_NEXT_PG_CONTIG_SHIFT 0
12+
#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
13+
14+
/* Flags for the umem flags field.
15+
*
16+
* The NEED_WAKEUP flag is 1 due to the reuse of the flags field for public
17+
* flags. See inlude/uapi/include/linux/if_xdp.h.
18+
*/
19+
#define XDP_UMEM_USES_NEED_WAKEUP BIT(1)
20+
721
struct xdp_ring_offset_v1 {
822
__u64 producer;
923
__u64 consumer;

net/xdp/xsk_queue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <linux/if_xdp.h>
1111
#include <net/xdp_sock.h>
1212

13+
#include "xsk.h"
14+
1315
struct xdp_ring {
1416
u32 producer ____cacheline_aligned_in_smp;
1517
u32 consumer ____cacheline_aligned_in_smp;

0 commit comments

Comments
 (0)