PadicoTM

Documentation

« back to PM2 home.

A simple low-level packet-based messaging API, for networks with implicit connection. More...

Files

file  psp.c
 PadicoTM PSP module.
 
file  PSP.h
 Padico Simple Packets API.
 

Data Structures

struct  padico_psp_driver_s
 driver descriptor for the PSP interface. More...
 
struct  puk_receptacle_PadicoSimplePackets_s
 
struct  padico_psp_slot_s
 a PSP slot, i.e. More...
 
struct  padico_psp_slot_hash_entry_s
 stores an entry in the hashtable More...
 
struct  padico_psp_slot_hash_entry_block_lfstack_cell_s
 
struct  padico_psp_slot_hash_entry_block_lfstack_s
 
struct  padico_psp_slot_hash_entry_slice_lfstack_cell_s
 
struct  padico_psp_slot_hash_entry_slice_lfstack_s
 
struct  padico_psp_slot_hash_entry_allocator_s
 
struct  padico_psp_slot_hashtable_s
 
struct  padico_psp_slot_hashtable_enumerator_s
 
struct  padico_psp_directory_s
 PSP slot directory used for multiplexing. More...
 

Macros

#define PADICO_PSP_TAG_NONE   ((uint32_t)0x00000000)
 uninitialized tag
 
#define PADICO_PSP_CONTROL   ((uint32_t)0x01000000)
 Control/PSP.
 
#define PADICO_PSP_CIRCUIT   ((uint32_t)0x02000000)
 Circuit/PSP.
 
#define PADICO_PSP_VOPW   ((uint32_t)0x03000000)
 VLink_Packet.
 
#define PADICO_PSP_NEWMADICO   ((uint32_t)0x04000000)
 Newmadico.
 
#define PADICO_PSP_MINIDRIVER   ((uint32_t)0x05000000)
 Minidriver_PSP.
 
#define PADICO_PSP_RESERVED   ((uint32_t)0xF0000000)
 
#define PADICO_PSP_CLOSE_CHANNEL   ((uint32_t)0xF1000000)
 [ reserved for internal use ]
 
#define PADICO_PSP_SYSTEM   ((uint32_t)0xF2000000)
 [ reserved for internal use ]
 
#define PADICO_PSP_ADAPTER_MASK   ((uint32_t)0xFF000000)
 
#define PADICO_PSP_INSTANCE_MASK   ((uint32_t)0x00FFFFFF)
 

Typedefs

typedef void(* padico_psp_pump_t) (void *token, void *bytes, size_t size)
 the function to pump data in PSP callbacks
 
typedef void(* padico_psp_handler_t) (const void *header, padico_topo_node_t from, void *key, padico_psp_pump_t pump, void *token)
 A callback for PSP.
 
typedef void * padico_psp_connection_t
 An outgoing connection object, supposed to be opaque for the user.
 
typedef struct padico_psp_slot_s * padico_psp_slot_t
 
typedef uint32_t(* padico_psp_slot_hash_hfunc_t) (uint32_t key)
 
typedef int(* padico_psp_slot_hash_eqfunc_t) (uint32_t key1, uint32_t key2)
 
typedef void(* padico_psp_slot_hash_destructor_t) (uint32_t key, padico_psp_slot_t data)
 
typedef struct padico_psp_slot_hash_entry_block_lfstack_s padico_psp_slot_hash_entry_block_lfstack_t
 
typedef struct padico_psp_slot_hash_entry_slice_lfstack_s padico_psp_slot_hash_entry_slice_lfstack_t
 
typedef struct padico_psp_slot_hash_entry_allocator_s * padico_psp_slot_hash_entry_allocator_t
 
typedef struct padico_psp_slot_hashtable_s * padico_psp_slot_hashtable_t
 
typedef struct padico_psp_slot_hashtable_enumerator_s * padico_psp_slot_hashtable_enumerator_t
 

Functions

static uint32_t padico_psp_tag_build (uint32_t component_tag, uint32_t instance_tag)
 build a PSP tag from an component tag and an instance tag
 
static uint32_t padico_psp_tag_get_component (uint32_t tag)
 get the 'component' (static) part from a PSP tag
 
