1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * xdp_diag: interface for query/monitor XDP sockets
4 * Copyright(c) 2019 Intel Corporation.
5 */
6
7#ifndef _LINUX_XDP_DIAG_H
8#define _LINUX_XDP_DIAG_H
9
10#include <linux/types.h>
11
12struct xdp_diag_req {
13	__u8	sdiag_family;
14	__u8	sdiag_protocol;
15	__u16	pad;
16	__u32	xdiag_ino;
17	__u32	xdiag_show;
18	__u32	xdiag_cookie[2];
19};
20
21struct xdp_diag_msg {
22	__u8	xdiag_family;
23	__u8	xdiag_type;
24	__u16	pad;
25	__u32	xdiag_ino;
26	__u32	xdiag_cookie[2];
27};
28
29#define XDP_SHOW_INFO		(1 << 0) /* Basic information */
30#define XDP_SHOW_RING_CFG	(1 << 1)
31#define XDP_SHOW_UMEM		(1 << 2)
32#define XDP_SHOW_MEMINFO	(1 << 3)
33#define XDP_SHOW_STATS		(1 << 4)
34
35enum {
36	XDP_DIAG_NONE,
37	XDP_DIAG_INFO,
38	XDP_DIAG_UID,
39	XDP_DIAG_RX_RING,
40	XDP_DIAG_TX_RING,
41	XDP_DIAG_UMEM,
42	XDP_DIAG_UMEM_FILL_RING,
43	XDP_DIAG_UMEM_COMPLETION_RING,
44	XDP_DIAG_MEMINFO,
45	XDP_DIAG_STATS,
46	__XDP_DIAG_MAX,
47};
48
49#define XDP_DIAG_MAX (__XDP_DIAG_MAX - 1)
50
51struct xdp_diag_info {
52	__u32	ifindex;
53	__u32	queue_id;
54};
55
56struct xdp_diag_ring {
57	__u32	entries; /*num descs */
58};
59
60#define XDP_DU_F_ZEROCOPY (1 << 0)
61
62struct xdp_diag_umem {
63	__u64	size;
64	__u32	id;
65	__u32	num_pages;
66	__u32	chunk_size;
67	__u32	headroom;
68	__u32	ifindex;
69	__u32	queue_id;
70	__u32	flags;
71	__u32	refs;
72};
73
74struct xdp_diag_stats {
75	__u64	n_rx_dropped;
76	__u64	n_rx_invalid;
77	__u64	n_rx_full;
78	__u64	n_fill_ring_empty;
79	__u64	n_tx_invalid;
80	__u64	n_tx_ring_empty;
81};
82
83#endif /* _LINUX_XDP_DIAG_H */
84