Motr  M0
Collaboration diagram for Commands:

Data Structures

struct  m0_net_test_cmd_done
 
struct  m0_net_test_cmd_init
 
struct  m0_net_test_cmd_status_data
 
struct  m0_net_test_cmd
 
struct  m0_net_test_cmd_buf_status
 
struct  m0_net_test_cmd_ctx
 

Typedefs

typedef void(* m0_net_test_commands_send_cb_t) (struct m0_net_test_cmd_ctx *ctx, size_t ep_index, int buf_status)
 

Enumerations

enum  { M0_NET_TEST_CMD_SIZE_MAX = 16384 }
 
enum  m0_net_test_role { M0_NET_TEST_ROLE_CLIENT, M0_NET_TEST_ROLE_SERVER }
 
enum  m0_net_test_type { M0_NET_TEST_TYPE_PING, M0_NET_TEST_TYPE_BULK, M0_NET_TEST_TYPE_STUB }
 
enum  m0_net_test_cmd_type {
  M0_NET_TEST_CMD_INIT = 0, M0_NET_TEST_CMD_INIT_DONE, M0_NET_TEST_CMD_START, M0_NET_TEST_CMD_START_DONE,
  M0_NET_TEST_CMD_STATUS, M0_NET_TEST_CMD_STATUS_DATA, M0_NET_TEST_CMD_STOP, M0_NET_TEST_CMD_STOP_DONE,
  M0_NET_TEST_CMD_NR
}
 

Functions

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)
 
bool m0_net_test_commands_invariant (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)
 

Variables

enum { ... }  M0_XCA_DOMAIN
 

Detailed Description

See also
Motr Network Benchmark

Typedef Documentation

◆ m0_net_test_commands_send_cb_t

typedef void(* m0_net_test_commands_send_cb_t) (struct m0_net_test_cmd_ctx *ctx, size_t ep_index, int buf_status)

'Command sent' callback.

Definition at line 238 of file commands.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_NET_TEST_CMD_SIZE_MAX 

It is a size of command network buffer. Command will be serialized to this buffer, so it should be large enough to contain entire serialized command.

Note
There can be a problem with large number of test nodes, because M0_NET_TEST_CMD_INIT have list of node endpoints inside.

Definition at line 45 of file commands.h.

◆ m0_net_test_cmd_type

Command type.

See also
m0_net_test_cmd
Enumerator
M0_NET_TEST_CMD_INIT 
M0_NET_TEST_CMD_INIT_DONE 
M0_NET_TEST_CMD_START 
M0_NET_TEST_CMD_START_DONE 
M0_NET_TEST_CMD_STATUS 
M0_NET_TEST_CMD_STATUS_DATA 
M0_NET_TEST_CMD_STOP 
M0_NET_TEST_CMD_STOP_DONE 
M0_NET_TEST_CMD_NR 

Definition at line 78 of file commands.h.

◆ m0_net_test_role

Test node role - node can be test client or test server.

Enumerator
M0_NET_TEST_ROLE_CLIENT 
M0_NET_TEST_ROLE_SERVER 

Definition at line 59 of file commands.h.

◆ m0_net_test_type

Test type - can be ping test or bulk test. M0_NET_TEST_TYPE_STUB used in UTs.

Enumerator
M0_NET_TEST_TYPE_PING 
M0_NET_TEST_TYPE_BULK 
M0_NET_TEST_TYPE_STUB 

Definition at line 68 of file commands.h.

Function Documentation

◆ 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:

Variable Documentation

◆ M0_XCA_DOMAIN

enum { ... } M0_XCA_DOMAIN