Line data Source code
1 : #ifndef HEADER_fd_src_discof_reasm_fd_reasm_private_h 2 : #define HEADER_fd_src_discof_reasm_fd_reasm_private_h 3 : 4 : #include "fd_reasm.h" 5 : 6 : #define POOL_NAME pool 7 0 : #define POOL_T fd_reasm_fec_t 8 : #include "../../util/tmpl/fd_pool.c" 9 : 10 : #define MAP_NAME ancestry 11 : #define MAP_ELE_T fd_reasm_fec_t 12 : #define MAP_KEY_T fd_hash_t 13 0 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 14 0 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 15 : #include "../../util/tmpl/fd_map_chain.c" 16 : 17 : #define MAP_NAME frontier 18 : #define MAP_ELE_T fd_reasm_fec_t 19 : #define MAP_KEY_T fd_hash_t 20 0 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 21 0 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 22 : #include "../../util/tmpl/fd_map_chain.c" 23 : 24 : #define MAP_NAME orphaned 25 : #define MAP_ELE_T fd_reasm_fec_t 26 : #define MAP_KEY_T fd_hash_t 27 0 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 28 0 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 29 : #include "../../util/tmpl/fd_map_chain.c" 30 : 31 : #define MAP_NAME subtrees 32 : #define MAP_ELE_T fd_reasm_fec_t 33 : #define MAP_KEY_T fd_hash_t 34 0 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 35 0 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 36 : #include "../../util/tmpl/fd_map_chain.c" 37 : 38 : #define DLIST_NAME subtreel 39 : #define DLIST_ELE_T fd_reasm_fec_t 40 0 : #define DLIST_PREV subtreel.prev 41 0 : #define DLIST_NEXT subtreel.next 42 : #include "../../util/tmpl/fd_dlist.c" 43 : 44 : #define DLIST_NAME out 45 : #define DLIST_ELE_T fd_reasm_fec_t 46 0 : #define DLIST_PREV out.prev 47 0 : #define DLIST_NEXT out.next 48 : #include "../../util/tmpl/fd_dlist.c" 49 : 50 : #define DEQUE_NAME bfs 51 0 : #define DEQUE_T ulong 52 : #include "../../util/tmpl/fd_deque_dynamic.c" 53 : 54 : struct xid { 55 : ulong key; /* 32 msb slot | 32 lsb fec_set_idx. if fec_set_idx is UINT_MAX, then this xid represents the block id for this slot. */ 56 : ulong idx; /* pool idx of first FEC seen. Updated only on confirmation. */ 57 : uint cnt; /* count of FECs with this xid key. If > 1, equivocation occurred on this FEC set */ 58 : }; 59 : typedef struct xid xid_t; 60 : 61 : #define MAP_NAME xid 62 0 : #define MAP_T xid_t 63 0 : #define MAP_KEY_NULL ULONG_MAX 64 0 : #define MAP_KEY_INVAL(k) ((k)==MAP_KEY_NULL) 65 : #define MAP_MEMOIZE 0 66 : #include "../../util/tmpl/fd_map_dynamic.c" 67 : 68 : struct __attribute__((aligned(128UL))) fd_reasm { 69 : ulong slot0; /* special initialization slot. chains first FEC */ 70 : ulong root; /* pool idx of the root FEC set */ 71 : ulong pool_gaddr; /* gaddr of the pool of FEC nodes backing the above maps / tree */ 72 : ancestry_t * ancestry; /* map of mr->fec. non-leaves of the connected tree */ 73 : frontier_t * frontier; /* map of mr->fec. leaves of the connected tree */ 74 : orphaned_t * orphaned; /* map of mr->fec. non-roots of the orphaned subtrees */ 75 : subtrees_t * subtrees; /* map of mr->fec. roots of the orphaned subtrees */ 76 : subtreel_t _subtrlf[1]; /* internal dlist of the elements in subtrees in no particular order */ 77 : subtreel_t * subtreel; /* the join to the dlist */ 78 : 79 : out_t _out[1]; /* delivery queue(dlist) of elements to output */ 80 : out_t * out; /* the join to the dlist */ 81 : 82 : ulong * bfs; /* internal queue of pool idxs for BFS */ 83 : xid_t * xid; /* map of (slot, fec_set_idx)->mr */ 84 : }; 85 : 86 : static inline fd_reasm_fec_t * 87 0 : reasm_pool( fd_reasm_t * reasm ) { 88 0 : fd_wksp_t * wksp = fd_wksp_containing( reasm ); 89 0 : return (fd_reasm_fec_t *)fd_wksp_laddr_fast( wksp, reasm->pool_gaddr ); 90 0 : } 91 : 92 : static inline fd_reasm_fec_t const * 93 0 : reasm_pool_const( fd_reasm_t const * reasm ) { 94 0 : fd_wksp_t * wksp = fd_wksp_containing( reasm ); 95 0 : return (fd_reasm_fec_t const *)fd_wksp_laddr_fast( wksp, reasm->pool_gaddr ); 96 0 : } 97 : 98 : #endif /* HEADER_fd_src_discof_reasm_fd_reasm_private_h */