~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/if_xdp.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/uapi/linux/if_xdp.h (Architecture sparc) and /include/uapi/linux/if_xdp.h (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux      1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 /*                                                  2 /*
  3  * if_xdp: XDP socket user-space interface          3  * if_xdp: XDP socket user-space interface
  4  * Copyright(c) 2018 Intel Corporation.             4  * Copyright(c) 2018 Intel Corporation.
  5  *                                                  5  *
  6  * Author(s): Björn Töpel <bjorn.topel@intel      6  * Author(s): Björn Töpel <bjorn.topel@intel.com>
  7  *            Magnus Karlsson <magnus.karlsson      7  *            Magnus Karlsson <magnus.karlsson@intel.com>
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef _LINUX_IF_XDP_H                            10 #ifndef _LINUX_IF_XDP_H
 11 #define _LINUX_IF_XDP_H                            11 #define _LINUX_IF_XDP_H
 12                                                    12 
 13 #include <linux/types.h>                           13 #include <linux/types.h>
 14                                                    14 
 15 /* Options for the sxdp_flags field */             15 /* Options for the sxdp_flags field */
 16 #define XDP_SHARED_UMEM (1 << 0)                   16 #define XDP_SHARED_UMEM (1 << 0)
 17 #define XDP_COPY        (1 << 1) /* Force copy     17 #define XDP_COPY        (1 << 1) /* Force copy-mode */
 18 #define XDP_ZEROCOPY    (1 << 2) /* Force zero     18 #define XDP_ZEROCOPY    (1 << 2) /* Force zero-copy mode */
 19 /* If this option is set, the driver might go      19 /* If this option is set, the driver might go sleep and in that case
 20  * the XDP_RING_NEED_WAKEUP flag in the fill a     20  * the XDP_RING_NEED_WAKEUP flag in the fill and/or Tx rings will be
 21  * set. If it is set, the application need to      21  * set. If it is set, the application need to explicitly wake up the
 22  * driver with a poll() (Rx and Tx) or sendto(     22  * driver with a poll() (Rx and Tx) or sendto() (Tx only). If you are
 23  * running the driver and the application on t     23  * running the driver and the application on the same core, you should
 24  * use this option so that the kernel will yie     24  * use this option so that the kernel will yield to the user space
 25  * application.                                    25  * application.
 26  */                                                26  */
 27 #define XDP_USE_NEED_WAKEUP (1 << 3)               27 #define XDP_USE_NEED_WAKEUP (1 << 3)
 28 /* By setting this option, userspace applicati     28 /* By setting this option, userspace application indicates that it can
 29  * handle multiple descriptors per packet thus     29  * handle multiple descriptors per packet thus enabling AF_XDP to split
 30  * multi-buffer XDP frames into multiple Rx de     30  * multi-buffer XDP frames into multiple Rx descriptors. Without this set
 31  * such frames will be dropped.                    31  * such frames will be dropped.
 32  */                                                32  */
 33 #define XDP_USE_SG      (1 << 4)                   33 #define XDP_USE_SG      (1 << 4)
 34                                                    34 
 35 /* Flags for xsk_umem_config flags */              35 /* Flags for xsk_umem_config flags */
 36 #define XDP_UMEM_UNALIGNED_CHUNK_FLAG   (1 <<      36 #define XDP_UMEM_UNALIGNED_CHUNK_FLAG   (1 << 0)
 37                                                    37 
 38 /* Force checksum calculation in software. Can     38 /* Force checksum calculation in software. Can be used for testing or
 39  * working around potential HW issues. This op     39  * working around potential HW issues. This option causes performance
 40  * degradation and only works in XDP_COPY mode     40  * degradation and only works in XDP_COPY mode.
 41  */                                                41  */
 42 #define XDP_UMEM_TX_SW_CSUM             (1 <<      42 #define XDP_UMEM_TX_SW_CSUM             (1 << 1)
 43                                                    43 
 44 /* Request to reserve tx_metadata_len bytes of     44 /* Request to reserve tx_metadata_len bytes of per-chunk metadata.
 45  */                                                45  */
 46 #define XDP_UMEM_TX_METADATA_LEN        (1 <<      46 #define XDP_UMEM_TX_METADATA_LEN        (1 << 2)
 47                                                    47 
 48 struct sockaddr_xdp {                              48 struct sockaddr_xdp {
 49         __u16 sxdp_family;                         49         __u16 sxdp_family;
 50         __u16 sxdp_flags;                          50         __u16 sxdp_flags;
 51         __u32 sxdp_ifindex;                        51         __u32 sxdp_ifindex;
 52         __u32 sxdp_queue_id;                       52         __u32 sxdp_queue_id;
 53         __u32 sxdp_shared_umem_fd;                 53         __u32 sxdp_shared_umem_fd;
 54 };                                                 54 };
 55                                                    55 
 56 /* XDP_RING flags */                               56 /* XDP_RING flags */
 57 #define XDP_RING_NEED_WAKEUP (1 << 0)              57 #define XDP_RING_NEED_WAKEUP (1 << 0)
 58                                                    58 
 59 struct xdp_ring_offset {                           59 struct xdp_ring_offset {
 60         __u64 producer;                            60         __u64 producer;
 61         __u64 consumer;                            61         __u64 consumer;
 62         __u64 desc;                                62         __u64 desc;
 63         __u64 flags;                               63         __u64 flags;
 64 };                                                 64 };
 65                                                    65 
 66 struct xdp_mmap_offsets {                          66 struct xdp_mmap_offsets {
 67         struct xdp_ring_offset rx;                 67         struct xdp_ring_offset rx;
 68         struct xdp_ring_offset tx;                 68         struct xdp_ring_offset tx;
 69         struct xdp_ring_offset fr; /* Fill */      69         struct xdp_ring_offset fr; /* Fill */
 70         struct xdp_ring_offset cr; /* Completi     70         struct xdp_ring_offset cr; /* Completion */
 71 };                                                 71 };
 72                                                    72 
 73 /* XDP socket options */                           73 /* XDP socket options */
 74 #define XDP_MMAP_OFFSETS                1          74 #define XDP_MMAP_OFFSETS                1
 75 #define XDP_RX_RING                     2          75 #define XDP_RX_RING                     2
 76 #define XDP_TX_RING                     3          76 #define XDP_TX_RING                     3
 77 #define XDP_UMEM_REG                    4          77 #define XDP_UMEM_REG                    4
 78 #define XDP_UMEM_FILL_RING              5          78 #define XDP_UMEM_FILL_RING              5
 79 #define XDP_UMEM_COMPLETION_RING        6          79 #define XDP_UMEM_COMPLETION_RING        6
 80 #define XDP_STATISTICS                  7          80 #define XDP_STATISTICS                  7
 81 #define XDP_OPTIONS                     8          81 #define XDP_OPTIONS                     8
 82                                                    82 
 83 struct xdp_umem_reg {                              83 struct xdp_umem_reg {
 84         __u64 addr; /* Start of packet data ar     84         __u64 addr; /* Start of packet data area */
 85         __u64 len; /* Length of packet data ar     85         __u64 len; /* Length of packet data area */
 86         __u32 chunk_size;                          86         __u32 chunk_size;
 87         __u32 headroom;                            87         __u32 headroom;
 88         __u32 flags;                               88         __u32 flags;
 89         __u32 tx_metadata_len;                     89         __u32 tx_metadata_len;
 90 };                                                 90 };
 91                                                    91 
 92 struct xdp_statistics {                            92 struct xdp_statistics {
 93         __u64 rx_dropped; /* Dropped for other     93         __u64 rx_dropped; /* Dropped for other reasons */
 94         __u64 rx_invalid_descs; /* Dropped due     94         __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */
 95         __u64 tx_invalid_descs; /* Dropped due     95         __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */
 96         __u64 rx_ring_full; /* Dropped due to      96         __u64 rx_ring_full; /* Dropped due to rx ring being full */
 97         __u64 rx_fill_ring_empty_descs; /* Fai     97         __u64 rx_fill_ring_empty_descs; /* Failed to retrieve item from fill ring */
 98         __u64 tx_ring_empty_descs; /* Failed t     98         __u64 tx_ring_empty_descs; /* Failed to retrieve item from tx ring */
 99 };                                                 99 };
100                                                   100 
101 struct xdp_options {                              101 struct xdp_options {
102         __u32 flags;                              102         __u32 flags;
103 };                                                103 };
104                                                   104 
105 /* Flags for the flags field of struct xdp_opt    105 /* Flags for the flags field of struct xdp_options */
106 #define XDP_OPTIONS_ZEROCOPY (1 << 0)             106 #define XDP_OPTIONS_ZEROCOPY (1 << 0)
107                                                   107 
108 /* Pgoff for mmaping the rings */                 108 /* Pgoff for mmaping the rings */
109 #define XDP_PGOFF_RX_RING                         109 #define XDP_PGOFF_RX_RING                         0
110 #define XDP_PGOFF_TX_RING                0x800    110 #define XDP_PGOFF_TX_RING                0x80000000
111 #define XDP_UMEM_PGOFF_FILL_RING        0x1000    111 #define XDP_UMEM_PGOFF_FILL_RING        0x100000000ULL
112 #define XDP_UMEM_PGOFF_COMPLETION_RING  0x1800    112 #define XDP_UMEM_PGOFF_COMPLETION_RING  0x180000000ULL
113                                                   113 
114 /* Masks for unaligned chunks mode */             114 /* Masks for unaligned chunks mode */
115 #define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48         115 #define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
116 #define XSK_UNALIGNED_BUF_ADDR_MASK \             116 #define XSK_UNALIGNED_BUF_ADDR_MASK \
117         ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHI    117         ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
118                                                   118 
119 /* Request transmit timestamp. Upon completion    119 /* Request transmit timestamp. Upon completion, put it into tx_timestamp
120  * field of struct xsk_tx_metadata.               120  * field of struct xsk_tx_metadata.
121  */                                               121  */
122 #define XDP_TXMD_FLAGS_TIMESTAMP                  122 #define XDP_TXMD_FLAGS_TIMESTAMP                (1 << 0)
123                                                   123 
124 /* Request transmit checksum offload. Checksum    124 /* Request transmit checksum offload. Checksum start position and offset
125  * are communicated via csum_start and csum_of    125  * are communicated via csum_start and csum_offset fields of struct
126  * xsk_tx_metadata.                               126  * xsk_tx_metadata.
127  */                                               127  */
128 #define XDP_TXMD_FLAGS_CHECKSUM                   128 #define XDP_TXMD_FLAGS_CHECKSUM                 (1 << 1)
129                                                   129 
130 /* AF_XDP offloads request. 'request' union me    130 /* AF_XDP offloads request. 'request' union member is consumed by the driver
131  * when the packet is being transmitted. 'comp    131  * when the packet is being transmitted. 'completion' union member is
132  * filled by the driver when the transmit comp    132  * filled by the driver when the transmit completion arrives.
133  */                                               133  */
134 struct xsk_tx_metadata {                          134 struct xsk_tx_metadata {
135         __u64 flags;                              135         __u64 flags;
136                                                   136 
137         union {                                   137         union {
138                 struct {                          138                 struct {
139                         /* XDP_TXMD_FLAGS_CHEC    139                         /* XDP_TXMD_FLAGS_CHECKSUM */
140                                                   140 
141                         /* Offset from desc->a    141                         /* Offset from desc->addr where checksumming should start. */
142                         __u16 csum_start;         142                         __u16 csum_start;
143                         /* Offset from csum_st    143                         /* Offset from csum_start where checksum should be stored. */
144                         __u16 csum_offset;        144                         __u16 csum_offset;
145                 } request;                        145                 } request;
146                                                   146 
147                 struct {                          147                 struct {
148                         /* XDP_TXMD_FLAGS_TIME    148                         /* XDP_TXMD_FLAGS_TIMESTAMP */
149                         __u64 tx_timestamp;       149                         __u64 tx_timestamp;
150                 } completion;                     150                 } completion;
151         };                                        151         };
152 };                                                152 };
153                                                   153 
154 /* Rx/Tx descriptor */                            154 /* Rx/Tx descriptor */
155 struct xdp_desc {                                 155 struct xdp_desc {
156         __u64 addr;                               156         __u64 addr;
157         __u32 len;                                157         __u32 len;
158         __u32 options;                            158         __u32 options;
159 };                                                159 };
160                                                   160 
161 /* UMEM descriptor is __u64 */                    161 /* UMEM descriptor is __u64 */
162                                                   162 
163 /* Flag indicating that the packet continues w    163 /* Flag indicating that the packet continues with the buffer pointed out by the
164  * next frame in the ring. The end of the pack    164  * next frame in the ring. The end of the packet is signalled by setting this
165  * bit to zero. For single buffer packets, eve    165  * bit to zero. For single buffer packets, every descriptor has 'options' set
166  * to 0 and this maintains backward compatibil    166  * to 0 and this maintains backward compatibility.
167  */                                               167  */
168 #define XDP_PKT_CONTD (1 << 0)                    168 #define XDP_PKT_CONTD (1 << 0)
169                                                   169 
170 /* TX packet carries valid metadata. */           170 /* TX packet carries valid metadata. */
171 #define XDP_TX_METADATA (1 << 1)                  171 #define XDP_TX_METADATA (1 << 1)
172                                                   172 
173 #endif /* _LINUX_IF_XDP_H */                      173 #endif /* _LINUX_IF_XDP_H */
174                                                   174 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php