SpiNNFrontEndCommon 7.4.2
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
routing_table.h File Reference

Utilities for a single routing table. More...

Go to the source code of this file.

Data Structures

struct  key_mask_t
 Holds key and mask. More...
 
struct  entry_t
 Holds data for a routing table entry. More...
 
struct  table_t
 Holds a routing table description. More...
 
struct  header_t
 The header of the routing table information in the input data block. More...
 

Macros

#define RTR_MC_SET_FAILED   0
 flag for if a rtr_mc_set() failure.
 

Functions

entry_trouting_table_get_entry (uint32_t entry_id_to_find)
 Gets a pointer to where this entry is stored.
 
int routing_table_get_n_entries (void)
 Get the number of entries in the routing table.
 
void routing_table_remove_from_size (int size_to_remove)
 updates table stores accordingly.
 
static void routing_table_put_entry (const entry_t *entry, int index)
 Write an entry to a specific index.
 
static void routing_table_copy_entry (int new_index, int old_index)
 Copy an entry from one index to another.
 
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.
 
static unsigned int key_mask_count_xs (key_mask_t km)
 Get a count of the Xs in a key_mask.
 
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.
 
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.
 
void print_header (header_t *header)
 Print the header object for debug purposes.
 
static void read_table (header_t *header)
 Read a new copy of the routing table from SDRAM.
 
bool load_routing_table (uint32_t app_id)
 Load a routing table to the router.
 

Variables

table_ttable
 The table being manipulated.
 

Detailed Description

Utilities for a single routing table.

Definition in file routing_table.h.


Data Structure Documentation

◆ key_mask_t

struct key_mask_t

Holds key and mask.

Definition at line 25 of file routing_table.h.

Data Fields
uint32_t key Key for the key_mask.
uint32_t mask Mask for the key_mask.

◆ entry_t

struct entry_t

Holds data for a routing table entry.

Definition at line 34 of file routing_table.h.

Data Fields
key_mask_t key_mask Key and mask.
uint32_t route Routing direction.
uint32_t source Source of packets arriving at this entry.

◆ table_t

struct table_t

Holds a routing table description.

Definition at line 46 of file routing_table.h.

Data Fields
uint32_t size Number of entries in the table.
entry_t entries[] Entries in the table.

◆ header_t

struct header_t

The header of the routing table information in the input data block.

This is found looking for a memory block with the right tag.

Definition at line 162 of file routing_table.h.

Data Fields
uint32_t app_id

Application ID to use to load the routing table. This can be left as 0 to load routing entries with the same application ID that was used to load this application.

uint32_t compress_as_much_as_possible

flag that uses the available entries of the router table instead of compressing as much as possible.

uint32_t table_size Initial size of the routing table.
entry_t entries[] Routing table entries.

Macro Definition Documentation

◆ RTR_MC_SET_FAILED

#define RTR_MC_SET_FAILED   0

flag for if a rtr_mc_set() failure.

Definition at line 156 of file routing_table.h.

Function Documentation

◆ routing_table_get_entry()

entry_t * routing_table_get_entry ( uint32_t entry_id_to_find)

Gets a pointer to where this entry is stored.

Will not check if there is an entry with this id but will RTE if the id is too large

Parameters
[in]entry_id_to_findId of entry to find pointer to
Returns
pointer to the entry's location

Definition at line 64 of file routing_table.h.

◆ routing_table_get_n_entries()

int routing_table_get_n_entries ( void )

Get the number of entries in the routing table.

Returns
number of appended entries.

Definition at line 70 of file routing_table.h.

◆ routing_table_remove_from_size()

void routing_table_remove_from_size ( int size_to_remove)

updates table stores accordingly.

will RTE if this causes the total entries to become negative.

Parameters
[in]size_to_removethe amount of size to remove from the table sets

Definition at line 78 of file routing_table.h.

◆ routing_table_put_entry()

static void routing_table_put_entry ( const entry_t * entry,
int index )
inlinestatic

Write an entry to a specific index.

Parameters
[in]entryThe entry to write
[in]indexWhere to write it.

Definition at line 85 of file routing_table.h.

◆ routing_table_copy_entry()

static void routing_table_copy_entry ( int new_index,
int old_index )
inlinestatic

Copy an entry from one index to another.

Parameters
[in]new_indexWhere to copy to
[in]old_indexWhere to copy from

Definition at line 96 of file routing_table.h.

◆ swap_entries()

static void swap_entries ( int a,
int b )
inlinestatic

Swap a pair of entries at the given indices.

Parameters
[in]aThe first index where an entry is
[in]bThe second index where an entry is

Definition at line 104 of file routing_table.h.

◆ key_mask_get_xs()

static uint32_t key_mask_get_xs ( key_mask_t km)
inlinestatic

Get a mask of the Xs in a key_mask.

Parameters
[in]kmthe key mask to get as xs
Returns
a merged mask

Definition at line 122 of file routing_table.h.

◆ key_mask_count_xs()

static unsigned int key_mask_count_xs ( key_mask_t km)
inlinestatic

Get a count of the Xs in a key_mask.

Parameters
[in]kmthe key mask struct to count
Returns
the number of bits set in the mask

Definition at line 129 of file routing_table.h.

◆ key_mask_intersect()

static bool key_mask_intersect ( key_mask_t a,
key_mask_t b )
inlinestatic

Determine if two key_masks would match any of the same keys.

Parameters
[in]akey mask struct a
[in]bkey mask struct b
Returns
bool that says if these key masks intersect

Definition at line 137 of file routing_table.h.

◆ key_mask_merge()

static key_mask_t key_mask_merge ( key_mask_t a,
key_mask_t b )
inlinestatic

Generate a new key-mask which is a combination of two other key_masks.

c := a | b

Parameters
[in]athe first key mask struct
[in]bthe second key mask struct
Returns
the merged key mask struct

Definition at line 146 of file routing_table.h.

◆ print_header()

void print_header ( header_t * header)

Print the header object for debug purposes.

Parameters
[in]headerthe header to print

Definition at line 181 of file routing_table.h.

◆ read_table()

static void read_table ( header_t * header)
static

Read a new copy of the routing table from SDRAM.

Parameters
[in]headerthe header object

Definition at line 190 of file routing_table.h.

◆ load_routing_table()

bool load_routing_table ( uint32_t app_id)

Load a routing table to the router.

Parameters
[in]app_idthe app id for the routing table entries to be loaded under
Returns
whether the table was loaded into the router

Definition at line 209 of file routing_table.h.

Variable Documentation

◆ table

table_t* table

The table being manipulated.

This is common across all the functions in this file.

Definition at line 57 of file routing_table.h.