19#ifndef __ROUTING_TABLE_H__
20#define __ROUTING_TABLE_H__
123 return ~km.key & ~km.mask;
147 uint32_t new_xs = ~(a.
key ^ b.
key);
156#define RTR_MC_SET_FAILED 0
183 log_debug(
"compress_as_much_as_possible = %d",
194 log_error(
"failed to allocate memory for routing tables");
221 for (uint32_t i = 0; i <
table->
size; i++) {
223 uint32_t route = entry.
route | (app_id << 24);
227 log_warning(
"failed to set a router table entry at index %d",
void log_error(const char *message,...)
This function logs errors. Errors usually indicate a serious fault in the program,...
void log_warning(const char *message,...)
This function logs warnings.
void log_debug(const char *message,...)
This function logs debugging messages. This level of message is normally not printed except when the ...
uint32_t table_size
Initial size of the routing table.
static void read_table(header_t *header)
Read a new copy of the routing table from SDRAM.
key_mask_t key_mask
Key and mask.
void print_header(header_t *header)
Print the header object for debug purposes.
uint32_t mask
Mask for the key_mask.
entry_t entries[]
Routing table entries.
static void swap_entries(int a, int b)
Swap a pair of entries at the given indices.
static uint32_t key_mask_get_xs(key_mask_t km)
Get a mask of the Xs in a key_mask.
#define RTR_MC_SET_FAILED
flag for if a rtr_mc_set() failure.
entry_t entries[]
Entries in the table.
uint32_t size
Number of entries in the table.
static unsigned int key_mask_count_xs(key_mask_t km)
Get a count of the Xs in a key_mask.
table_t * table
The table being manipulated.
static key_mask_t key_mask_merge(key_mask_t a, key_mask_t b)
Generate a new key-mask which is a combination of two other key_masks.
static void routing_table_copy_entry(int new_index, int old_index)
Copy an entry from one index to another.
uint32_t route
Routing direction.
uint32_t compress_as_much_as_possible
int routing_table_get_n_entries(void)
Get the number of entries in the routing table.
static bool key_mask_intersect(key_mask_t a, key_mask_t b)
Determine if two key_masks would match any of the same keys.
bool load_routing_table(uint32_t app_id)
Load a routing table to the router.
entry_t * routing_table_get_entry(uint32_t entry_id_to_find)
Gets a pointer to where this entry is stored.
static void routing_table_put_entry(const entry_t *entry, int index)
Write an entry to a specific index.
uint32_t key
Key for the key_mask.
void routing_table_remove_from_size(int size_to_remove)
updates table stores accordingly.
uint32_t source
Source of packets arriving at this entry.
Holds data for a routing table entry.
Holds a routing table description.
uint rtr_alloc_id(uint size, uint app_id)
uint rtr_mc_set(uint entry, uint key, uint mask, uint route)
void spin1_memcpy(void *dst, void const *src, uint len)