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