Motr  M0
Collaboration diagram for Network:

Data Structures

struct  net_test_network_bd
 
struct  net_test_network_bds_header
 

Functions

static struct m0_net_test_network_ctxcb_ctx_extract (const struct m0_net_buffer_event *ev)
 
static uint32_t cb_buf_index_extract (const struct m0_net_buffer_event *ev, struct m0_net_test_network_ctx *ctx, enum m0_net_queue_type q)
 
static void cb_default (const struct m0_net_buffer_event *ev)
 
static int net_test_buf_init (struct m0_net_buffer *buf, m0_bcount_t size, struct m0_net_test_network_ctx *ctx, bool is_pingbuf)
 
static void net_test_buf_fini (struct m0_net_buffer *buf, struct m0_net_domain *dom)
 
static void net_test_bufs_fini (struct m0_net_buffer *buf, uint32_t buf_nr, struct m0_net_domain *dom)
 
static int net_test_bufs_init (struct m0_net_buffer *buf, uint32_t buf_nr, m0_bcount_t size, struct m0_net_test_network_ctx *ctx)
 
static void net_test_tm_stop (struct m0_net_transfer_mc *tm)
 
bool m0_net_test_network_ctx_invariant (struct m0_net_test_network_ctx *ctx)
 
static int net_test_network_ctx_initfini (struct m0_net_test_network_ctx *ctx, struct m0_net_test_network_cfg *cfg, const char *tm_addr)
 
int m0_net_test_network_ctx_init (struct m0_net_test_network_ctx *ctx, struct m0_net_test_network_cfg *cfg, const char *tm_addr)
 
void m0_net_test_network_ctx_fini (struct m0_net_test_network_ctx *ctx)
 
int m0_net_test_network_ep_add (struct m0_net_test_network_ctx *ctx, const char *ep_addr)
 
int m0_net_test_network_ep_add_slist (struct m0_net_test_network_ctx *ctx, const struct m0_net_test_slist *eps)
 
static int net_test_buf_queue (struct m0_net_test_network_ctx *ctx, struct m0_net_buffer *nb, enum m0_net_queue_type q)
 
int m0_net_test_network_msg_send_ep (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index, struct m0_net_end_point *ep)
 
int m0_net_test_network_msg_send (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index, uint32_t ep_index)
 
int m0_net_test_network_msg_recv (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index)
 
int m0_net_test_network_bulk_enqueue (struct m0_net_test_network_ctx *ctx, int32_t buf_bulk_index, int32_t ep_index, enum m0_net_queue_type q)
 
void m0_net_test_network_buffer_dequeue (struct m0_net_test_network_ctx *ctx, enum m0_net_test_network_buf_type buf_type, int32_t buf_index)
 
 TYPE_DESCR (net_test_network_bd)
 
 TYPE_DESCR (net_test_network_bds_header)
 
static m0_bcount_t network_bd_serialize (enum m0_net_test_serialize_op op, struct m0_net_buffer *buf, struct m0_bufvec *bv, m0_bcount_t bv_offset)
 
static m0_bcount_t network_bds_serialize (enum m0_net_test_serialize_op op, size_t *nr, struct m0_bufvec *bv)
 
static size_t network_bd_nr_add (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index, int32_t value)
 
m0_bcount_t m0_net_test_network_bd_serialize (enum m0_net_test_serialize_op op, struct m0_net_test_network_ctx *ctx, uint32_t buf_bulk_index, uint32_t buf_ping_index, m0_bcount_t offset)
 
size_t m0_net_test_network_bd_nr (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index)
 
void m0_net_test_network_bd_nr_dec (struct m0_net_test_network_ctx *ctx, uint32_t buf_ping_index)
 
struct m0_net_bufferm0_net_test_network_buf (struct m0_net_test_network_ctx *ctx, enum m0_net_test_network_buf_type buf_type, uint32_t buf_index)
 
int m0_net_test_network_buf_resize (struct m0_net_test_network_ctx *ctx, enum m0_net_test_network_buf_type buf_type, uint32_t buf_index, m0_bcount_t new_size)
 
void m0_net_test_network_buf_fill (struct m0_net_test_network_ctx *ctx, enum m0_net_test_network_buf_type buf_type, uint32_t buf_index, uint8_t fill)
 
struct m0_net_end_pointm0_net_test_network_ep (struct m0_net_test_network_ctx *ctx, size_t ep_index)
 