static uint32_t padico_psp_tag_get_instance (uint32_t tag)
 get the 'instance' (dynamic) part from a PSP tag
 
static puk_iface_t puk_iface_PadicoSimplePackets (void)
 Attach the iface name to its driver.
 
static struct puk_receptacle_PadicoSimplePackets_s puk_receptacle_PadicoSimplePackets_null (void)
 
static void puk_instance_indirect_PadicoSimplePackets (puk_instance_t instance, const char *label, struct puk_receptacle_PadicoSimplePackets_s *receptacle)
 
static void puk_instance_context_indirect_PadicoSimplePackets (puk_instance_t instance, const char *label, struct puk_receptacle_PadicoSimplePackets_s *receptacle)
 
static puk_facet_t puk_component_get_facet_PadicoSimplePackets (puk_component_t c, const char *label)
 
static const struct padico_psp_driver_s * puk_component_get_driver_PadicoSimplePackets (puk_component_t component, const char *label)
 
static void puk_context_indirect_PadicoSimplePackets (puk_context_t context, const char *label, const struct padico_psp_driver_s **driver, puk_context_t *rcontext)
 
static void puk_component_indirect_PadicoSimplePackets (puk_component_t component, const char *label, const struct padico_psp_driver_s **driver, puk_context_t *context)
 
static void padico_psp_init (const struct puk_receptacle_PadicoSimplePackets_s *psp, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key)
 
static void padico_psp_listen (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node)
 
static void padico_psp_connect (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node)
 
static padico_psp_connection_t padico_psp_new_message (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node, void **sbuf)
 
static void padico_psp_pack (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_psp_connection_t conn, const char *bytes, size_t size)
 
static void padico_psp_end_message (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_psp_connection_t conn)
 
static uint32_t padico_psp_tag_hash (const uint32_t a)
 
static int padico_psp_tag_eq (uint32_t a, uint32_t b)
 
struct padico_psp_slot_hash_entry_block_lfstack_cell_s __attribute__ ((aligned(16)))
 
 __attribute__ ((unused)) static inline void padico_psp_slot_hash_entry_allocator_init_thread(struct padico_psp_slot_hash_entry_allocator_s *a
 explicit thread level
 
 if (!single) pthread_spin_unlock(&_stack -> _lock)
 
 if (_cell !=NULL)
 
 assert (slab_size > 0)
 
 padico_psp_slot_hash_entry_allocator_init_thread (a, slab_size,(1))
 
 if (block !=NULL) rblocks++
 
 while (block !=NULL)
 
 if (slice !=NULL)
 
 padico_free_func (slice, puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__))
 
 while (slice !=NULL)
 
 if (check &&(rblocks !=allocated_blocks)) do
 
 while (0)
 
 __attribute__ ((unused, nonnull)) static inline void padico_psp_slot_hashtable_init(padico_psp_slot_hashtable_t h)
 initialize a new hashtable
 
 assert (cell !=NULL)
 
puk_allocator_cell_clear & cell (struct padico_psp_slot_hash_entry_s)
 
static struct padico_psp_slot_hash_entry_s * padico_psp_slot_hash_entry_lookup (padico_psp_slot_hashtable_t h, const uint32_t key)
 
static void padico_psp_slot_hash_entry_insert (padico_psp_slot_hashtable_t h, uint32_t key, padico_psp_slot_t data)
 
static int padico_psp_slot_hash_entry_oldprobe (padico_psp_slot_hashtable_t h, const uint32_t key)
 
static void padico_psp_slot_hash_entry_rehash_row (padico_psp_slot_hashtable_t h, ssize_t z)
 
static void padico_psp_slot_hash_entry_rehash_n (padico_psp_slot_hashtable_t h, ssize_t n)
 
