Line data Source code
1 : #ifndef HEADER_fd_src_discof_rotor_fd_rotor_tile_private_h 2 : #define HEADER_fd_src_discof_rotor_fd_rotor_tile_private_h 3 : 4 : /* Internal types of the rotor tile. */ 5 : 6 : #include "../../flamenco/gossip/fd_gossip_message.h" 7 : #include "../repair/fd_repair.h" 8 : #include "../../disco/net/fd_net_tile.h" 9 : #include "../../util/net/fd_net_headers.h" 10 : 11 : typedef union { 12 : struct { 13 : fd_wksp_t * mem; 14 : ulong chunk0; 15 : ulong wmark; 16 : ulong mtu; 17 : }; 18 : fd_net_rx_bounds_t net_rx; 19 : } in_ctx_t; 20 : 21 : struct out_ctx { 22 : ulong idx; 23 : fd_wksp_t * mem; 24 : ulong chunk0; 25 : ulong wmark; 26 : ulong chunk; 27 : 28 : /* See repair tile for explanation of sign credit management */ 29 : 30 : ulong in_idx; /* index of the incoming link */ 31 : ulong credits; /* available credits for link */ 32 : ulong max_credits; /* maximum credits (depth) */ 33 : }; 34 : typedef struct out_ctx out_ctx_t; 35 : 36 : /* Data needed to sign and send a pong that is not contained in the 37 : pong msg itself. */ 38 : 39 : struct pong_data { 40 : fd_ip4_port_t peer_addr; 41 : fd_hash_t hash; 42 : uint daddr; 43 : fd_pubkey_t key; 44 : }; 45 : typedef struct pong_data pong_data_t; 46 : 47 : /* Sign credit management */ 48 : 49 : struct sign_req { 50 : ulong key; /* map key, ctx->pending_key_next */ 51 : ulong buflen; 52 : union { 53 : uchar buf[sizeof(fd_repair_msg_t)]; 54 : fd_repair_msg_t msg; 55 : }; 56 : pong_data_t pong_data; /* populated only for pong msgs */ 57 : }; 58 : typedef struct sign_req sign_req_t; 59 : 60 : #define MAP_NAME fd_signs_map 61 13635 : #define MAP_KEY key 62 5031 : #define MAP_KEY_NULL ULONG_MAX 63 8604 : #define MAP_KEY_INVAL(k) (k==ULONG_MAX) 64 6543 : #define MAP_T sign_req_t 65 : #define MAP_MEMOIZE 0 66 : #include "../../util/tmpl/fd_map_dynamic.c" 67 : 68 : /* Request work queues */ 69 : 70 : /* Max number of validators that can be actively queried */ 71 105 : #define FD_REPAIR_PEER_MAX (FD_CONTACT_INFO_TABLE_SIZE) 72 : 73 : struct sign_pending { 74 : fd_repair_msg_t msg; 75 : pong_data_t pong_data; /* populated only for pong msgs */ 76 : }; 77 : typedef struct sign_pending sign_pending_t; 78 : 79 : /* toss_queue is referred to "toss" because we don't care about tracking 80 : the requests, and we can fire and forget. Should be used for 81 : requests where if we don't hear back, we don't care. E.g., pongs, 82 : initial warmup requests, etc. */ 83 : 84 : #define QUEUE_NAME toss_queue 85 33 : #define QUEUE_T sign_pending_t 86 105 : #define QUEUE_MAX (2*FD_REPAIR_PEER_MAX) 87 : #include "../../util/tmpl/fd_queue.c" 88 : 89 : /* ag_req_queue stores alpenglow metadata repair requests. We can cap 90 : this queue at 1024 requests, as long as after_credit drains all 91 : meta requests. */ 92 : 93 : #define QUEUE_NAME meta_queue 94 3213 : #define QUEUE_T fd_repair_msg_t 95 : #include "../../util/tmpl/fd_queue_dynamic.c" 96 : 97 : #endif /* HEADER_fd_src_discof_rotor_fd_rotor_tile_private_h */