38 #include "rpc/it/ping_fop_xc.h" 43 # include <linux/kernel.h> 45 # define printf printk 51 # ifdef HAVE_NETINET_IN_H 52 # include <netinet/in.h> 54 # include <arpa/inet.h> 59 #define SERVER_ENDPOINT_ADDR "0@lo:12345:34:1" 60 #define SERVER_ENDPOINT M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR 62 #define SERVER_DB_FILE_NAME "m0rpcping_server.db" 63 #define SERVER_STOB_FILE_NAME "m0rpcping_server.stob" 64 #define SERVER_ADDB_STOB_FILE_NAME "linuxstob:m0rpcping_server_addb.stob" 65 #define SERVER_LOG_FILE_NAME "m0rpcping_server.log" 155 printf(
"%s endpoint: %s\n", ep_name, out_buf);
167 printf(
"\treceived_items: %llu\n",
168 (
unsigned long long)
stats.rs_nr_rcvd_items);
169 printf(
"\tsent_items: %llu\n",
170 (
unsigned long long)
stats.rs_nr_sent_items);
171 printf(
"\tsent_items_uniq: %llu\n",
172 (
unsigned long long)
stats.rs_nr_sent_items_uniq);
173 printf(
"\tresent_items: %llu\n",
174 (
unsigned long long)
stats.rs_nr_resent_items);
175 printf(
"\tfailed_items: %llu\n",
176 (
unsigned long long)
stats.rs_nr_failed_items);
177 printf(
"\ttimedout_items: %llu\n",
178 (
unsigned long long)
stats.rs_nr_timedout_items);
179 printf(
"\tdropped_items: %llu\n",
180 (
unsigned long long)
stats.rs_nr_dropped_items);
181 printf(
"\tha_timedout_items: %llu\n",
182 (
unsigned long long)
stats.rs_nr_ha_timedout_items);
183 printf(
"\tha_noted_conns: %llu\n",
184 (
unsigned long long)
stats.rs_nr_ha_noted_conns);
186 printf(
"\treceived_packets: %llu\n",
187 (
unsigned long long)
stats.rs_nr_rcvd_packets);
188 printf(
"\tsent_packets: %llu\n",
189 (
unsigned long long)
stats.rs_nr_sent_packets);
190 printf(
"\tpackets_failed : %llu\n",
191 (
unsigned long long)
stats.rs_nr_failed_packets);
193 printf(
"\tTotal_bytes_sent : %llu\n",
194 (
unsigned long long)
stats.rs_nr_sent_bytes);
195 printf(
"\tTotal_bytes_rcvd : %llu\n",
196 (
unsigned long long)
stats.rs_nr_rcvd_bytes);
209 M0_ASSERT(m0_rpc_machine_bob_check(rpcmach));
248 uint32_t nr_arr_member;
323 printf(
"m0rpcping: client init failed \"%i\"\n", -
rc);
347 printf(
"Time: %lu.%2.2lu sec\n",
365 printf(
"\n########################################\n");
366 printf(
"\n\nPress Enter to terminate\n\n");
367 printf(
"\n########################################\n");
368 rc = read(0, &
ch,
sizeof ch);
374 return (rc < 0 || rc >=
size) ? -EINVAL : 0;
379 enum { STRING_LEN = 16 };
380 static char tm_len[STRING_LEN];
381 static char rpc_size[STRING_LEN];
387 "-q", tm_len,
"-m", rpc_size,
431 printf(
"########### Server stats ###########\n");
451 int main(
int argc,
char *argv[])
473 "Note: It's default value is 2. \n" 474 "If a large number of ping items having" 475 " bigger sizes are sent \nthen there may be" 476 " insufficient receive buffers.\nIn such" 477 "cases it should have higher values (~16).",
static int tm_recv_queue_len
static void ping_reply_received(struct m0_rpc_item *item)
#define M0_GETOPTS(progname, argc, argv,...)
static void rpcping_thread(struct m0_rpc_session *session)
#define SERVER_ENDPOINT_ADDR
m0_time_t ri_resend_interval
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_ping_fop_init(void)
void m0_net_domain_fini(struct m0_net_domain *dom)
static int build_endpoint_addr(enum ep_type type, char *out_buf, size_t buf_size)
struct m0_reqh * m0_cs_reqh_get(struct m0_motr *cctx)
#define M0_FLAGARG(ch, desc, ptr)
#define SERVER_LOG_FILE_NAME
static void print_stats(struct m0_reqh *reqh)
int m0_thread_join(struct m0_thread *q)
int m0_cs_default_stypes_init(void)
int m0_rpc_server_start(struct m0_rpc_server_ctx *sctx)
uint64_t m0_time_nanoseconds(const m0_time_t time)
static struct m0_rpc_client_ctx cctx
void * m0_fop_data(const struct m0_fop *fop)
enum m0_md_lustre_logrec_type __attribute__
static int int2str(char *dest, size_t size, int src, int defval)
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
module_param(trace_immediate_mask, charp, S_IRUGO)
int m0_init(struct m0 *instance)
#define container_of(ptr, type, member)
struct m0_rwlock rh_rwlock
static struct m0_rpc_item * item
static int run_server(void)
static void quit_dialog(void)
static void __print_stats(struct m0_rpc_machine *rpc_mach)
static struct m0 instance
int m0_rpc_ping_init(void)
void m0_rpc_machine_get_stats(struct m0_rpc_machine *machine, struct m0_rpc_stats *stats, bool reset)
#define M0_STRINGARG(ch, desc, func)
M0_INTERNAL void m0_ping_fop_fini(void)
#define M0_FID_TINIT(type, container, key)
#define M0_FORMATARG(ch, desc, fmt, ptr)
#define M0_NET_XPRT_PREFIX_DEFAULT
uint32_t rcx_max_rpc_msg_size
m0_time_t m0_time_now(void)
struct m0_fop_type m0_fop_ping_fopt
static void send_ping_fop(struct m0_rpc_session *session)
struct m0_tl rh_rpc_machines
void m0_thread_fini(struct m0_thread *q)
struct m0_net_xprt * m0_net_xprt_default_get(void)
int m0_rpc_client_start(struct m0_rpc_client_ctx *cctx)
struct m0_net_xprt ** rsx_xprts
struct m0_rpc_item * ri_reply
static struct m0_rpc_server_ctx sctx
static struct m0_net_domain client_net_dom
uint32_t rcx_recv_queue_min_length
int m0_rpc_post_sync(struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops, m0_time_t deadline)
static void fop_fini(void)
M0_INTERNAL void m0_rpc_ping_fini(void)
static int max_rpc_msg_size
struct m0_net_domain * rcx_net_dom
uint64_t m0_time_seconds(const m0_time_t time)
uint64_t rcx_max_rpcs_in_flight
void(* rio_replied)(struct m0_rpc_item *item)
int32_t m0_rpc_item_error(const struct m0_rpc_item *item)
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
struct m0_rpc_session rcx_session
m0_time_t m0_time_from_now(uint64_t secs, long ns)
struct m0_net_xprt ** m0_net_all_xprt_get(void)
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
const char * rcx_remote_addr
struct m0_fop * m0_fop_alloc_at(struct m0_rpc_session *sess, struct m0_fop_type *fopt)
int m0_rpc_client_stop_stats(struct m0_rpc_client_ctx *cctx, void(*printout)(struct m0_rpc_machine *))
static int start(struct m0_fom *fom)
void m0_fop_put_lock(struct m0_fop *fop)
static struct m0_thread * client_thread
static struct m0_fop * fop
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
int main(int argc, char *argv[])
const struct m0_rpc_item_ops ping_item_ops
const char * rcx_local_addr
void m0_rpc_server_stop(struct m0_rpc_server_ctx *sctx)
MODULE_PARM_DESC(trace_immediate_mask, " a bitmask or comma separated list of subsystem names" " of what should be printed immediately to console")
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
static struct m0_dtm_oper_descr reply
#define m0_tl_for(name, head, obj)
struct m0_fop_ping_arr fp_arr
struct m0_rpc_item f_item
static int run_client(void)
struct m0_pdclust_src_addr src
struct m0_motr rsx_motr_ctx
static const char * process_fid
static char client_endpoint[M0_NET_LNET_XEP_ADDR_LEN]
static char server_endpoint[M0_NET_LNET_XEP_ADDR_LEN]
void m0_cs_default_stypes_fini(void)
static int nr_client_threads