PadicoTM

Documentation

« back to PM2 home.
psp-mx.c File Reference
#include <Padico/Puk.h>
#include <Padico/Module.h>
#include <Padico/Topology.h>
#include <Padico/PSP.h>
#include <Padico/PM2.h>
#include <Padico/AddrDB.h>
#include <myriexpress.h>
#include <mx_internals/mx__driver_interface.h>
Include dependency graph for psp-mx.c:

Go to the source code of this file.

Data Structures

struct  psp_mx_status_s
 
struct  psp_mx_msghdr_s
 

Macros

#define PSP_MX_OP_NEWID   0x01
 
#define PSP_MX_OP_NEWMSG   0x02
 
#define PSP_MX_OP_HDR   0x04
 
#define PSP_MX_OP_PACK   0x08
 
#define PSP_MX_MASK_ID   0x00000000FFFFFF00
 
#define PSP_MX_MASK_OP   0x00000000000000FF
 
#define PSP_MX_MASK_TAG   0xFFFFFFFF00000000
 
#define PSP_MX_MAX_HDR   256
 

Functions

static int psp_mx_module_init (void)
 
static void psp_mx_module_finalize (void)
 
static void padico_module_create_initializer__PSP_MX (void)
 
static void * psp_mx_instantiate (puk_instance_t ai, puk_context_t context)
 
static void psp_mx_destroy (void *_status)
 
static void psp_mx_init (void *_status, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key)
 
static void psp_mx_connect (void *_status, padico_topo_node_t remote_node)
 
static padico_psp_connection_t psp_mx_new_message (void *_status, padico_topo_node_t node, void **_sbuf)
 
static void psp_mx_pack (void *_status, padico_psp_connection_t _conn, const char *bytes, size_t size)
 
static void psp_mx_end_message (void *_status, padico_psp_connection_t _conn)
 
static void * psp_mx_worker (void *dummy)
 
static void psp_mx_piom_lock (void)
 
static void psp_mx_piom_unlock (void)
 
static uint64_t psp_mx_match_raw (uint64_t id, uint64_t tag, uint64_t op)
 
static uint64_t psp_mx_match (struct psp_mx_status_s *status, uint64_t op)
 
static void psp_mx_checkrc (int rc, const char *op)
 
static void psp_mx_send (struct psp_mx_status_s *status, const void *bytes, size_t size, uint64_t match)
 
static void psp_mx_recv (void *bytes, size_t size, uint64_t mask, uint64_t match)
 
static void psp_mx_hsend (struct psp_mx_status_s *status)
 
static void psp_mx_pump (void *token, void *bytes, size_t size)
 

Variables

struct puk_mod_binary_s padico_mod_binary__PSP_MX = { .name = "PSP_MX", .funcs = &padico_mod_funcs__PSP_MX , .mod = NULL, .profile = { .total_mem = 0, .max_mem = 0, .num_malloc = 0, .num_free = 0 } , .auto_deps = & puk_mod_dep_0 , .n_deps = sizeof((char*[]){ 0, }) / sizeof(char*), .deps = { NULL, } }
 
static const struct puk_mod_funcs_s padico_mod_funcs__PSP_MX = { .init = ( psp_mx_module_init ), .run = ( NULL ), .finalize = ( psp_mx_module_finalize ) }
 
static const struct puk_component_driver_s psp_mx_component_driver
 instanciation facet for PSP-IBV
 
static const struct padico_psp_driver_s psp_mx_driver
 'SimplePackets' facet for PSP-IBV
 
struct { 
 
   mx_endpoint_t   endpoint 
 
   mx_request_t   req 
 
   pthread_t   worker 
 
   volatile int   power_on 
 set to 0 to ask the worker to stop More...
 
   struct padico_psp_directory_s   slots 
 PSP demultiplexing. More...
 
   struct psp_mx_conn_vect_s   conns 
 known connections, indexed by peer_id More...
 
   uint32_t   next_id 
 
   uint64_t   nic_id 
 
   padico_topo_network_t   network 
 
   struct { 
 
      const uint32_t   board_num 
 
      const uint32_t   endpoint_id 
 
      const uint32_t   filter 
 
      const int   timeout 
 
   }   param 
 
} psp_mx 
 

Macro Definition Documentation

◆ PSP_MX_MASK_ID

#define PSP_MX_MASK_ID   0x00000000FFFFFF00

Definition at line 157 of file psp-mx.c.

◆ PSP_MX_MASK_OP

#define PSP_MX_MASK_OP   0x00000000000000FF

