Motr  M0
ub.c File Reference
#include "lib/trace.h"
#include "lib/ub.h"
#include "lib/misc.h"
#include "lib/string.h"
#include "lib/memory.h"
#include "fop/fop.h"
#include "net/bulk_mem.h"
#include "net/lnet/lnet.h"
#include "ut/cs_service.h"
#include "ut/misc.h"
#include "rpc/rpclib.h"
#include "rpc/session.h"
#include "rpc/ub/fops.h"
Include dependency graph for ub.c:

Go to the source code of this file.

Data Structures

struct  args
 
struct  match
 
struct  ub_rpc_client
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define ARGS
 
#define X(name, defval, max)   unsigned int a_ ## name;
 
#define X(name, defval, max)   args->a_ ## name = defval;
 
#define X(name, defval, max)   && 0 < args->a_ ## name && args->a_ ## name <= max
 
#define X(name, defval, max)
 
#define X(name, defval, max)   { #name "=%u", &dest->a_ ## name },
 
#define CLIENT_ENDPOINT_FMT   "127.0.0.1:%d"
 
#define SERVER_ENDPOINT_ADDR   "127.0.0.1:1"
 
#define SERVER_ENDPOINT   "bulk-mem:" SERVER_ENDPOINT_ADDR
 
#define NAME(ext)   "rpc-ub" ext
 

Enumerations

enum  { CLIENT_COB_DOM_ID = 16, MAX_RPCS_IN_FLIGHT = 10, MAX_RETRIES = 500, MIN_RECV_QUEUE_LEN = 200 }
 

Functions

static void args_init (struct args *args)
 
static int args_check_limits (const struct args *args)
 
static bool token_matches (const char *token, const struct match *tbl)
 
static void args_help (void)
 
static int args_parse (const char *src, struct args *dest)
 
 M0_BASSERT (MIN_RECV_QUEUE_LEN==200)
 
static void ub_item_replied (struct m0_rpc_item *item)
 
static void _client_start (struct ub_rpc_client *client, uint32_t cob_dom_id, const char *ep)
 
static void _client_stop (struct ub_rpc_client *client)
 
static int _start (const char *opts)
 
static void _stop (void)
 
static void fop_send (struct m0_rpc_session *session, size_t msg_id)
 
static struct m0_rpc_session_session (unsigned int i)
 
static void run (int iter M0_UNUSED)
 

Variables

struct args M0_XCA_DOMAIN
 
static struct args g_args
 
static struct m0_net_xprtg_xprt = (struct m0_net_xprt *)&m0_net_bulk_mem_xprt
 
static struct ub_rpc_clientg_clients
 
static char * g_argv []
 
static struct m0_rpc_server_ctx g_sctx
 
static const struct m0_rpc_item_ops ub_item_ops
 
struct m0_ub_set m0_rpc_ub
 

Macro Definition Documentation

◆ ARGS

#define ARGS
Value:
X(nr_conns, 2, 10000) \
X(nr_msgs, 1000, 5000) \
X(msg_len, 32, 8192)
#define X(name, defval, max)
Definition: ub.c:50

Definition at line 44 of file ub.c.

◆ CLIENT_ENDPOINT_FMT

#define CLIENT_ENDPOINT_FMT   "127.0.0.1:%d"

Definition at line 156 of file ub.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 23 of file ub.c.

◆ NAME

#define NAME (   ext)    "rpc-ub" ext

Definition at line 172 of file ub.c.

◆ SERVER_ENDPOINT

#define SERVER_ENDPOINT   "bulk-mem:" SERVER_ENDPOINT_ADDR

Definition at line 158 of file ub.c.

◆ SERVER_ENDPOINT_ADDR

#define SERVER_ENDPOINT_ADDR   "127.0.0.1:1"

Definition at line 157 of file ub.c.

◆ X [1/5]

#define X (   name,
  defval,
  max 
)    unsigned int a_ ## name;

Definition at line 50 of file ub.c.

◆ X [2/5]

#define X (   name,
  defval,
  max 
)    args->a_ ## name = defval;

Definition at line 50 of file ub.c.

◆ X [3/5]

#define X (   name,
  defval,
  max 
)    && 0 < args->a_ ## name && args->a_ ## name <= max

Definition at line 50 of file ub.c.

◆ X [4/5]

