Debian Codegraph @

src/xdp.h

raw symbols SCIP
1 /* SPDX-License-Identifier: BSD-2-Clause */cxx . . $ `<file>/src/xdp.h`/
2 /*
3 * Copyright (C) 2021-2025 Linutronix GmbH
4 * Author Kurt Kanzenbach <[email protected]>
5 */
6
7 #ifndef _XDP_H_
8 #define _XDP_H_cxx . . $ `src/xdp.h:8:9`!
9
10 #include <stdbool.h>
11 #include <stddef.h>
12 #include <stdint.h>
13
14 #include <linux/if_xdp.h>
15
16 #include "app_config.h"cxx . . $ `<file>/build/app_config.h`/
17
18 #include <bpf/bpf.h>
19 #include <bpf/libbpf.h>
20
21 #include <xdp/libxdp.h>
22 #include <xdp/xsk.h>
23
24 #include "security.h"cxx . . $ `<file>/src/security.h`/
25 #include "stat.h"cxx . . $ `<file>/src/stat.h`/
26
27 #undef XSK_RING_CONS__DEFAULT_NUM_DESCScxx . . $ `<external>/415317370273191247/xsk.h:191:9`!
28 #undef XSK_RING_PROD__DEFAULT_NUM_DESCScxx . . $ `<external>/415317370273191247/xsk.h:192:9`!
29 #define XSK_RING_CONS__DEFAULT_NUM_DESCScxx . . $ `src/xdp.h:29:9`! 4096
30 #define XSK_RING_PROD__DEFAULT_NUM_DESCScxx . . $ `src/xdp.h:30:9`! 4096
31
32 #define XDP_BATCH_SIZEcxx . . $ `src/xdp.h:32:9`! 512
33 #define XDP_NUM_FRAMEScxx . . $ `src/xdp.h:33:9`! (XSK_RING_CONS__DEFAULT_NUM_DESCS + XSK_RING_PROD__DEFAULT_NUM_DESCS)
34 #define XDP_FRAME_SIZEcxx . . $ `src/xdp.h:34:9`! XSK_UMEM__DEFAULT_FRAME_SIZEcxx . . $ `<external>/415317370273191247/xsk.h:194:9`!
35
36 struct xsk_umem_infocxx . . $ xsk_umem_info# {
37 struct xsk_ring_prodcxx . . $ xsk_ring_prod# fqcxx . . $ xsk_umem_info#fq.;
38 struct xsk_ring_conscxx . . $ xsk_ring_cons# cqcxx . . $ xsk_umem_info#cq.;
39 struct xsk_umemcxx . . $ xsk_umem# *umemcxx . . $ xsk_umem_info#umem.;
40 void *buffercxx . . $ xsk_umem_info#buffer.;
41 };
42
43 struct xdp_tx_hwtscxx . . $ xdp_tx_hwts# {
44 /* Store HW timestamps from AF_XDP completion queue */
45 struct round_trip_contextcxx . . $ round_trip_context# *rttcxx . . $ xdp_tx_hwts#rtt.;
46 /* Sequence number for TX HW timestamp (available one cycle later) */
47 int64_tcxx . . $ int64_t# seq_laggedcxx . . $ xdp_tx_hwts#seq_lagged.;
48 /* Counter for tracking TX HW timestamp completions in current cycle (max 2: first+last) */
49 uint32_tcxx . . $ uint32_t# countcxx . . $ xdp_tx_hwts#count.;
50 /* Total number of frames per cycle (needed to identify last packet) */
51 uint32_tcxx . . $ uint32_t# frames_per_cyclecxx . . $ xdp_tx_hwts#frames_per_cycle.;
52 };
53
54 struct xdp_socketcxx . . $ xdp_socket# {
55 uint64_tcxx . . $ uint64_t# outstanding_txcxx . . $ xdp_socket#outstanding_tx.;
56 struct xsk_ring_conscxx . . $ xsk_ring_cons# rxcxx . . $ xdp_socket#rx.;
57 struct xsk_ring_prodcxx . . $ xsk_ring_prod# txcxx . . $ xdp_socket#tx.;
58 struct xsk_umem_infocxx . . $ xsk_umem_info# umemcxx . . $ xdp_socket#umem.;
59 struct xsk_socketcxx . . $ xsk_socket# *xskcxx . . $ xdp_socket#xsk.;
60 struct xdp_programcxx . . $ xdp_program# *progcxx . . $ xdp_socket#prog.;
61 /* TX hardware timestamping context */
62 struct xdp_tx_hwtscxx . . $ xdp_tx_hwts# tx_hwtscxx . . $ xdp_socket#tx_hwts.;
63 int fdcxx . . $ xdp_socket#fd.;
64 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! busy_poll_modecxx . . $ xdp_socket#busy_poll_mode.;
65 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_time_modecxx . . $ xdp_socket#tx_time_mode.;
66 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_hwtstamp_modecxx . . $ xdp_socket#tx_hwtstamp_mode.;
67 };
68
69 struct xdp_tx_timecxx . . $ xdp_tx_time# {
70 const char *traffic_classcxx . . $ xdp_tx_time#traffic_class.;
71 uint64_tcxx . . $ uint64_t# sequence_counter_begincxx . . $ xdp_tx_time#sequence_counter_begin.;
72 uint64_tcxx . . $ uint64_t# durationcxx . . $ xdp_tx_time#duration.;
73 uint64_tcxx . . $ uint64_t# tx_time_offsetcxx . . $ xdp_tx_time#tx_time_offset.;
74 size_t num_frames_per_cyclecxx . . $ xdp_tx_time#num_frames_per_cycle.;
75 };
76
77 struct xdp_gen_configcxx . . $ xdp_gen_config# {
78 enum security_modecxx . . $ security_mode# modecxx . . $ xdp_gen_config#mode.;
79 struct security_contextcxx . . $ security_context# *security_contextcxx . . $ xdp_gen_config#security_context.;
80 const unsigned char *iv_prefixcxx . . $ xdp_gen_config#iv_prefix.;
81 const unsigned char *payload_patterncxx . . $ xdp_gen_config#payload_pattern.;
82 size_t payload_pattern_lengthcxx . . $ xdp_gen_config#payload_pattern_length.;
83 size_t frame_lengthcxx . . $ xdp_gen_config#frame_length.;
84 size_t num_frames_per_cyclecxx . . $ xdp_gen_config#num_frames_per_cycle.;
85 uint32_tcxx . . $ uint32_t# *frame_numbercxx . . $ xdp_gen_config#frame_number.;
86 uint64_tcxx . . $ uint64_t# sequence_counter_begincxx . . $ xdp_gen_config#sequence_counter_begin.;
87 uint32_tcxx . . $ uint32_t# meta_data_offsetcxx . . $ xdp_gen_config#meta_data_offset.;
88 enum stat_frame_typecxx . . $ stat_frame_type# frame_typecxx . . $ xdp_gen_config#frame_type.;
89 const struct xdp_tx_timecxx . . $ xdp_tx_time# *tx_timecxx . . $ xdp_gen_config#tx_time.;
90 };
91
92 struct xdp_socketcxx . . $ xdp_socket# *xdp_open_socketcxx . . $ xdp_open_socket(ec858eaaf043e631).(const char *interface, const char *xdp_program, int queue,
93 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! skb_mode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! zero_copy_mode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! wakeup_mode,
94 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! busy_poll_mode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_time_mode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tx_hwtstamp_mode);
95 void xdp_close_socketcxx . . $ xdp_close_socket(fc530d27d072e0f5).(struct xdp_socketcxx . . $ xdp_socket# *xsk, const char *interface, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! skb_mode);
96 void xdp_complete_tx_onlycxx . . $ xdp_complete_tx_only(5f53ef6b518fdd5d).(struct xdp_socketcxx . . $ xdp_socket# *xsk);
97 void xdp_complete_txcxx . . $ xdp_complete_tx(5f53ef6b518fdd5d).(struct xdp_socketcxx . . $ xdp_socket# *xsk);
98 void xdp_gen_and_send_framescxx . . $ xdp_gen_and_send_frames(312660e902b5d61d).(struct xdp_socketcxx . . $ xdp_socket# *xsk, const struct xdp_gen_configcxx . . $ xdp_gen_config# *xdp);
99 unsigned int xdp_receive_framescxx . . $ xdp_receive_frames(a8ae63e30c683a9b).(struct xdp_socketcxx . . $ xdp_socket# *xsk, size_t frame_length, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mirror_enabled,
100 int (*receive_function)(void *data, unsigned char *, size_t),
101 void *data, const struct xdp_tx_timecxx . . $ xdp_tx_time# *tx_time);
102 void xdp_get_timestamp_metadatacxx . . $ xdp_get_timestamp_metadata(cb618da060df1bcb).(void *data, uint64_tcxx . . $ uint64_t# *rx_hw_ts, uint64_tcxx . . $ uint64_t# *rx_sw_ts);
103
104 #endif /* _XDP_H_ */