ssize_t m0_net_test_network_ep_search (struct m0_net_test_network_ctx *ctx, const char *ep_addr)
 
struct m0_net_test_network_timeouts m0_net_test_network_timeouts_never (void)
 

Variables

static struct m0_net_buffer_callbacks net_test_network_buf_cb
 

Detailed Description

Todo:

add timeouts to channels and network buffers

align code (function parameters etc.)

cache m0_vec_count()

See also
Motr Network Benchmark

Function Documentation

◆ cb_buf_index_extract()

static uint32_t cb_buf_index_extract ( const struct m0_net_buffer_event ev,
struct m0_net_test_network_ctx ctx,
enum m0_net_queue_type  q 
)
static

Get buffer number in net-test network context for the buffer event.

Definition at line 60 of file network.c.

Here is the caller graph for this function:

◆ cb_ctx_extract()

static struct m0_net_test_network_ctx* cb_ctx_extract ( const struct m0_net_buffer_event ev)
static

Get net-test network context for the buffer event.

Definition at line 52 of file network.c.

Here is the caller graph for this function:

◆ cb_default()

static void cb_default ( const struct m0_net_buffer_event ev)
static

Default callback for all network buffers. Calls user-defined callback for the buffer.

See also
net_test_buf_init()

Definition at line 87 of file network.c.

Here is the call graph for this function:

◆ m0_net_test_network_bd_nr()

size_t m0_net_test_network_bd_nr ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index 
)

Get number of stored network buffer descriptors in ping buffer.

See also
Using bulk buffer network descriptors
m0_net_test_network_bd_serialize()
Precondition
ctx != NULL
buf_ping_index < ctx->ntc_cfg.ntncfg_buf_ping_nr

Definition at line 712 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_bd_nr_dec()

void m0_net_test_network_bd_nr_dec ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index 
)

Decrease number of network buffer descriptors in ping buffer. This function simply decreases number of network buffer descriptors stored in ping buffer.

See also
Using bulk buffer network descriptors
m0_net_test_network_bd_serialize()

Definition at line 718 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_bd_serialize()

m0_bcount_t m0_net_test_network_bd_serialize ( enum m0_net_test_serialize_op  op,
struct m0_net_test_network_ctx ctx,
uint32_t  buf_bulk_index,
uint32_t  buf_ping_index,
m0_bcount_t  offset 
)

Serialize or deserialize bulk buffer network transport descriptor to/from ping buffer.

See also
Using bulk buffer network descriptors
Parameters
opSerialization operation.
ctxNet-test network context.
buf_bulk_indexBulk buffer index. Buffer descriptor will be taken from this buffer for serialization and set for this buffer after deserialization.
buf_ping_indexPing buffer index. This buffer will be used as container to serialized buffer descriptors.
offsetOffset in the ping buffer to serialize/deserialize network descriptor. Should have value 0 for the first descriptor when serializing/deserializing.
Returns
length of serialized/deserialized buffer descriptor.
Precondition
op == M0_NET_TEST_SERIALIZE || op == M0_NET_TEST_DESERIALIZE
ctx != NULL
buf_bulk_index < ctx->ntc_cfg.ntncfg_buf_bulk_nr
buf_ping_index < ctx->ntc_cfg.ntncfg_buf_ping_nr
Todo:
possible security vulnerability because bounds are not checked

Definition at line 655 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_buf()

struct m0_net_buffer* m0_net_test_network_buf ( struct m0_net_test_network_ctx ctx,
enum m0_net_test_network_buf_type  buf_type,
uint32_t  buf_index 
)

Accessor to buffers in net-test network context.

Definition at line 725 of file network.c.

Here is the caller graph for this function:

◆ m0_net_test_network_buf_fill()

void m0_net_test_network_buf_fill ( struct m0_net_test_network_ctx ctx,
enum m0_net_test_network_buf_type  buf_type,
uint32_t  buf_index,
uint8_t  fill 
)

Fill entire buffer m0_bufvec with char ch. Useful for unit tests.

Todo:
use m0_bufvec_cursor_step

Definition at line 756 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_buf_resize()

int m0_net_test_network_buf_resize ( struct m0_net_test_network_ctx ctx,
enum m0_net_test_network_buf_type  buf_type,
uint32_t  buf_index,
m0_bcount_t  new_size 
)
Todo:
isn't safe because net_test_buf_init() can fail

