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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/xskxceiver.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/bpf/xskxceiver.h (Version linux-6.11.5) and /tools/testing/selftests/bpf/xskxceiver.h (Version linux-6.3.13)


  1 /* SPDX-License-Identifier: GPL-2.0                 1 /* SPDX-License-Identifier: GPL-2.0
  2  * Copyright(c) 2020 Intel Corporation.             2  * Copyright(c) 2020 Intel Corporation.
  3  */                                                 3  */
  4                                                     4 
  5 #ifndef XSKXCEIVER_H_                               5 #ifndef XSKXCEIVER_H_
  6 #define XSKXCEIVER_H_                               6 #define XSKXCEIVER_H_
  7                                                     7 
  8 #include <limits.h>                            << 
  9                                                << 
 10 #include "xsk_xdp_progs.skel.h"                     8 #include "xsk_xdp_progs.skel.h"
 11 #include "xsk_xdp_common.h"                    << 
 12                                                     9 
 13 #ifndef SOL_XDP                                    10 #ifndef SOL_XDP
 14 #define SOL_XDP 283                                11 #define SOL_XDP 283
 15 #endif                                             12 #endif
 16                                                    13 
 17 #ifndef AF_XDP                                     14 #ifndef AF_XDP
 18 #define AF_XDP 44                                  15 #define AF_XDP 44
 19 #endif                                             16 #endif
 20                                                    17 
 21 #ifndef PF_XDP                                     18 #ifndef PF_XDP
 22 #define PF_XDP AF_XDP                              19 #define PF_XDP AF_XDP
 23 #endif                                             20 #endif
 24                                                    21 
 25 #ifndef SO_BUSY_POLL_BUDGET                        22 #ifndef SO_BUSY_POLL_BUDGET
 26 #define SO_BUSY_POLL_BUDGET 70                     23 #define SO_BUSY_POLL_BUDGET 70
 27 #endif                                             24 #endif
 28                                                    25 
 29 #ifndef SO_PREFER_BUSY_POLL                        26 #ifndef SO_PREFER_BUSY_POLL
 30 #define SO_PREFER_BUSY_POLL 69                     27 #define SO_PREFER_BUSY_POLL 69
 31 #endif                                             28 #endif
 32                                                    29 
 33 #define TEST_PASS 0                                30 #define TEST_PASS 0
 34 #define TEST_FAILURE -1                            31 #define TEST_FAILURE -1
 35 #define TEST_CONTINUE 1                            32 #define TEST_CONTINUE 1
 36 #define TEST_SKIP 2                            << 
 37 #define MAX_INTERFACES 2                           33 #define MAX_INTERFACES 2
 38 #define MAX_INTERFACE_NAME_CHARS 16                34 #define MAX_INTERFACE_NAME_CHARS 16
 39 #define MAX_TEST_NAME_SIZE 48                  !!  35 #define MAX_SOCKETS 2
                                                   >>  36 #define MAX_TEST_NAME_SIZE 32
 40 #define MAX_TEARDOWN_ITER 10                       37 #define MAX_TEARDOWN_ITER 10
 41 #define PKT_HDR_SIZE (sizeof(struct ethhdr) +  !!  38 #define PKT_HDR_SIZE (sizeof(struct ethhdr) + sizeof(struct iphdr) + \
 42 #define MIN_PKT_SIZE 64                        !!  39                         sizeof(struct udphdr))
 43 #define MAX_ETH_PKT_SIZE 1518                  !!  40 #define MIN_ETH_PKT_SIZE 64
 44 #define MAX_ETH_JUMBO_SIZE 9000                !!  41 #define ETH_FCS_SIZE 4
                                                   >>  42 #define MIN_PKT_SIZE (MIN_ETH_PKT_SIZE - ETH_FCS_SIZE)
                                                   >>  43 #define PKT_SIZE (MIN_PKT_SIZE)
                                                   >>  44 #define IP_PKT_SIZE (PKT_SIZE - sizeof(struct ethhdr))
                                                   >>  45 #define IP_PKT_VER 0x4
                                                   >>  46 #define IP_PKT_TOS 0x9
                                                   >>  47 #define UDP_PKT_SIZE (IP_PKT_SIZE - sizeof(struct iphdr))
                                                   >>  48 #define UDP_PKT_DATA_SIZE (UDP_PKT_SIZE - sizeof(struct udphdr))
 45 #define USLEEP_MAX 10000                           49 #define USLEEP_MAX 10000
 46 #define SOCK_RECONF_CTR 10                         50 #define SOCK_RECONF_CTR 10
 47 #define DEFAULT_BATCH_SIZE 64                  !!  51 #define BATCH_SIZE 64
 48 #define POLL_TMOUT 1000                            52 #define POLL_TMOUT 1000
 49 #define THREAD_TMOUT 3                             53 #define THREAD_TMOUT 3
 50 #define DEFAULT_PKT_CNT (4 * 1024)                 54 #define DEFAULT_PKT_CNT (4 * 1024)
 51 #define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT      55 #define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4)
 52 #define RX_FULL_RXQSIZE 32                         56 #define RX_FULL_RXQSIZE 32
 53 #define UMEM_HEADROOM_TEST_SIZE 128                57 #define UMEM_HEADROOM_TEST_SIZE 128
 54 #define XSK_UMEM__INVALID_FRAME_SIZE (MAX_ETH_ !!  58 #define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1)
 55 #define XSK_UMEM__LARGE_FRAME_SIZE (3 * 1024)  << 
 56 #define XSK_UMEM__MAX_FRAME_SIZE (4 * 1024)    << 
 57 #define XSK_DESC__INVALID_OPTION (0xffff)      << 
 58 #define XSK_DESC__MAX_SKB_FRAGS 18             << 
 59 #define HUGEPAGE_SIZE (2 * 1024 * 1024)        << 
 60 #define PKT_DUMP_NB_TO_PRINT 16                << 
 61 #define RUN_ALL_TESTS UINT_MAX                 << 
 62 #define NUM_MAC_ADDRESSES 4                    << 
 63                                                    59 
 64 #define print_verbose(x...) do { if (opt_verbo     60 #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0)
 65                                                    61 
 66 enum test_mode {                                   62 enum test_mode {
 67         TEST_MODE_SKB,                             63         TEST_MODE_SKB,
 68         TEST_MODE_DRV,                             64         TEST_MODE_DRV,
 69         TEST_MODE_ZC,                              65         TEST_MODE_ZC,
 70         TEST_MODE_ALL                          !!  66         TEST_MODE_MAX
                                                   >>  67 };
                                                   >>  68 
                                                   >>  69 enum test_type {
                                                   >>  70         TEST_TYPE_RUN_TO_COMPLETION,
                                                   >>  71         TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME,
                                                   >>  72         TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT,
                                                   >>  73         TEST_TYPE_RX_POLL,
                                                   >>  74         TEST_TYPE_TX_POLL,
                                                   >>  75         TEST_TYPE_POLL_RXQ_TMOUT,
                                                   >>  76         TEST_TYPE_POLL_TXQ_TMOUT,
                                                   >>  77         TEST_TYPE_UNALIGNED,
                                                   >>  78         TEST_TYPE_ALIGNED_INV_DESC,
                                                   >>  79         TEST_TYPE_ALIGNED_INV_DESC_2K_FRAME,
                                                   >>  80         TEST_TYPE_UNALIGNED_INV_DESC,
                                                   >>  81         TEST_TYPE_HEADROOM,
                                                   >>  82         TEST_TYPE_TEARDOWN,
                                                   >>  83         TEST_TYPE_BIDI,
                                                   >>  84         TEST_TYPE_STATS_RX_DROPPED,
                                                   >>  85         TEST_TYPE_STATS_TX_INVALID_DESCS,
                                                   >>  86         TEST_TYPE_STATS_RX_FULL,
                                                   >>  87         TEST_TYPE_STATS_FILL_EMPTY,
                                                   >>  88         TEST_TYPE_BPF_RES,
                                                   >>  89         TEST_TYPE_XDP_DROP_HALF,
                                                   >>  90         TEST_TYPE_MAX
 71 };                                                 91 };
 72                                                    92 
                                                   >>  93 static bool opt_pkt_dump;
                                                   >>  94 static bool opt_verbose;
                                                   >>  95 
 73 struct xsk_umem_info {                             96 struct xsk_umem_info {
 74         struct xsk_ring_prod fq;                   97         struct xsk_ring_prod fq;
 75         struct xsk_ring_cons cq;                   98         struct xsk_ring_cons cq;
 76         struct xsk_umem *umem;                     99         struct xsk_umem *umem;
 77         u64 next_buffer;                       << 
 78         u32 num_frames;                           100         u32 num_frames;
 79         u32 frame_headroom;                       101         u32 frame_headroom;
 80         void *buffer;                             102         void *buffer;
 81         u32 frame_size;                           103         u32 frame_size;
 82         u32 base_addr;                            104         u32 base_addr;
 83         u32 fill_size;                         << 
 84         u32 comp_size;                         << 
 85         bool unaligned_mode;                      105         bool unaligned_mode;
 86 };                                                106 };
 87                                                   107 
 88 struct xsk_socket_info {                          108 struct xsk_socket_info {
 89         struct xsk_ring_cons rx;                  109         struct xsk_ring_cons rx;
 90         struct xsk_ring_prod tx;                  110         struct xsk_ring_prod tx;
 91         struct xsk_umem_info *umem;               111         struct xsk_umem_info *umem;
 92         struct xsk_socket *xsk;                   112         struct xsk_socket *xsk;
 93         struct pkt_stream *pkt_stream;         << 
 94         u32 outstanding_tx;                       113         u32 outstanding_tx;
 95         u32 rxqsize;                              114         u32 rxqsize;
 96         u32 batch_size;                        << 
 97         u8 dst_mac[ETH_ALEN];                  << 
 98         u8 src_mac[ETH_ALEN];                  << 
 99 };                                                115 };