Definition at line 158 of file psp-mx.c.

◆ PSP_MX_MASK_TAG

#define PSP_MX_MASK_TAG   0xFFFFFFFF00000000

Definition at line 159 of file psp-mx.c.

◆ PSP_MX_MAX_HDR

#define PSP_MX_MAX_HDR   256

Definition at line 161 of file psp-mx.c.

◆ PSP_MX_OP_HDR

#define PSP_MX_OP_HDR   0x04

Definition at line 154 of file psp-mx.c.

◆ PSP_MX_OP_NEWID

#define PSP_MX_OP_NEWID   0x01

Definition at line 152 of file psp-mx.c.

◆ PSP_MX_OP_NEWMSG

#define PSP_MX_OP_NEWMSG   0x02

Definition at line 153 of file psp-mx.c.

◆ PSP_MX_OP_PACK

#define PSP_MX_OP_PACK   0x08

Definition at line 155 of file psp-mx.c.

Function Documentation

◆ padico_module_create_initializer__PSP_MX()

static void padico_module_create_initializer__PSP_MX ( void  )
static

Definition at line 46 of file psp-mx.c.

◆ psp_mx_checkrc()

static void psp_mx_checkrc ( int  rc,
const char *  op 
)
inlinestatic

Definition at line 186 of file psp-mx.c.

References done, op, and rc.

Referenced by psp_mx_connect(), and psp_mx_module_init().

◆ psp_mx_connect()

◆ psp_mx_destroy()

static void psp_mx_destroy ( void *  _status)
static

Definition at line 324 of file psp-mx.c.

References done.

◆ psp_mx_end_message()

static void psp_mx_end_message ( void *  _status,
padico_psp_connection_t  _conn 
)
static

Definition at line 411 of file psp-mx.c.

References psp_mx_hsend().

◆ psp_mx_hsend()

◆ psp_mx_init()

◆ psp_mx_instantiate()

static void * psp_mx_instantiate ( puk_instance_t  ai,
puk_context_t  context 
)
static

Definition at line 316 of file psp-mx.c.

References done, NULL, psp_mx_status_s::peer, and psp_mx_status_s::slot.

◆ psp_mx_match()

static uint64_t psp_mx_match ( struct psp_mx_status_s *  status,
uint64_t  op 
)
inlinestatic

Definition at line 176 of file psp-mx.c.

References done, op, psp_mx_status_s::peer_id, psp_mx_match_raw(), tag, and psp_mx_status_s::tag.

Referenced by psp_mx_hsend(), and psp_mx_pack().

◆ psp_mx_match_raw()

static uint64_t psp_mx_match_raw ( uint64_t  id,
uint64_t  tag,
uint64_t  op 
)
inlinestatic

Definition at line 170 of file psp-mx.c.

References op, and tag.

Referenced by psp_mx_match(), and psp_mx_pump().

◆ psp_mx_module_finalize()

static void psp_mx_module_finalize ( void  )
static

Definition at line 308 of file psp-mx.c.

References done, NULL, and psp_mx.

◆ psp_mx_module_init()

◆ psp_mx_new_message()

static padico_psp_connection_t psp_mx_new_message ( void *  _status,
padico_topo_node_t  node,
void **  _sbuf 
)
static

Definition at line 384 of file psp-mx.c.

References psp_mx_msghdr_s::data, done, psp_mx_status_s::hsent, and psp_mx_status_s::sbuf.

◆ psp_mx_pack()

static void psp_mx_pack ( void *  _status,
padico_psp_connection_t  _conn,
const char *  bytes,
size_t  size 
)
static

Definition at line 403 of file psp-mx.c.

References psp_mx_hsend(), psp_mx_match(), PSP_MX_OP_PACK, psp_mx_send(), and size.

◆ psp_mx_piom_lock()

static void psp_mx_piom_lock ( void  )
inlinestatic

Definition at line 143 of file psp-mx.c.

Referenced by psp_mx_recv(), psp_mx_send(), and psp_mx_worker().

◆ psp_mx_piom_unlock()

static void psp_mx_piom_unlock ( void  )
inlinestatic

Definition at line 146 of file psp-mx.c.

Referenced by psp_mx_recv(), psp_mx_send(), and psp_mx_worker().

◆ psp_mx_pump()

static void psp_mx_pump ( void *  token,
void *  bytes,
size_t  size 
)
static

◆ psp_mx_recv()

static void psp_mx_recv ( void *  bytes,
size_t  size,
uint64_t  mask,
uint64_t  match 
)
inlinestatic