static void padico_psp_slot_hash_entry_rehash_flush (padico_psp_slot_hashtable_t h)
 
 if (source->key !=((uint32_t) 0))
 
 __attribute__ ((unused, nonnull(1))) static inline void padico_psp_slot_hashtable_insert(padico_psp_slot_hashtable_t h
 insert an entry into a hashtable
 
 assert (key !=((uint32_t) 0))
 
 if (e)
 
 return (e !=NULL)
 
 if (e !=NULL)
 
 if (data) *data = ( padico_psp_slot_t )0
 
 if (h->table==NULL) return
 
 while (e &&(e->key !=((uint32_t) 0)))
 
 while (padico_psp_slot_hash_entry_oldprobe(h, key))
 
 padico_psp_slot_hash_entry_rehash_flush (h)
 
 assert (e->h !=NULL)
 
 assert (e->h->oldtable==NULL)
 
 if (e->current &&e->current->next)
 
 if (e->i< e->h->size)
 
 padico_psp_slot_hashtable_remove (h, *key)
 
void padico_psp_directory_init (struct padico_psp_directory_s *d)
 
padico_psp_slot_t padico_psp_slot_insert (struct padico_psp_directory_s *d, padico_psp_handler_t handler, void *key, uint32_t tag, size_t h_size)
 
void padico_psp_slot_remove (struct padico_psp_directory_s *d, padico_psp_slot_t slot)
 
padico_psp_slot_t padico_psp_slot_lookup (struct padico_psp_directory_s *d, uint32_t tag)
 

Variables

struct padico_psp_slot_hash_entry_block_lfstack_s __attribute__
 explicit thread level
 
struct padico_psp_slot_hash_entry_block_lfstack_cell_s * _cell { padico_psp_slot_hash_entry_block_lfstack_push_ext(_stack, _cell, 0)
 
struct padico_psp_slot_hash_entry_block_lfstack_cell_s int single { if(!single) pthread_spin_lock(&_stack->_lock)
 
struct padico_psp_slot_hash_entry_block_lfstack_cell_s * _next = _stack->_head
 
_stack _head = _cell
 
ssize_t slab_size = slab_size
 
padico_psp_slot_hash_entry_slice_lfstack_init & a
 
a new_slab = 0
 
 void
 
int check { int rblocks = 0
 
struct padico_psp_slot_hash_entry_block_lfstack_cell_s block [] = NULL
 
 do { block = padico_psp_slot_hash_entry_block_lfstack_pop_ext(&a->blocks, a->single)
 
int allocated_blocks = 0
 
struct padico_psp_slot_hash_entry_slice_lfstack_cell_s * slice = NULL
 
struct padico_psp_slot_hash_entry_s * b { struct padico_psp_slot_hash_entry_block_lfstack_cell_s*cell = (( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)((char*)(__typeof__ (&(( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)0)-> block ))( b )- ((size_t) &(( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)0)-> block )))
 
const uint32_t key { if(h->oldtable) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); const ssize_t index = puk_hash_to_index(z, h->oldsize); struct padico_psp_slot_hash_entry_s*e = h->oldtable + index; while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { padico_psp_slot_hash_entry_rehash_row(h, index); padico_psp_slot_hash_entry_rehash_n(h, 16 ); return 1; } e = e->next; } } return 0
 
ssize_t z { assert(h->oldtable != NULL)
 
struct padico_psp_slot_hash_entry_s * source = h->oldtable + z
 
ssize_t n { if(h->oldtable) { ssize_t k; for(k = 0; k < n; k++) { padico_psp_slot_hash_entry_rehash_row(h, h->rehashed + k); if(h->rehashed + k == h->oldsize - 1) { (padico_free_func( h->oldtable , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); h->oldtable = NULL; h->rehashed = 0; return; } } h->rehashed += k; } } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_insert( padico_psp_slot_hashtable_t h, uint32_t key, padico_psp_slot_t data) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); assert(h->table != NULL); struct padico_psp_slot_hash_entry_s*e = h->table + puk_hash_to_index(z, h->size); if(e->key != (( uint32_t )0) ) { while(e->next) { e = e->next; } e->next = padico_psp_slot_hash_entry_malloc(&h->entry_allocator); assert(e->next != NULL); e = e->next; } e->key = key; e->data = data; e->next = NULL; } __attribute__((unused)) static inline struct padico_psp_slot_hash_entry_s* padico_psp_slot_hash_entry_lookup( padico_psp_slot_hashtable_t h, const uint32_t key) { if(h->table == NULL) return NULL; const uint32_t z = (*( &padico_psp_tag_hash ))(key); struct padico_psp_slot_hash_entry_s*e = NULL; do { e = h->table + puk_hash_to_index(z, h->size); while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { return e; } e = e->next; } } while( padico_psp_slot_hash_entry_oldprobe(h, key)); return NULL; } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_rehash_flush( padico_psp_slot_hashtable_t h) { if(h->oldtable) { padico_psp_slot_hash_entry_rehash_n(h, h->oldsize); } assert(h->oldtable == NULL); } __attribute__((unused)) static void padico_psp_slot_hash_rehash_trigger( padico_psp_slot_hashtable_t h) { static const ssize_t hash_primes[] = { 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, -1 }; assert(hash_primes[0] == 11 ); assert(h->oldtable == NULL); h->oldtable = h->table; h->oldsize = h->size; h->rehashed = 0; int i = 0; while(h->size >= hash_primes[i]) { i++; } h->size = hash_primes[i]; assert(h->size > 0); assert(h->size > h->oldsize); h->table = (struct padico_psp_slot_hash_entry_s*)(padico_malloc_func( h->size * sizeof(struct padico_psp_slot_hash_entry_s) , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); for(i = 0; i < h->size; i++) { h->table[i].key = (( uint32_t )0) ; h->table[i].data = ( padico_psp_slot_t )0; h->table[i].next = NULL; } padico_psp_slot_hash_entry_rehash_n(h, 16 ); }
 
uint32_t padico_psp_slot_t data { padico_psp_slot_hash_entry_rehash_n(h, 16 )
 
struct padico_psp_slot_hash_entry_s * e = padico_psp_slot_hash_entry_lookup(h, key)
 
 else { if(h->load >= h->size * 3 / 4) { padico_psp_slot_hash_rehash_trigger(h); } padico_psp_slot_hash_entry_insert(h, key, data)
 
h load
 
const uint32_t uint32_t * outkey
 
struct padico_psp_slot_hash_entry_s * prev = NULL
 
padico_psp_slot_hashtable_t h { assert(h != NULL)
 
e i = -1
 
e current = NULL
 

Detailed Description

A simple low-level packet-based messaging API, for networks with implicit connection.

Macro Definition Documentation

◆ PADICO_PSP_ADAPTER_MASK

#define PADICO_PSP_ADAPTER_MASK   ((uint32_t)0xFF000000)

Definition at line 71 of file PSP.h.

◆ PADICO_PSP_CIRCUIT

#define PADICO_PSP_CIRCUIT   ((uint32_t)0x02000000)

Circuit/PSP.

Definition at line 62 of file PSP.h.

◆ PADICO_PSP_CLOSE_CHANNEL

#define PADICO_PSP_CLOSE_CHANNEL   ((uint32_t)0xF1000000)

[ reserved for internal use ]

Definition at line 68 of file PSP.h.

◆ PADICO_PSP_CONTROL

#define PADICO_PSP_CONTROL   ((uint32_t)0x01000000)

Control/PSP.

Definition at line 61 of file PSP.h.

◆ PADICO_PSP_INSTANCE_MASK

#define PADICO_PSP_INSTANCE_MASK   ((uint32_t)0x00FFFFFF)

Definition at line 72 of file PSP.h.

◆ PADICO_PSP_MINIDRIVER

#define PADICO_PSP_MINIDRIVER   ((uint32_t)0x05000000)

Minidriver_PSP.

Definition at line 65 of file PSP.h.

◆ PADICO_PSP_NEWMADICO

#define PADICO_PSP_NEWMADICO   ((uint32_t)0x04000000)

Newmadico.

Definition at line 64 of file PSP.h.

◆ PADICO_PSP_RESERVED

#define PADICO_PSP_RESERVED   ((uint32_t)0xF0000000)

Definition at line 67 of file PSP.h.

◆ PADICO_PSP_SYSTEM

#define PADICO_PSP_SYSTEM   ((uint32_t)0xF2000000)

[ reserved for internal use ]

Definition at line 69 of file PSP.h.

◆ PADICO_PSP_TAG_NONE

#define PADICO_PSP_TAG_NONE   ((uint32_t)0x00000000)

uninitialized tag

Definition at line 60 of file PSP.h.

◆ PADICO_PSP_VOPW

#define PADICO_PSP_VOPW   ((uint32_t)0x03000000)

VLink_Packet.

Definition at line 63 of file PSP.h.

Typedef Documentation

◆ padico_psp_connection_t

An outgoing connection object, supposed to be opaque for the user.

Definition at line 108 of file PSP.h.

◆ padico_psp_handler_t

A callback for PSP.

Note
the callback must call '*pump' with the same number and size of packets as the sender called 'pack'.

Definition at line 103 of file PSP.h.

◆ padico_psp_pump_t

typedef void(* padico_psp_pump_t) (void *token, void *bytes, size_t size)

the function to pump data in PSP callbacks

Definition at line 97 of file PSP.h.

◆ padico_psp_slot_hash_destructor_t

typedef void(* padico_psp_slot_hash_destructor_t) (uint32_t key, padico_psp_slot_t data)

Definition at line 229 of file PSP.h.

◆ padico_psp_slot_hash_entry_allocator_t

◆ padico_psp_slot_hash_entry_block_lfstack_t

◆ padico_psp_slot_hash_entry_slice_lfstack_t

◆ padico_psp_slot_hash_eqfunc_t

typedef int(* padico_psp_slot_hash_eqfunc_t) (uint32_t key1, uint32_t key2)

Definition at line 229 of file PSP.h.

◆ padico_psp_slot_hash_hfunc_t

typedef uint32_t(* padico_psp_slot_hash_hfunc_t) (uint32_t key)

Definition at line 229 of file PSP.h.

◆ padico_psp_slot_hashtable_enumerator_t

◆ padico_psp_slot_hashtable_t

◆ padico_psp_slot_t

Function Documentation

◆ __attribute__() [1/4]

◆ __attribute__() [2/4]

__attribute__ ( (unused)  )

explicit thread level

get the seq part of a tagged ptr

pop key & data of any element in the table

remove entry with given key from hashtable; does nothing if key not found

allocate a new hashtable

make progress on rehash for n rows

force rehashing of given row

lookup in the oldtable; if found, migrate row and return cell in regular table

default compile-time thread level

Definition at line 229 of file PSP.h.

◆ __attribute__() [3/4]

__attribute__ ( (unused, nonnull(1))  )

insert an entry into a hashtable

returns <key,value> associated with given key, outkey is set to NULL if key not found

probes whether an entry with given key exists in the hashtable

returns value associated with key, NULL if not found

◆ __attribute__() [4/4]

__attribute__ ( (unused, nonnull)  )

initialize a new hashtable

deallocate a hashtable

destroy a hashtable

Definition at line 229 of file PSP.h.

◆ assert() [1/5]

assert ( cell !  = NULL)

◆ assert() [2/5]

assert ( e->h !  = NULL)

◆ assert() [3/5]

assert ( e->h->  oldtable = =NULL)

◆ assert() [4/5]

assert ( key !  = ((uint32_t) 0))

◆ assert() [5/5]

assert ( slab_size  ,
0   
)

Referenced by padico_psp_tag_build().

◆ cell()

◆ if() [1/12]

if ( !  single) & -> _lock)

◆ if() [2/12]

if ( _cell !  = NULL)

Definition at line 229 of file PSP.h.

◆ if() [3/12]

if ( block !  = NULL)

◆ if() [4/12]

if ( check &&  rblocks !=allocated_blocks)

Definition at line 229 of file PSP.h.

◆ if() [5/12]

if ( data  ) = ( padico_psp_slot_t )0

◆ if() [6/12]

if ( e !  = NULL)

Definition at line 229 of file PSP.h.

◆ if() [7/12]

if ( e  )

Definition at line 229 of file PSP.h.

◆ if() [8/12]

if ( e->current &&e->current->  next)

Definition at line 229 of file PSP.h.

◆ if() [9/12]

if ( e->i< e->h->  size)

Definition at line 229 of file PSP.h.

◆ if() [10/12]

if ( h->  table = =NULL)

◆ if() [11/12]

if ( slice !  = NULL)

Definition at line 229 of file PSP.h.

◆ if() [12/12]

if ( source->key !  = (( uint32_t )0))

Definition at line 229 of file PSP.h.

◆ padico_free_func()

padico_free_func ( slice  ,
puk_mod_binary_get_profile()  ,
padico_module_self_name()  ,
__func__  ,
__FILE__  ,
__LINE__   
)

◆ padico_psp_connect()

◆ padico_psp_directory_init()

void padico_psp_directory_init ( struct padico_psp_directory_s *  d)

◆ padico_psp_end_message()

◆ padico_psp_init()

static void padico_psp_init ( const struct puk_receptacle_PadicoSimplePackets_s *  psp,
uint32_t  tag,
const char *  label,
size_t *  h_size,
padico_psp_handler_t  handler,
void *  key 
)
inlinestatic

◆ padico_psp_listen()

◆ padico_psp_new_message()

◆ padico_psp_pack()

◆ padico_psp_slot_hash_entry_allocator_init_thread()

padico_psp_slot_hash_entry_allocator_init_thread ( a  ,
slab_size  ,
(1)   
)

◆ padico_psp_slot_hash_entry_insert()

static void padico_psp_slot_hash_entry_insert ( padico_psp_slot_hashtable_t  h,
uint32_t  key,
padico_psp_slot_t  data 
)
inlinestatic

◆ padico_psp_slot_hash_entry_lookup()

static struct padico_psp_slot_hash_entry_s * padico_psp_slot_hash_entry_lookup ( padico_psp_slot_hashtable_t  h,
const uint32_t  key 
)
inlinestatic

◆ padico_psp_slot_hash_entry_oldprobe()

static int padico_psp_slot_hash_entry_oldprobe ( padico_psp_slot_hashtable_t  h,
const uint32_t  key 
)
inlinestatic

◆ padico_psp_slot_hash_entry_rehash_flush() [1/2]

padico_psp_slot_hash_entry_rehash_flush ( h  )

◆ padico_psp_slot_hash_entry_rehash_flush() [2/2]

static void padico_psp_slot_hash_entry_rehash_flush ( padico_psp_slot_hashtable_t  h)
inlinestatic

◆ padico_psp_slot_hash_entry_rehash_n()

static void padico_psp_slot_hash_entry_rehash_n ( padico_psp_slot_hashtable_t  h,
ssize_t  n 
)
inlinestatic

◆ padico_psp_slot_hash_entry_rehash_row()

static void padico_psp_slot_hash_entry_rehash_row ( padico_psp_slot_hashtable_t  h,
ssize_t  z 
)
inlinestatic

◆ padico_psp_slot_hashtable_remove()

padico_psp_slot_hashtable_remove ( h  ,
*  key 
)

Referenced by padico_psp_slot_remove().

◆ padico_psp_slot_insert()

◆ padico_psp_slot_lookup()

padico_psp_slot_t padico_psp_slot_lookup ( struct padico_psp_directory_s *  d,
uint32_t  tag 
)

Definition at line 93 of file psp.c.

References done, NULL, and tag.

Referenced by control_packet_handler(), psp_ibv_worker(), psp_mx_worker(), psp_shm_destroy(), and psp_shm_poll_handler().

◆ padico_psp_slot_remove()

◆ padico_psp_tag_build()

static uint32_t padico_psp_tag_build ( uint32_t  component_tag,
uint32_t  instance_tag 
)
inlinestatic

build a PSP tag from an component tag and an instance tag

Definition at line 76 of file PSP.h.

References assert(), done, PADICO_PSP_ADAPTER_MASK, and PADICO_PSP_INSTANCE_MASK.

◆ padico_psp_tag_eq()

static int padico_psp_tag_eq ( uint32_t  a,
uint32_t  b 
)
inlinestatic

Definition at line 223 of file PSP.h.

References a, and b.

◆ padico_psp_tag_get_component()

static uint32_t padico_psp_tag_get_component ( uint32_t  tag)
inlinestatic

get the 'component' (static) part from a PSP tag

Definition at line 84 of file PSP.h.

References PADICO_PSP_ADAPTER_MASK, and tag.

◆ padico_psp_tag_get_instance()

static uint32_t padico_psp_tag_get_instance ( uint32_t  tag)
inlinestatic

get the 'instance' (dynamic) part from a PSP tag

Definition at line 90 of file PSP.h.

References PADICO_PSP_INSTANCE_MASK, and tag.

◆ padico_psp_tag_hash()

static uint32_t padico_psp_tag_hash ( const uint32_t  a)
inlinestatic

Definition at line 219 of file PSP.h.

References a.

◆ puk_component_get_driver_PadicoSimplePackets()

static const struct padico_psp_driver_s * puk_component_get_driver_PadicoSimplePackets ( puk_component_t  component,
const char *  label 
)
inlinestatic

Definition at line 160 of file PSP.h.

◆ puk_component_get_facet_PadicoSimplePackets()

static puk_facet_t puk_component_get_facet_PadicoSimplePackets ( puk_component_t  c,
const char *  label 
)
inlinestatic

Definition at line 160 of file PSP.h.

◆ puk_component_indirect_PadicoSimplePackets()

static void puk_component_indirect_PadicoSimplePackets ( puk_component_t  component,
const char *  label,
const struct padico_psp_driver_s **  driver,
puk_context_t *  context 
)
inlinestatic

Definition at line 160 of file PSP.h.

◆ puk_context_indirect_PadicoSimplePackets()

static void puk_context_indirect_PadicoSimplePackets ( puk_context_t  context,
const char *  label,
const struct padico_psp_driver_s **  driver,
puk_context_t *  rcontext 
)
inlinestatic

Definition at line 160 of file PSP.h.

◆ puk_iface_PadicoSimplePackets()

static puk_iface_t puk_iface_PadicoSimplePackets ( void  )
inlinestatic

Attach the iface name to its driver.

Definition at line 160 of file PSP.h.

Referenced by bench_psp_init().

◆ puk_instance_context_indirect_PadicoSimplePackets()

static void puk_instance_context_indirect_PadicoSimplePackets ( puk_instance_t  instance,
const char *  label,
struct puk_receptacle_PadicoSimplePackets_s *  receptacle 
)
inlinestatic

Definition at line 160 of file PSP.h.

Referenced by vsock_vopw_create().

◆ puk_instance_indirect_PadicoSimplePackets()

static void puk_instance_indirect_PadicoSimplePackets ( puk_instance_t  instance,
const char *  label,
struct puk_receptacle_PadicoSimplePackets_s *  receptacle 
)
inlinestatic

Definition at line 160 of file PSP.h.

Referenced by bench_psp_init().

◆ puk_receptacle_PadicoSimplePackets_null()

static struct puk_receptacle_PadicoSimplePackets_s puk_receptacle_PadicoSimplePackets_null ( void  )
inlinestatic

Definition at line 160 of file PSP.h.

Referenced by vsock_vopw_fullshutdown().

◆ return()

return ( e !  = NULL)

◆ while() [1/5]

while ( 0  )

◆ while() [2/5]

while ( block !  = NULL)

◆ while() [3/5]

while ( e &&  e->key !=((uint32_t) 0))

Definition at line 229 of file PSP.h.

◆ while() [4/5]

◆ while() [5/5]

while ( slice !  = NULL)

Variable Documentation

◆ __attribute__

__attribute__

explicit thread level

pop key & data of any element in the table

remove entry with given key from hashtable; does nothing if key not found

returns <key,value> associated with given key, outkey is set to NULL if key not found

probes whether an entry with given key exists in the hashtable

returns value associated with key, NULL if not found

deallocate a hashtable

destroy a hashtable

allocate a new hashtable

initialize a new hashtable

make progress on rehash for n rows

force rehashing of given row

lookup in the oldtable; if found, migrate row and return cell in regular table

default compile-time thread level

Definition at line 229 of file PSP.h.

◆ _cell

Definition at line 229 of file PSP.h.

◆ _head

_stack _head = _cell

Definition at line 229 of file PSP.h.

◆ _next

_cell _next = _stack->_head

Definition at line 229 of file PSP.h.

◆ a

◆ allocated_blocks

int allocated_blocks = 0

Definition at line 229 of file PSP.h.

◆ b

◆ block

Definition at line 229 of file PSP.h.

◆ check

int check { int rblocks = 0

Definition at line 229 of file PSP.h.

◆ current

e current = NULL

Definition at line 229 of file PSP.h.

◆ data

Definition at line 229 of file PSP.h.

◆ do

Definition at line 229 of file PSP.h.

◆ e

◆ else

Definition at line 229 of file PSP.h.

◆ h

e h { assert(h != NULL)

Definition at line 229 of file PSP.h.

◆ i

e i = -1

Definition at line 229 of file PSP.h.

◆ key

uint32_t * key { if(h->oldtable) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); const ssize_t index = puk_hash_to_index(z, h->oldsize); struct padico_psp_slot_hash_entry_s*e = h->oldtable + index; while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { padico_psp_slot_hash_entry_rehash_row(h, index); padico_psp_slot_hash_entry_rehash_n(h, 16 ); return 1; } e = e->next; } } return 0

Definition at line 229 of file PSP.h.

Referenced by padico_psp_init().

◆ load

h load

Definition at line 229 of file PSP.h.

◆ n

ssize_t n { if(h->oldtable) { ssize_t k; for(k = 0; k < n; k++) { padico_psp_slot_hash_entry_rehash_row(h, h->rehashed + k); if(h->rehashed + k == h->oldsize - 1) { (padico_free_func( h->oldtable , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); h->oldtable = NULL; h->rehashed = 0; return; } } h->rehashed += k; } } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_insert( padico_psp_slot_hashtable_t h, uint32_t key, padico_psp_slot_t data) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); assert(h->table != NULL); struct padico_psp_slot_hash_entry_s*e = h->table + puk_hash_to_index(z, h->size); if(e->key != (( uint32_t )0) ) { while(e->next) { e = e->next; } e->next = padico_psp_slot_hash_entry_malloc(&h->entry_allocator); assert(e->next != NULL); e = e->next; } e->key = key; e->data = data; e->next = NULL; } __attribute__((unused)) static inline struct padico_psp_slot_hash_entry_s* padico_psp_slot_hash_entry_lookup( padico_psp_slot_hashtable_t h, const uint32_t key) { if(h->table == NULL) return NULL; const uint32_t z = (*( &padico_psp_tag_hash ))(key); struct padico_psp_slot_hash_entry_s*e = NULL; do { e = h->table + puk_hash_to_index(z, h->size); while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { return e; } e = e->next; } } while( padico_psp_slot_hash_entry_oldprobe(h, key)); return NULL; } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_rehash_flush( padico_psp_slot_hashtable_t h) { if(h->oldtable) { padico_psp_slot_hash_entry_rehash_n(h, h->oldsize); } assert(h->oldtable == NULL); } __attribute__((unused)) static void padico_psp_slot_hash_rehash_trigger( padico_psp_slot_hashtable_t h) { static const ssize_t hash_primes[] = { 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, -1 }; assert(hash_primes[0] == 11 ); assert(h->oldtable == NULL); h->oldtable = h->table; h->oldsize = h->size; h->rehashed = 0; int i = 0; while(h->size >= hash_primes[i]) { i++; } h->size = hash_primes[i]; assert(h->size > 0); assert(h->size > h->oldsize); h->table = (struct padico_psp_slot_hash_entry_s*)(padico_malloc_func( h->size * sizeof(struct padico_psp_slot_hash_entry_s) , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); for(i = 0; i < h->size; i++) { h->table[i].key = (( uint32_t )0) ; h->table[i].data = ( padico_psp_slot_t )0; h->table[i].next = NULL; } padico_psp_slot_hash_entry_rehash_n(h, 16 ); }

Definition at line 229 of file PSP.h.

◆ new_slab

a new_slab = 0

Definition at line 229 of file PSP.h.

◆ outkey

Definition at line 229 of file PSP.h.

◆ prev

prev = NULL

Definition at line 229 of file PSP.h.

◆ single

a single { if(!single) pthread_spin_lock(&_stack->_lock)

Definition at line 229 of file PSP.h.

◆ slab_size

a slab_size = slab_size

Definition at line 229 of file PSP.h.

◆ slice

◆ source

struct padico_psp_slot_hash_entry_s* source = h->oldtable + z

Definition at line 229 of file PSP.h.

◆ void

void

Definition at line 229 of file PSP.h.

◆ z

const uint32_t z { assert(h->oldtable != NULL)

Definition at line 229 of file PSP.h.