Motr  M0
ping.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_NET_BULK_MEM_PING_H__
26 #define __MOTR_NET_BULK_MEM_PING_H__
27 
28 #include "lib/bitmap.h"
29 #include "lib/types.h"
30 
31 struct ping_ctx;
32 struct ping_ops {
33  int (*pf)(const char *format, ...)
34  __attribute__ ((format (printf, 1, 2)));
35  void (*pqs)(struct ping_ctx *ctx, bool reset);
36 };
37 
41 struct ping_ctx {
42  const struct ping_ops *pc_ops;
43  const struct m0_net_xprt *pc_xprt;
45  const char *pc_hostname; /* dotted decimal */
46  short pc_port;
47  uint32_t pc_id;
48  int32_t pc_status;
49  const char *pc_rhostname; /* dotted decimal */
50  short pc_rport;
51  uint32_t pc_rid;
52  uint32_t pc_nr_bufs;
53  uint32_t pc_segments;
54  uint32_t pc_seg_size;
55  int32_t pc_passive_size;
61  struct m0_cond pc_cond;
63  const char *pc_ident;
64  const char *pc_compare_buf;
67 };
68 
69 enum {
70  PING_PORT1 = 12345,
71  PING_PORT2 = 27183,
72  PART3_SERVER_ID = 141421,
73 };
74 
75 /* Debug printf macro */
76 #ifdef __KERNEL__
77 #define PING_ERR(fmt, ...) printk(KERN_ERR fmt , ## __VA_ARGS__)
78 #else
79 #include <stdio.h>
80 #define PING_ERR(fmt, ...) fprintf(stderr, fmt , ## __VA_ARGS__)
81 #endif
82 
83 void ping_server(struct ping_ctx *ctx);
85 int ping_client_init(struct ping_ctx *ctx, struct m0_net_end_point **server_ep);
86 int ping_client_fini(struct ping_ctx *ctx, struct m0_net_end_point *server_ep);
88  struct m0_net_end_point *server_ep,
89  const char *data);
91  struct m0_net_end_point *server_ep);
93  struct m0_net_end_point *server_ep,
94  const char *data);
95 
96 #endif /* __MOTR_NET_BULK_MEM_PING_H__ */
97 
98 /*
99  * Local variables:
100  * c-indentation-style: "K&R"
101  * c-basic-offset: 8
102  * tab-width: 8
103  * fill-column: 79
104  * scroll-step: 1
105  * End:
106  */
int(* pf)(const char *format,...) __attribute__((format(printf
Definition: ping.h:33
Definition: cond.h:99
int ping_client_init(struct ping_ctx *ctx, struct m0_net_end_point **server_ep)
Definition: ping.c:1261
struct m0_list pc_work_queue
Definition: ping.h:62
const struct ping_ops * pc_ops
Definition: ping.h:42
struct m0_net_domain pc_dom
Definition: ping.h:44
uint32_t pc_nr_bufs
Definition: ping.h:52
struct m0_bufvec data
Definition: di.c:40
struct m0_bitmap pc_nbbm
Definition: ping.h:58
enum m0_md_lustre_logrec_type __attribute__
Definition: balloc.c:2745
const char * pc_hostname
Definition: ping.h:45
uint32_t pc_id
Definition: ping.h:47
uint32_t pc_rid
Definition: ping.h:51
int ping_client_fini(struct ping_ctx *ctx, struct m0_net_end_point *server_ep)
Definition: ping.c:1292
int32_t pc_passive_size
Definition: ping.h:55
int ping_client_passive_recv(struct ping_ctx *ctx, struct m0_net_end_point *server_ep)
Definition: ping.c:1088
short pc_port
Definition: ping.h:46
uint32_t pc_seg_size
Definition: ping.h:54
int ping_client_msg_send_recv(struct ping_ctx *ctx, struct m0_net_end_point *server_ep, const char *data)
Definition: ping.c:1007
struct m0_net_transfer_mc pc_tm
Definition: ping.h:59
void ping_server(struct ping_ctx *ctx)
Definition: ping.c:907
static struct fdmi_ctx ctx
Definition: main.c:80
const char * pc_compare_buf
Definition: ping.h:64
Definition: list.h:72
int pc_server_bulk_delay
Definition: ping.h:66
void ping_server_should_stop(struct ping_ctx *ctx)
Definition: ping.c:990
struct m0_net_buffer * pc_nbs
Definition: ping.h:56
const struct m0_net_buffer_callbacks * pc_buf_callbacks
Definition: ping.h:57
format
Definition: hist.py:128
const char * pc_rhostname
Definition: ping.h:49
int ping_client_passive_send(struct ping_ctx *ctx, struct m0_net_end_point *server_ep, const char *data)
Definition: ping.c:1172
Definition: ping.h:41
struct m0_cond pc_cond
Definition: ping.h:61
struct m0_mutex pc_mutex
Definition: ping.h:60
short pc_rport
Definition: ping.h:50
int32_t pc_status
Definition: ping.h:48
Definition: nucleus.c:42
const struct m0_net_xprt * pc_xprt
Definition: ping.h:43
const char * pc_ident
Definition: ping.h:63
Definition: mutex.h:47
uint32_t pc_segments
Definition: ping.h:53
int(*) void(* pqs)(struct ping_ctx *ctx, bool reset)
Definition: ping.h:35
Definition: ping.h:32
int pc_passive_bulk_timeout
Definition: ping.h:65