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