Definition at line 222 of file psp-mx.c.

References done, NULL, psp_mx, psp_mx_piom_lock(), psp_mx_piom_unlock(), rc, req, seg, and size.

Referenced by psp_mx_connect(), and psp_mx_pump().

◆ psp_mx_send()

static void psp_mx_send ( struct psp_mx_status_s *  status,
const void *  bytes,
size_t  size,
uint64_t  match 
)
inlinestatic

◆ psp_mx_worker()

Variable Documentation

◆ board_num

const uint32_t board_num

Definition at line 116 of file psp-mx.c.

◆ conns

known connections, indexed by peer_id

Definition at line 110 of file psp-mx.c.

◆ endpoint

mx_endpoint_t endpoint

Definition at line 102 of file psp-mx.c.

◆ endpoint_id

const uint32_t endpoint_id

Definition at line 117 of file psp-mx.c.

◆ filter

const uint32_t filter

Definition at line 118 of file psp-mx.c.

Referenced by topo_binding_serialize().

◆ network

◆ next_id

uint32_t next_id

Definition at line 111 of file psp-mx.c.

◆ nic_id

uint64_t nic_id

Definition at line 112 of file psp-mx.c.

◆ padico_mod_binary__PSP_MX

struct puk_mod_binary_s padico_mod_binary__PSP_MX = { .name = "PSP_MX", .funcs = &padico_mod_funcs__PSP_MX , .mod = NULL, .profile = { .total_mem = 0, .max_mem = 0, .num_malloc = 0, .num_free = 0 } , .auto_deps = & puk_mod_dep_0 , .n_deps = sizeof((char*[]){ 0, }) / sizeof(char*), .deps = { NULL, } }

Definition at line 46 of file psp-mx.c.

◆ padico_mod_funcs__PSP_MX

const struct puk_mod_funcs_s padico_mod_funcs__PSP_MX = { .init = ( psp_mx_module_init ), .run = ( NULL ), .finalize = ( psp_mx_module_finalize ) }
static

Definition at line 46 of file psp-mx.c.

◆ [struct]

struct { ... } param

◆ power_on

volatile int power_on

set to 0 to ask the worker to stop

Definition at line 105 of file psp-mx.c.

◆ [struct]

typdef struct psp_mx_conn_vect_s* static psp_mx_conn_vect_t struct { ... } psp_mx
Initial value:
= {
.power_on = 0,
.next_id = 1,
.param.board_num = 0,
.param.endpoint_id = 1,
.param.filter = 0x12341234,
.param.timeout = 10
}

Referenced by psp_mx_connect(), psp_mx_init(), psp_mx_module_finalize(), psp_mx_module_init(), psp_mx_recv(), psp_mx_send(), and psp_mx_worker().

◆ psp_mx_component_driver

const struct puk_component_driver_s psp_mx_component_driver
static
Initial value:
=
{
.instantiate = &psp_mx_instantiate,
.destroy = &psp_mx_destroy
}
static void * psp_mx_instantiate(puk_instance_t ai, puk_context_t context)
Definition psp-mx.c:316
static void psp_mx_destroy(void *_status)
Definition psp-mx.c:324

instanciation facet for PSP-IBV

Definition at line 68 of file psp-mx.c.

Referenced by psp_mx_module_init().

◆ psp_mx_driver

const struct padico_psp_driver_s psp_mx_driver
static
Initial value:
=
{
.init = &psp_mx_init,
.connect = &psp_mx_connect,
.new_message = &psp_mx_new_message,
.pack = &psp_mx_pack,
.end_message = &psp_mx_end_message
}
static void psp_mx_init(void *_status, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key)
Definition psp-mx.c:332
static void psp_mx_pack(void *_status, padico_psp_connection_t _conn, const char *bytes, size_t size)
Definition psp-mx.c:403
static void psp_mx_end_message(void *_status, padico_psp_connection_t _conn)
Definition psp-mx.c:411
static padico_psp_connection_t psp_mx_new_message(void *_status, padico_topo_node_t node, void **_sbuf)
Definition psp-mx.c:384
static void psp_mx_connect(void *_status, padico_topo_node_t remote_node)
Definition psp-mx.c:352

'SimplePackets' facet for PSP-IBV

Definition at line 77 of file psp-mx.c.

Referenced by psp_mx_module_init().

◆ req

◆ slots

PSP demultiplexing.

Definition at line 109 of file psp-mx.c.

◆ timeout

◆ worker

pthread_t worker

Definition at line 104 of file psp-mx.c.