Line data Source code
1 : #ifndef HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h 2 : #define HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h 3 : 4 : #include "../../../shared/fd_config.h" 5 : #include "../../../shared/fd_action.h" 6 : #include "../../../../disco/quic/fd_quic_tile.h" 7 : #include "../../../../waltz/quic/fd_quic_private.h" 8 : 9 : /* map cpeer_conn_id->conn_idx */ 10 : struct peer_conn_id_map { 11 : ulong conn_id; /* the peer conn_id isn't restricted to len 8 */ 12 : /* however, we don't know the size, so we assume */ 13 : /* the size is at least 8, and truncate the rest */ 14 : uint hash; /* for memoizing the hash value */ 15 : uint conn_idx; /* the connection index */ 16 : }; 17 : 18 : typedef struct peer_conn_id_map peer_conn_id_map_t; 19 : 20 : #define MAP_NAME peer_conn_id_map 21 0 : #define MAP_KEY conn_id 22 0 : #define MAP_T peer_conn_id_map_t 23 0 : #define PEER_MAP_LG_SLOT_CNT 20 24 0 : #define MAP_LG_SLOT_CNT PEER_MAP_LG_SLOT_CNT 25 : #include "../../../../util/tmpl/fd_map.c" 26 : 27 : /* fd_quic_trace_ctx is the relocated fd_quic_ctx_t of the target quic 28 : tile. fd_quic_trace_ctx_remote is the original fd_quic_ctx_t, but 29 : the pointer itself is in the local address space. */ 30 : 31 : extern fd_quic_ctx_t fd_quic_trace_ctx; 32 : extern fd_quic_ctx_t const * fd_quic_trace_ctx_remote; 33 : extern ulong fd_quic_trace_ctx_raddr; 34 : extern ulong volatile * fd_quic_trace_link_metrics; 35 : extern void const * fd_quic_trace_log_base; 36 : extern peer_conn_id_map_t _fd_quic_trace_peer_map[1UL<<PEER_MAP_LG_SLOT_CNT]; 37 : extern peer_conn_id_map_t * fd_quic_trace_peer_map; 38 : 39 : /* fd_quic_trace_target_fseq are the fseq counters published by the 40 : target quic tile */ 41 : 42 : extern ulong ** fd_quic_trace_target_fseq; 43 : 44 : struct fd_quic_trace_ctx { 45 : int dump; /* whether the user requested --dump */ 46 : int dump_config; /* whether the user requested --dump-config */ 47 : int dump_conns; /* whether the user requested --dump-conns */ 48 : int net_out; /* whether to include tx (net-out) packets */ 49 : ulong net_out_base; /* base address of net-out chunks in local addr space */ 50 : }; 51 : 52 : typedef struct fd_quic_trace_ctx fd_quic_trace_ctx_t; 53 : 54 : struct fd_quic_trace_frame_ctx { 55 : ulong conn_id; 56 : uint src_ip; 57 : ushort src_port; 58 : uchar pkt_type; 59 : ulong pkt_num; 60 : }; 61 : 62 : typedef struct fd_quic_trace_frame_ctx fd_quic_trace_frame_ctx_t; 63 : 64 : FD_PROTOTYPES_BEGIN 65 : 66 : void 67 : fd_quic_trace_frames( fd_quic_trace_frame_ctx_t * context, 68 : uchar const * data, 69 : ulong data_sz ); 70 : 71 : void 72 : fd_quic_trace_rx_tile( fd_quic_trace_ctx_t * trace_ctx, 73 : fd_frag_meta_t const * rx_mcache, 74 : fd_frag_meta_t const * tx_mcache ); 75 : 76 : void 77 : fd_quic_trace_log_tile( fd_frag_meta_t const * in_mcache ); 78 : 79 : FD_PROTOTYPES_END 80 : 81 : 82 0 : #define translate_ptr( ptr ) __extension__({ \ 83 0 : ulong rel = (ulong)(ptr) - fd_quic_trace_ctx_raddr; \ 84 0 : ulong laddr = (ulong)fd_quic_trace_ctx_remote + rel; \ 85 0 : (__typeof__(ptr))(laddr); \ 86 0 : }) 87 : 88 : extern action_t fd_action_quic_trace; 89 : 90 : #endif /* HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h */