SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
Data Structures | Functions
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...
 

Functions

entry_trouting_table_get_entry (uint32_t entry_id_to_find)
 Gets a pointer to where this entry is stored.
 
bool routing_table_get_entries (uint32_t start_entry, uint32_t n_entries, entry_t *output)
 Gets a pointer to several entries.
 
void routing_table_wait_for_last_transfer (void)
 Waits for the last transfer from routing_table_get_entries to complete.
 
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.
 

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.

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 110 of file rt_single.h.

◆ routing_table_get_entries()

bool routing_table_get_entries ( uint32_t  start_entry,
uint32_t  n_entries,
entry_t output 
)

Gets a pointer to several entries.

Parameters
[in]start_entryThe first entry to get
[in]n_entriesThe number of entries to get
[out]outputWhere to put the entries read - must have enough space!
Returns
: Whether the entries are available now, or should be waited for

Definition at line 176 of file rt_single.h.

◆ routing_table_wait_for_last_transfer()

void routing_table_wait_for_last_transfer ( void  )

Waits for the last transfer from routing_table_get_entries to complete.

Returns immediately if the last transfer is already done

Definition at line 195 of file rt_single.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 102 of file rt_single.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 106 of file rt_single.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 86 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 97 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 105 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 123 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 131 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 140 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 149 of file routing_table.h.