Definition at line 741 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_buffer_dequeue()

void m0_net_test_network_buffer_dequeue ( struct m0_net_test_network_ctx ctx,
enum m0_net_test_network_buf_type  buf_type,
int32_t  buf_index 
)

Remove network buffer from queue.

See also
m0_net_buffer_del()
Parameters
ctxNet-test network context.
buf_indexIndex of buffer in ctx->ntc_buf_bulk or ntc->buf_ping arrays, depending on buf_type parameter.
buf_typeBuffer type.

Definition at line 500 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_bulk_enqueue()

int m0_net_test_network_bulk_enqueue ( struct m0_net_test_network_ctx ctx,
int32_t  buf_bulk_index,
int32_t  ep_index,
enum m0_net_queue_type  q 
)

Add bulk buffer to bulk passive/active send/recv queue.

Parameters
ctxNet-test network context.
buf_bulk_indexIndex of buffer in ctx->ntc_buf_bulk array.
ep_indexEntry point index in ctx->ntc_ep array. Makes sense only for passive send/recv queue.
qQueue type. Should be one of bulk queue types.

Definition at line 479 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ctx_fini()

void m0_net_test_network_ctx_fini ( struct m0_net_test_network_ctx ctx)

Finalize net-test network context

Definition at line 374 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ctx_init()

int m0_net_test_network_ctx_init ( struct m0_net_test_network_ctx ctx,
struct m0_net_test_network_cfg cfg,
const char *  tm_addr 
)

Initialize net-test network context. Allocate ping and bulk buffers.

Parameters
ctxnet-test network context structure.
cfgnet-test network context configuration. Function will make make a copy of this structure in ctx, so there is no need to keep cfg valid until m0_net_test_network_ctx_fini().
tm_addrtransfer machine address (example: "0@lo:12345:42:1024")
Note
if cfg.ntncfg_sync parameter is set, then m0_net_buffer_event_deliver_synchronously() will be called for transfer machine and m0_net_buffer_event_deliver_all() should be used for buffer event delivery.
See also
m0_net_test_network_ctx
m0_net_test_network_cfg
Precondition
ctx != NULL
cfg != NULL
tm_addr != NULL
Postcondition
m0_net_test_network_ctx_invariant(ctx)
Returns
0 (success)
-ECONNREFUSED m0_net_tm_start() failed.
-errno (failire)
Todo:
create configuration structure instead a lot of parameters

Definition at line 367 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ctx_invariant()

bool m0_net_test_network_ctx_invariant ( struct m0_net_test_network_ctx ctx)

Invariant for net-test network context

Definition at line 249 of file network.c.

Here is the caller graph for this function:

◆ m0_net_test_network_ep()

struct m0_net_end_point* m0_net_test_network_ep ( struct m0_net_test_network_ctx ctx,
size_t  ep_index 
)

Accessor for endpoints by index.

Definition at line 783 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ep_add()

int m0_net_test_network_ep_add ( struct m0_net_test_network_ctx ctx,
const char *  ep_addr 
)

Add endpoint to m0_net_test_network_ctx structure.

Returns
endpoint number.
-E2BIG ctx->ntc_ep already contains maximum number of endpoints.
-errno (if failure)
Precondition
m0_net_test_network_ctx_invariant(ctx)
ep_addr != NULL

Definition at line 380 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ep_add_slist()

int m0_net_test_network_ep_add_slist ( struct m0_net_test_network_ctx ctx,
const struct m0_net_test_slist eps 
)

Add endpoints to m0_net_test_network_ctx structure. If some endpoint addition fails, then no endpoints will be added to network context and all added endpoints will be m0_net_end_point_put()'ed.

Returns
-E2BIG ctx->ntc_ep already contains maximum number of endpoints.
Precondition
m0_net_test_network_ctx_invariant(ctx)
m0_net_test_slist_invariant(eps)
Postcondition
m0_net_test_network_ctx_invariant(ctx)

Definition at line 400 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_ep_search()

ssize_t m0_net_test_network_ep_search ( struct m0_net_test_network_ctx ctx,
const char *  ep_addr 
)

Search for ep_addr in m0_net_test_network_ctx.ntc_ep This function have time complexity of O(number of endpoints in the network context).

Returns
>= 0 endpoint index
-1 endpoint not found

Definition at line 791 of file network.c.

Here is the caller graph for this function:

◆ m0_net_test_network_msg_recv()

int m0_net_test_network_msg_recv ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index 
)

Add message to network messages receive queue.

See also
m0_net_test_network_msg_send()

Definition at line 469 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_msg_send()

int m0_net_test_network_msg_send ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index,
uint32_t  ep_index 
)

Add message buffer to network messages send queue.

Parameters
ctxNet-test network context.
buf_ping_indexIndex of buffer in ctx->ntc_buf_ping array.
ep_indexEntry point index in ctx->ntc_ep array. Entry points should be added to this array prior to calling this function using m0_net_test_network_ep_add(). Message will be sent to this endpoint.

Definition at line 457 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_msg_send_ep()

int m0_net_test_network_msg_send_ep ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index,
struct m0_net_end_point ep 
)

Add message buffer to network messages send queue. Use struct m0_net_end_point instead of endpoint index.

See also
m0_net_test_network_msg_send()

Definition at line 442 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_network_timeouts_never()

struct m0_net_test_network_timeouts m0_net_test_network_timeouts_never ( void  )

Return m0_net_test_network_timeouts, filled with M0_TIME_NEVER. Useful because M0_TIME_NEVER is declared as "extern const".

Definition at line 803 of file network.c.

Here is the caller graph for this function:

◆ net_test_buf_fini()

static void net_test_buf_fini ( struct m0_net_buffer buf,
struct m0_net_domain dom 
)
static

Definition at line 187 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_buf_init()

static int net_test_buf_init ( struct m0_net_buffer buf,
m0_bcount_t  size,
struct m0_net_test_network_ctx ctx,
bool  is_pingbuf 
)
static

Initialize network buffer with given size (allocate and register within domain).

See also
cb_default()
Precondition
buf != NULL

Definition at line 129 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_buf_queue()

static int net_test_buf_queue ( struct m0_net_test_network_ctx ctx,
struct m0_net_buffer nb,
enum m0_net_queue_type  q 
)
static

Definition at line 424 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_bufs_fini()

static void net_test_bufs_fini ( struct m0_net_buffer buf,
uint32_t  buf_nr,
struct m0_net_domain dom 
)
static

Definition at line 197 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_bufs_init()

static int net_test_bufs_init ( struct m0_net_buffer buf,
uint32_t  buf_nr,
m0_bcount_t  size,
struct m0_net_test_network_ctx ctx 
)
static

Definition at line 207 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_network_ctx_initfini()

static int net_test_network_ctx_initfini ( struct m0_net_test_network_ctx ctx,
struct m0_net_test_network_cfg cfg,
const char *  tm_addr 
)
static
Todo:
make ctx->ntc_dom embedded into ctx
Todo:
replace gmc and ctx

Definition at line 256 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_test_tm_stop()

static void net_test_tm_stop ( struct m0_net_transfer_mc tm)
static

Stop transfer machine and wait for state transition

Definition at line 229 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ network_bd_nr_add()

static size_t network_bd_nr_add ( struct m0_net_test_network_ctx ctx,
uint32_t  buf_ping_index,
int32_t  value 
)
static

Number of serialized network buffer descriptors in ping buffer is stored inside ping buffer in serialized form. This function modifies this number.

Parameters
ctxNetwork context
buf_ping_indexIndex of ping buffer
valueThis value will be added to the number of serialized network buffer descriptors. Can be -1, 0, 1. If it is -1, then function will M0_ASSERT() that number will not underflow.
Returns
New value of number of serialized network buffer descriptors.

Definition at line 626 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ network_bd_serialize()

static m0_bcount_t network_bd_serialize ( enum m0_net_test_serialize_op  op,
struct m0_net_buffer buf,
struct m0_bufvec bv,
m0_bcount_t  bv_offset 
)
static
See also
m0_net_test_serialize()

Definition at line 542 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ network_bds_serialize()

static m0_bcount_t network_bds_serialize ( enum m0_net_test_serialize_op  op,
size_t *  nr,
struct m0_bufvec bv 
)
static

Definition at line 585 of file network.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TYPE_DESCR() [1/2]

TYPE_DESCR ( net_test_network_bd  )

net_test_network_bd_descr

◆ TYPE_DESCR() [2/2]

TYPE_DESCR ( net_test_network_bds_header  )

net_test_network_bds_header_descr

Variable Documentation

◆ net_test_network_buf_cb