Motr  M0
Collaboration diagram for Commands:

Functions

 TYPE_DESCR (m0_net_test_cmd)
 
 TYPE_DESCR (m0_net_test_cmd_done)
 
 TYPE_DESCR (m0_net_test_cmd_init)
 
 TYPE_DESCR (m0_net_test_msg_nr)
 
 TYPE_DESCR (m0_net_test_cmd_status_data)
 
static m0_bcount_t cmd_status_data_serialize (enum m0_net_test_serialize_op op, struct m0_net_test_cmd_status_data *sd, struct m0_bufvec *bv, m0_bcount_t offset)
 
static int cmd_serialize (enum m0_net_test_serialize_op op, struct m0_net_test_cmd *cmd, struct m0_net_buffer *buf, m0_bcount_t offset, m0_bcount_t *length)
 
static void cmd_free (struct m0_net_test_cmd *cmd)
 
static struct m0_net_test_cmd_ctxcmd_ctx_extract (struct m0_net_test_network_ctx *net_ctx)
 
static void commands_tm_event_cb (const struct m0_net_tm_event *ev)
 
static void commands_cb_msg_recv (struct m0_net_test_network_ctx *net_ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static void commands_cb_msg_send (struct m0_net_test_network_ctx *net_ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static void commands_cb_impossible (struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
 
static int commands_recv_enqueue (struct m0_net_test_cmd_ctx *ctx, size_t buf_index)
 
static void commands_recv_dequeue (struct m0_net_test_cmd_ctx *ctx, size_t buf_index)
 
static void commands_recv_ep_put (struct m0_net_test_cmd_ctx *ctx, size_t buf_index)
 
static bool is_buf_in_recv_q (struct m0_net_test_cmd_ctx *ctx, size_t buf_index)
 
static void commands_recv_dequeue_nr (struct m0_net_test_cmd_ctx *ctx, size_t nr)
 
static int commands_initfini (struct m0_net_test_cmd_ctx *ctx, const char *cmd_ep, m0_time_t send_timeout, m0_net_test_commands_send_cb_t send_cb, struct m0_net_test_slist *ep_list, bool init)
 
int m0_net_test_commands_init (struct m0_net_test_cmd_ctx *ctx, const char *cmd_ep, m0_time_t send_timeout, m0_net_test_commands_send_cb_t send_cb, struct m0_net_test_slist *ep_list)
 
void m0_net_test_commands_fini (struct m0_net_test_cmd_ctx *ctx)
 
int m0_net_test_commands_send (struct m0_net_test_cmd_ctx *ctx, struct m0_net_test_cmd *cmd)
 
void m0_net_test_commands_send_wait_all (struct m0_net_test_cmd_ctx *ctx)
 
int m0_net_test_commands_recv (struct m0_net_test_cmd_ctx *ctx, struct m0_net_test_cmd *cmd, m0_time_t deadline)
 
int m0_net_test_commands_recv_enqueue (struct m0_net_test_cmd_ctx *ctx, size_t buf_index)
 
void m0_net_test_commands_received_free (struct m0_net_test_cmd *cmd)
 
bool m0_net_test_commands_invariant (struct m0_net_test_cmd_ctx *ctx)
 

Variables

static const struct m0_net_tm_callbacks net_test_commands_tm_cb
 
static const struct m0_net_test_network_buffer_callbacks commands_buffer_cb
 

Detailed Description

See also
Motr Network Benchmark

Function Documentation

◆ cmd_ctx_extract()

static struct m0_net_test_cmd_ctx* cmd_ctx_extract ( struct m0_net_test_network_ctx net_ctx)
static

Definition at line 215 of file commands.c.

Here is the caller graph for this function:

◆ cmd_free()

static void cmd_free ( struct m0_net_test_cmd cmd)
static

Free m0_net_test_cmd after successful cmd_serialize(M0_NET_TEST_DESERIALIZE, ...).

Definition at line 204 of file commands.c.

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

◆ cmd_serialize()

static int cmd_serialize ( enum m0_net_test_serialize_op  op,
struct m0_net_test_cmd cmd,
struct m0_net_buffer buf,
m0_bcount_t  offset,
m0_bcount_t length 
)
static

Serialize/deserialize m0_net_test_cmd to/from m0_net_buffer

Parameters
opoperation. Can be M0_NET_TEST_SERIALIZE or M0_NET_TEST_DESERIALIZE
cmdcommand for transforming.
bufcan be NULL if op == M0_NET_TEST_SERIALIZE, in this case offset is ignored but length is set.
offsetstart of serialized data in buf.
lengthif isn't NULL then store length of serialized command here.

Definition at line 142 of file commands.c.

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

◆ cmd_status_data_serialize()

static m0_bcount_t cmd_status_data_serialize ( enum m0_net_test_serialize_op  op,
struct m0_net_test_cmd_status_data sd,
struct m0_bufvec bv,
m0_bcount_t  offset 
)
static

Definition at line 88 of file commands.c.

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

◆ commands_cb_impossible()

static void commands_cb_impossible ( struct m0_net_test_network_ctx ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 274 of file commands.c.

◆ commands_cb_msg_recv()

static void commands_cb_msg_recv ( struct m0_net_test_network_ctx net_ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 227 of file commands.c.

Here is the call graph for this function:

◆ commands_cb_msg_send()

static void commands_cb_msg_send ( struct m0_net_test_network_ctx net_ctx,
const uint32_t  buf_index,
enum m0_net_queue_type  q,
const struct m0_net_buffer_event ev 
)
static

Definition at line 253 of file commands.c.

Here is the call graph for this function:

◆ commands_initfini()

static int commands_initfini ( struct m0_net_test_cmd_ctx ctx,
const char *  cmd_ep,
m0_time_t  send_timeout,
m0_net_test_commands_send_cb_t  send_cb,
struct m0_net_test_slist ep_list,
bool  init 
)
static

Definition at line 354 of file commands.c.

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

◆ commands_recv_dequeue()

static void commands_recv_dequeue ( struct m0_net_test_cmd_ctx ctx,
size_t  buf_index 
)
static

Definition at line 313 of file commands.c.

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

◆ commands_recv_dequeue_nr()

static void commands_recv_dequeue_nr ( struct m0_net_test_cmd_ctx ctx,
size_t  nr 
)
static

Definition at line 335 of file commands.c.

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

◆ commands_recv_enqueue()

static int commands_recv_enqueue ( struct m0_net_test_cmd_ctx ctx,
size_t  buf_index 
)
static

Definition at line 298 of file commands.c.

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

◆ commands_recv_ep_put()

static void commands_recv_ep_put ( struct m0_net_test_cmd_ctx ctx,
size_t  buf_index 
)
static

Definition at line 320 of file commands.c.

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

◆ commands_tm_event_cb()

static void commands_tm_event_cb ( const struct m0_net_tm_event ev)
static

Definition at line 222 of file commands.c.

◆ is_buf_in_recv_q()

static bool is_buf_in_recv_q ( struct m0_net_test_cmd_ctx ctx,
size_t  buf_index 
)
static

Definition at line 327 of file commands.c.

Here is the caller graph for this function:

◆ m0_net_test_commands_fini()

void m0_net_test_commands_fini ( struct m0_net_test_cmd_ctx ctx)

Definition at line 451 of file commands.c.

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

◆ m0_net_test_commands_init()

int m0_net_test_commands_init ( struct m0_net_test_cmd_ctx ctx,
const char *  cmd_ep,
m0_time_t  send_timeout,
m0_net_test_commands_send_cb_t  send_cb,
struct m0_net_test_slist ep_list 
)

Initialize commands context.

Parameters
ctxcommands context.
cmd_ependpoint for commands context.
send_timeouttimeout for message sending.
send_cb'Command sent' callback. Can be NULL.
ep_listendpoints list. Commands will be sent to/will be expected from endpoints from this list.
Returns
0 (success)
-EEXIST ep_list contains two equal strings
-errno (failure)
Note
  • buffers for message sending/receiving will be allocated here, three buffers per endpoint: one for sending, two for receiving;
  • all buffers will have M0_NET_TEST_CMD_SIZE_MAX size;
  • all buffers for receiving commands will be added to receive queue here;
  • buffers will not be automatically added to receive queue after call to m0_net_test_commands_recv();
  • m0_net_test_commands_recv() can allocate resources while decoding command from buffer, so m0_net_test_received_free() must be called for command after successful m0_net_test_commads_recv().

Definition at line 441 of file commands.c.

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

◆ m0_net_test_commands_invariant()

bool m0_net_test_commands_invariant ( struct m0_net_test_cmd_ctx ctx)

Invariant for m0_net_test_cmd_ctx. Time complexity is O(1).

Definition at line 583 of file commands.c.

Here is the caller graph for this function:

◆ m0_net_test_commands_received_free()

void m0_net_test_commands_received_free ( struct m0_net_test_cmd cmd)

Free received command resources.

See also
m0_net_test_commands_recv().

Definition at line 578 of file commands.c.

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

◆ m0_net_test_commands_recv()

int m0_net_test_commands_recv ( struct m0_net_test_cmd_ctx ctx,
struct m0_net_test_cmd cmd,
m0_time_t  deadline 
)

Receive command.

Parameters
ctxCommands context.
cmdReceived buffer will be deserialized to this structure. m0_net_test_received_free() should be called for cmd to free resources that can be allocated while decoding.
deadlineFuncton will wait until deadline reached. Absolute time.
Returns
-ETIMEDOUT command wasn't received before deadline
Note
cmd->ntc_buf_index will be set to buffer index with received command. This buffer will be removed from receive queue and should be added using m0_net_test_commands_recv_enqueue(). Buffer will not be removed from receive queue iff function returned -ETIMEDOUT.
See also
m0_net_test_commands_init().

Definition at line 511 of file commands.c.

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

◆ m0_net_test_commands_recv_enqueue()

int m0_net_test_commands_recv_enqueue ( struct m0_net_test_cmd_ctx ctx,
size_t  buf_index 
)

Add commands context buffer to commands receive queue.

See also
m0_net_test_commands_recv().

Definition at line 570 of file commands.c.

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

◆ m0_net_test_commands_send()

int m0_net_test_commands_send ( struct m0_net_test_cmd_ctx ctx,
struct m0_net_test_cmd cmd 
)

Send command.

Parameters
ctxCommands context.
cmdCommand to send. cmd->ntc_ep_index should be set to valid endpoint index in the commands context.

Definition at line 457 of file commands.c.

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

◆ m0_net_test_commands_send_wait_all()

void m0_net_test_commands_send_wait_all ( struct m0_net_test_cmd_ctx ctx)

Wait until all 'command send' callbacks executed for every sent command.

Definition at line 490 of file commands.c.

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

◆ TYPE_DESCR() [1/5]

TYPE_DESCR ( m0_net_test_cmd  )

◆ TYPE_DESCR() [2/5]

TYPE_DESCR ( m0_net_test_cmd_done  )

◆ TYPE_DESCR() [3/5]

TYPE_DESCR ( m0_net_test_cmd_init  )

◆ TYPE_DESCR() [4/5]

TYPE_DESCR ( m0_net_test_msg_nr  )

◆ TYPE_DESCR() [5/5]

TYPE_DESCR ( m0_net_test_cmd_status_data  )

Variable Documentation

◆ commands_buffer_cb

const struct m0_net_test_network_buffer_callbacks commands_buffer_cb
static
Initial value:
= {
.ntnbc_cb = {
}
}
static void commands_cb_msg_recv(struct m0_net_test_network_ctx *net_ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: commands.c:227
static void commands_cb_msg_send(struct m0_net_test_network_ctx *net_ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: commands.c:253
static void commands_cb_impossible(struct m0_net_test_network_ctx *ctx, const uint32_t buf_index, enum m0_net_queue_type q, const struct m0_net_buffer_event *ev)
Definition: commands.c:274

Definition at line 287 of file commands.c.

◆ net_test_commands_tm_cb

const struct m0_net_tm_callbacks net_test_commands_tm_cb
static
Initial value:
= {
.ntc_event_cb = commands_tm_event_cb
}
static void commands_tm_event_cb(const struct m0_net_tm_event *ev)
Definition: commands.c:222

Definition at line 283 of file commands.c.