100                                                   116 
101 struct pkt {                                      117 struct pkt {
102         int offset;                            !! 118         u64 addr;
103         u32 len;                                  119         u32 len;
104         u32 pkt_nb;                            !! 120         u32 payload;
105         bool valid;                               121         bool valid;
106         u16 options;                           << 
107 };                                                122 };
108                                                   123 
109 struct pkt_stream {                               124 struct pkt_stream {
110         u32 nb_pkts;                              125         u32 nb_pkts;
111         u32 current_pkt_nb;                    !! 126         u32 rx_pkt_nb;
112         struct pkt *pkts;                         127         struct pkt *pkts;
113         u32 max_pkt_len;                       !! 128         bool use_addr_for_fill;
114         u32 nb_rx_pkts;                        << 
115         u32 nb_valid_entries;                  << 
116         bool verbatim;                         << 
117 };                                             << 
118                                                << 
119 struct set_hw_ring {                           << 
120         u32 default_tx;                        << 
121         u32 default_rx;                        << 
122 };                                                129 };
123                                                   130 
124 struct ifobject;                                  131 struct ifobject;
125 struct test_spec;                              << 
126 typedef int (*validation_func_t)(struct ifobje    132 typedef int (*validation_func_t)(struct ifobject *ifobj);
127 typedef void *(*thread_func_t)(void *arg);        133 typedef void *(*thread_func_t)(void *arg);
128 typedef int (*test_func_t)(struct test_spec *t << 
129                                                   134 
130 struct ifobject {                                 135 struct ifobject {
131         char ifname[MAX_INTERFACE_NAME_CHARS];    136         char ifname[MAX_INTERFACE_NAME_CHARS];
132         struct xsk_socket_info *xsk;              137         struct xsk_socket_info *xsk;
133         struct xsk_socket_info *xsk_arr;          138         struct xsk_socket_info *xsk_arr;
134         struct xsk_umem_info *umem;               139         struct xsk_umem_info *umem;
135         thread_func_t func_ptr;                   140         thread_func_t func_ptr;
136         validation_func_t validation_func;        141         validation_func_t validation_func;
                                                   >> 142         struct pkt_stream *pkt_stream;
137         struct xsk_xdp_progs *xdp_progs;          143         struct xsk_xdp_progs *xdp_progs;
138         struct bpf_map *xskmap;                   144         struct bpf_map *xskmap;
139         struct bpf_program *xdp_prog;             145         struct bpf_program *xdp_prog;
140         struct ethtool_ringparam ring;         << 
141         struct set_hw_ring set_ring;           << 
142         enum test_mode mode;                      146         enum test_mode mode;
143         int ifindex;                              147         int ifindex;
144         int mtu;                               !! 148         u32 dst_ip;
                                                   >> 149         u32 src_ip;
145         u32 bind_flags;                           150         u32 bind_flags;
146         u32 xdp_zc_max_segs;                   !! 151         u16 src_port;
                                                   >> 152         u16 dst_port;
147         bool tx_on;                               153         bool tx_on;
148         bool rx_on;                               154         bool rx_on;
149         bool use_poll;                            155         bool use_poll;
150         bool busy_poll;                           156         bool busy_poll;
151         bool use_fill_ring;                       157         bool use_fill_ring;
152         bool release_rx;                          158         bool release_rx;
153         bool shared_umem;                         159         bool shared_umem;
154         bool use_metadata;                     !! 160         u8 dst_mac[ETH_ALEN];
155         bool unaligned_supp;                   !! 161         u8 src_mac[ETH_ALEN];
156         bool multi_buff_supp;                  << 
157         bool multi_buff_zc_supp;               << 
158         bool hw_ring_size_supp;                << 
159 };                                                162 };
160                                                   163 
161 struct test_spec {                                164 struct test_spec {
162         struct ifobject *ifobj_tx;                165         struct ifobject *ifobj_tx;
163         struct ifobject *ifobj_rx;                166         struct ifobject *ifobj_rx;
164         struct pkt_stream *tx_pkt_stream_defau    167         struct pkt_stream *tx_pkt_stream_default;
165         struct pkt_stream *rx_pkt_stream_defau    168         struct pkt_stream *rx_pkt_stream_default;
166         struct bpf_program *xdp_prog_rx;          169         struct bpf_program *xdp_prog_rx;
167         struct bpf_program *xdp_prog_tx;          170         struct bpf_program *xdp_prog_tx;
168         struct bpf_map *xskmap_rx;                171         struct bpf_map *xskmap_rx;
169         struct bpf_map *xskmap_tx;                172         struct bpf_map *xskmap_tx;
170         test_func_t test_func;                 << 
171         int mtu;                               << 
172         u16 total_steps;                          173         u16 total_steps;
173         u16 current_step;                         174         u16 current_step;
174         u16 nb_sockets;                           175         u16 nb_sockets;
175         bool fail;                                176         bool fail;
176         bool set_ring;                         << 
177         enum test_mode mode;                      177         enum test_mode mode;
178         char name[MAX_TEST_NAME_SIZE];            178         char name[MAX_TEST_NAME_SIZE];
179 };                                                179 };
180                                                   180 
181 pthread_barrier_t barr;                           181 pthread_barrier_t barr;
182 pthread_mutex_t pacing_mutex = PTHREAD_MUTEX_I    182 pthread_mutex_t pacing_mutex = PTHREAD_MUTEX_INITIALIZER;
                                                   >> 183 pthread_cond_t pacing_cond = PTHREAD_COND_INITIALIZER;
183                                                   184 
184 int pkts_in_flight;                               185 int pkts_in_flight;
185                                                << 
186 static const u8 g_mac[ETH_ALEN] = {0x55, 0x44, << 
187                                                   186 
188 #endif                          /* XSKXCEIVER_    187 #endif                          /* XSKXCEIVER_H_ */
189                                                   188 

~ [ 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