#define X (   name,
  defval,
  max 
)
Value:
fprintf(stderr, " %s=NUM\t(default = %u, ulimit = %u)\n", \
#name, defval, max);
const char * name
Definition: trace.c:110
static long long max(long long a, long long b)
Definition: crate.c:196

Definition at line 50 of file ub.c.

◆ X [5/5]

#define X (   name,
  defval,
  max 
)    { #name "=%u", &dest->a_ ## name },

Definition at line 50 of file ub.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CLIENT_COB_DOM_ID 
MAX_RPCS_IN_FLIGHT 
MAX_RETRIES 
MIN_RECV_QUEUE_LEN 

Definition at line 138 of file ub.c.

Function Documentation

◆ _client_start()

static void _client_start ( struct ub_rpc_client client,
uint32_t  cob_dom_id,
const char *  ep 
)
static

Definition at line 201 of file ub.c.

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

◆ _client_stop()

static void _client_stop ( struct ub_rpc_client client)
static

Definition at line 224 of file ub.c.

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

◆ _session()

static struct m0_rpc_session* _session ( unsigned int  i)
static

Definition at line 328 of file ub.c.

Here is the caller graph for this function:

◆ _start()

static int _start ( const char *  opts)
static

Definition at line 234 of file ub.c.

Here is the call graph for this function:

◆ _stop()

static void _stop ( void  )
static

Definition at line 264 of file ub.c.

Here is the call graph for this function:

◆ args_check_limits()

static int args_check_limits ( const struct args args)
static

Definition at line 65 of file ub.c.

Here is the caller graph for this function:

◆ args_help()

static void args_help ( void  )
static

Definition at line 93 of file ub.c.

Here is the caller graph for this function:

◆ args_init()

static void args_init ( struct args args)
static

Assigns default values to the arguments.

Definition at line 58 of file ub.c.

Here is the caller graph for this function:

◆ args_parse()

static int args_parse ( const char *  src,
struct args dest 
)
static

Definition at line 104 of file ub.c.

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

◆ fop_send()

static void fop_send ( struct m0_rpc_session session,
size_t  msg_id 
)
static

Definition at line 292 of file ub.c.

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

◆ M0_BASSERT()

M0_BASSERT ( MIN_RECV_QUEUE_LEN  = =200)

◆ run()

static void run ( int iter  M0_UNUSED)
static

Definition at line 334 of file ub.c.

Here is the call graph for this function:

◆ token_matches()

static bool token_matches ( const char *  token,
const struct match tbl 
)
static

Definition at line 83 of file ub.c.

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

◆ ub_item_replied()

static void ub_item_replied ( struct m0_rpc_item item)
static

Definition at line 275 of file ub.c.

Here is the call graph for this function:

Variable Documentation

◆ g_args

struct args g_args
static

Definition at line 55 of file ub.c.

◆ g_argv

char* g_argv[]
static
Initial value:
= {
NAME(""), "-Q", "200" , "-w", "10",
"-T", "AD", "-D", NAME(".db"), "-S", NAME(".stob"),
"-A", "linuxstob:"NAME(".addb-stob"),
"-c", M0_UT_PATH("conf.xc")
}
#define NAME(ext)
Definition: ub.c:172
#define SERVER_ENDPOINT_ADDR
Definition: ub.c:157
#define SERVER_ENDPOINT
Definition: ub.c:158
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
#define M0_UT_PATH(name)
Definition: misc.h:41

Definition at line 173 of file ub.c.

◆ g_clients

struct ub_rpc_client* g_clients
static

Definition at line 168 of file ub.c.

◆ g_sctx

struct m0_rpc_server_ctx g_sctx
static
Initial value:
= {
.rsx_xprts = &g_xprt,
.rsx_xprts_nr = 1,
.rsx_argv = g_argv,
.rsx_argc = ARRAY_SIZE(g_argv),
.rsx_log_file_name = NAME(".log")
}
#define NAME(ext)
Definition: ub.c:172
static char * g_argv[]
Definition: ub.c:173
static struct m0_net_xprt * g_xprt
Definition: ub.c:159
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 182 of file ub.c.

◆ g_xprt

struct m0_net_xprt* g_xprt = (struct m0_net_xprt *)&m0_net_bulk_mem_xprt
static

Definition at line 159 of file ub.c.

◆ m0_rpc_ub

struct m0_ub_set m0_rpc_ub
Initial value:
= {
.us_name = "rpc-ub",
.us_init = _start,
.us_fini = _stop,
.us_run = {
{ .ub_name = "run",
.ub_iter = 1,
.ub_round = run },
{ .ub_name = NULL }
}
}
#define NULL
Definition: misc.h:38
static void _stop(void)
Definition: ub.c:264
static int _start(const char *opts)
Definition: ub.c:234
static void run(int iter M0_UNUSED)
Definition: ub.c:334

Definition at line 360 of file ub.c.

◆ M0_XCA_DOMAIN

struct args M0_XCA_DOMAIN

◆ ub_item_ops

const struct m0_rpc_item_ops ub_item_ops
static
Initial value:
= {
.rio_replied = ub_item_replied
}
static void ub_item_replied(struct m0_rpc_item *item)
Definition: ub.c:275

Definition at line 193 of file ub.c.