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 6 : #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 33 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 14 126 : #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 63 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 21 153 : #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 6 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 28 111 : #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 6 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 35 111 : #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 dlist 39 : #define DLIST_ELE_T fd_reasm_fec_t 40 12 : #define DLIST_PREV dlist_prev 41 33 : #define DLIST_NEXT dlist_next 42 : #include "../../util/tmpl/fd_dlist.c" 43 : 44 : #define DEQUE_NAME bfs 45 54 : #define DEQUE_T ulong 46 : #include "../../util/tmpl/fd_deque_dynamic.c" 47 : 48 : #define DEQUE_NAME out 49 0 : #define DEQUE_T ulong 50 : #include "../../util/tmpl/fd_deque_dynamic.c" 51 : 52 : struct bid { 53 : ulong slot; 54 : ulong idx; /* pool idx of the last FEC in the slot */ 55 : }; 56 : typedef struct bid bid_t; 57 : 58 : #define MAP_NAME bid 59 36 : #define MAP_T bid_t 60 126 : #define MAP_KEY slot 61 126 : #define MAP_KEY_NULL ULONG_MAX 62 30 : #define MAP_KEY_INVAL(k) ((k)==MAP_KEY_NULL) 63 : #define MAP_MEMOIZE 0 64 : #include "../../util/tmpl/fd_map_dynamic.c" 65 : 66 : struct xid { 67 : ulong key; /* 32 msb slot | 32 lsb fec_set_idx */ 68 : ulong idx; /* pool idx of the FEC */ 69 : }; 70 : typedef struct xid xid_t; 71 : 72 : #define MAP_NAME xid 73 42 : #define MAP_T xid_t 74 138 : #define MAP_KEY_NULL ULONG_MAX 75 42 : #define MAP_KEY_INVAL(k) ((k)==MAP_KEY_NULL) 76 : #define MAP_MEMOIZE 0 77 : #include "../../util/tmpl/fd_map_dynamic.c" 78 : 79 : struct __attribute__((aligned(128UL))) fd_reasm { 80 : ulong slot0; /* special initialization slot. chains first FEC */ 81 : ulong root; /* pool idx of the root FEC set */ 82 : ulong pool_gaddr; /* gaddr of the pool of FEC nodes backing the above maps / tree */ 83 : ancestry_t * ancestry; /* map of mr->fec. non-leaves of the connected tree */ 84 : frontier_t * frontier; /* map of mr->fec. leaves of the connected tree */ 85 : orphaned_t * orphaned; /* map of mr->fec. non-roots of the orphaned subtrees */ 86 : subtrees_t * subtrees; /* map of mr->fec. roots of the orphaned subtrees */ 87 : dlist_t _subtrlf[1]; /* internal dlist of the elements in subtrees in no particular order */ 88 : dlist_t * subtreel; /* the join to the dlist */ 89 : ulong * bfs; /* internal queue of pool idxs for BFS */ 90 : ulong * out; /* delivery queue of pool idxs to output */ 91 : bid_t * bid; /* map of slot->fec */ 92 : xid_t * xid; /* map of (slot, fec_set_idx)->mr */ 93 : }; 94 : 95 : static inline fd_reasm_fec_t * 96 213 : reasm_pool( fd_reasm_t * reasm ) { 97 213 : fd_wksp_t * wksp = fd_wksp_containing( reasm ); 98 213 : return (fd_reasm_fec_t *)fd_wksp_laddr_fast( wksp, reasm->pool_gaddr ); 99 213 : } 100 : 101 : static inline fd_reasm_fec_t const * 102 48 : reasm_pool_const( fd_reasm_t const * reasm ) { 103 48 : fd_wksp_t * wksp = fd_wksp_containing( reasm ); 104 48 : return (fd_reasm_fec_t const *)fd_wksp_laddr_fast( wksp, reasm->pool_gaddr ); 105 48 : } 106 : 107 : #endif /* HEADER_fd_src_discof_reasm_fd_reasm_private_h */