Motr  M0
net.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #pragma once
23 
24 #ifndef __MOTR_DESIM_NET_H__
25 #define __MOTR_DESIM_NET_H__
26 
27 #include "lib/tlist.h"
28 #include "fid/fid.h"
29 #include "stob/stob.h"
30 #include "desim/sim.h"
31 
37 struct elevator;
38 
39 struct net_conf {
40  unsigned nc_frag_size;
41  unsigned nc_rpc_size;
46  unsigned long long nc_rate_min;
47  unsigned long long nc_rate_max;
48  unsigned long nc_nob_max;
49  unsigned long nc_nob_inflight;
50  unsigned long nc_msg_max;
51  unsigned long nc_msg_inflight;
53  struct cnt nc_rpc_wait;
55 };
56 
57 struct net_srv {
58  unsigned ns_nr_threads;
59  unsigned ns_nr_devices;
63  struct m0_tl ns_queue;
65  struct elevator *ns_el;
66  unsigned long long ns_file_size;
68  unsigned ns_active;
69  char *ns_name;
70 };
71 
72 struct net_rpc {
73  struct net_srv *nr_srv;
74  struct net_conf *nr_conf;
76  unsigned long long nr_offset;
77  unsigned long nr_todo;
79  struct sim_chan nr_wait;
82  uint64_t nr_magic;
83 };
84 
85 M0_INTERNAL void net_srv_init(struct sim *s, struct net_srv *srv);
86 M0_INTERNAL void net_srv_fini(struct net_srv *srv);
87 
88 M0_INTERNAL void net_init(struct net_conf *net);
89 M0_INTERNAL void net_fini(struct net_conf *net);
90 
91 M0_INTERNAL void net_rpc_init(struct net_rpc *rpc, struct net_conf *conf,
92  struct net_srv *srv, struct m0_stob_id *stob_id,
93  unsigned long long offset, unsigned long nob);
94 M0_INTERNAL void net_rpc_fini(struct net_rpc *rpc);
95 M0_INTERNAL void net_rpc_send(struct sim_thread *t, struct net_rpc *rpc);
96 M0_INTERNAL void net_rpc_bulk(struct sim_thread *t, struct net_rpc *rpc);
97 M0_INTERNAL void net_rpc_process(struct sim_thread *t,
98  struct net_conf *net, struct net_srv *srv,
99  struct m0_stob_id *stob_id,
100  unsigned long long offset,
101  unsigned long count);
102 
103 #endif /* __MOTR_DESIM_NET_H__ */
104 
107 /*
108  * Local variables:
109  * c-indentation-style: "K&R"
110  * c-basic-offset: 8
111  * tab-width: 8
112  * fill-column: 80
113  * scroll-step: 1
114  * End:
115  */
unsigned long long nc_rate_min
Definition: net.h:46
unsigned long long nc_rate_max
Definition: net.h:47
Definition: sim.h:152
struct elevator * ns_el
Definition: net.h:65
struct sim_thread * ns_thread
Definition: net.h:64
Definition: net.h:72
struct m0_tlink nr_inqueue
Definition: net.h:78
struct net_conf * nr_conf
Definition: net.h:74
sim_time_t nc_frag_delay_min
Definition: net.h:44
sim_time_t ns_pre_bulk_min
Definition: net.h:60
M0_INTERNAL void net_rpc_bulk(struct sim_thread *t, struct net_rpc *rpc)
Definition: net.c:208
Definition: net.h:57
Definition: conf.py:1
M0_INTERNAL void net_rpc_process(struct sim_thread *t, struct net_conf *net, struct net_srv *srv, struct m0_stob_id *stob_id, unsigned long long offset, unsigned long count)
Definition: net.c:222
static m0_bcount_t count
Definition: xcode.c:167
sim_time_t nc_frag_delay_max
Definition: net.h:45
M0_INTERNAL void net_rpc_fini(struct net_rpc *rpc)
Definition: net.c:159
unsigned long nc_nob_max
Definition: net.h:48
Definition: net.h:39
unsigned long nr_todo
Definition: net.h:77
struct sim_thread * nr_srv_thread
Definition: net.h:81
int ns_shutdown
Definition: net.h:67
Definition: cnt.h:36
unsigned ns_active
Definition: net.h:68
unsigned long nc_nob_inflight
Definition: net.h:49
uint64_t nr_magic
Definition: net.h:82
static struct m0_thread t[8]
Definition: service_ut.c:1230
Definition: tlist.h:251
sim_time_t ns_pre_bulk_max
Definition: net.h:61
unsigned long long sim_time_t
Definition: sim.h:111
static m0_bindex_t offset
Definition: dump.c:173
Definition: sim.h:237
M0_INTERNAL void net_srv_init(struct sim *s, struct net_srv *srv)
Definition: net.c:101
struct sim_chan nr_wait
Definition: net.h:79
struct net_srv * nr_srv
Definition: net.h:73
M0_INTERNAL void net_init(struct net_conf *net)
Definition: net.c:129
unsigned long nc_msg_inflight
Definition: net.h:51
unsigned ns_nr_devices
Definition: net.h:59
struct m0_stob_id nr_stob_id
Definition: net.h:75
sim_time_t nc_rpc_delay_min
Definition: net.h:42
unsigned long nc_msg_max
Definition: net.h:50
M0_INTERNAL void net_rpc_send(struct sim_thread *t, struct net_rpc *rpc)
Definition: net.c:196
unsigned nc_rpc_size
Definition: net.h:41
char * ns_name
Definition: net.h:69
unsigned nc_frag_size
Definition: net.h:40
unsigned long long ns_file_size
Definition: net.h:66
struct sim_chan nc_queue
Definition: net.h:52
struct cnt nc_rpc_bulk_wait
Definition: net.h:54
struct cnt nc_rpc_wait
Definition: net.h:53
static struct m0_addb2_net * net
Definition: net.c:27
struct sim_chan nr_bulk_wait
Definition: net.h:80
struct m0_tl ns_queue
Definition: net.h:63
unsigned ns_nr_threads
Definition: net.h:58
unsigned long long nr_offset
Definition: net.h:76
M0_INTERNAL void net_rpc_init(struct net_rpc *rpc, struct net_conf *conf, struct net_srv *srv, struct m0_stob_id *stob_id, unsigned long long offset, unsigned long nob)
Definition: net.c:143
M0_INTERNAL void net_srv_fini(struct net_srv *srv)
Definition: net.c:110
static struct m0_addb2_source * s
Definition: consumer.c:39
struct sim_chan ns_incoming
Definition: net.h:62
static struct net_srv srv
Definition: net_test.c:52
M0_INTERNAL void net_fini(struct net_conf *net)
Definition: net.c:136
sim_time_t nc_rpc_delay_max
Definition: net.h:43