1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43#ifndef __LST_CONRPC_H__
44#define __LST_CONRPC_H__
45
46#include "../../include/linux/libcfs/libcfs.h"
47#include "../../include/linux/lnet/lnet.h"
48#include "../../include/linux/lnet/lib-types.h"
49#include "../../include/linux/lnet/lnetst.h"
50#include "rpc.h"
51#include "selftest.h"
52
53
54#define LST_TRANS_TIMEOUT 30
55#define LST_TRANS_MIN_TIMEOUT 3
56
57#define LST_VALIDATE_TIMEOUT(t) min(max(t, LST_TRANS_MIN_TIMEOUT), LST_TRANS_TIMEOUT)
58
59#define LST_PING_INTERVAL 8
60
61struct lstcon_rpc_trans;
62struct lstcon_tsb_hdr;
63struct lstcon_test;
64struct lstcon_node;
65
66typedef struct lstcon_rpc {
67 struct list_head crp_link;
68 srpc_client_rpc_t *crp_rpc;
69 struct lstcon_node *crp_node;
70 struct lstcon_rpc_trans *crp_trans;
71
72 unsigned int crp_posted:1;
73 unsigned int crp_finished:1;
74 unsigned int crp_unpacked:1;
75
76 unsigned int crp_embedded:1;
77 int crp_status;
78 unsigned long crp_stamp;
79} lstcon_rpc_t;
80
81typedef struct lstcon_rpc_trans {
82 struct list_head tas_olink;
83 struct list_head tas_link;
84 int tas_opc;
85 unsigned tas_feats_updated;
86 unsigned tas_features;
87 wait_queue_head_t tas_waitq;
88 atomic_t tas_remaining;
89 struct list_head tas_rpcs_list;
90} lstcon_rpc_trans_t;
91
92#define LST_TRANS_PRIVATE 0x1000
93
94#define LST_TRANS_SESNEW (LST_TRANS_PRIVATE | 0x01)
95#define LST_TRANS_SESEND (LST_TRANS_PRIVATE | 0x02)
96#define LST_TRANS_SESQRY 0x03
97#define LST_TRANS_SESPING 0x04
98
99#define LST_TRANS_TSBCLIADD (LST_TRANS_PRIVATE | 0x11)
100#define LST_TRANS_TSBSRVADD (LST_TRANS_PRIVATE | 0x12)
101#define LST_TRANS_TSBRUN (LST_TRANS_PRIVATE | 0x13)
102#define LST_TRANS_TSBSTOP (LST_TRANS_PRIVATE | 0x14)
103#define LST_TRANS_TSBCLIQRY 0x15
104#define LST_TRANS_TSBSRVQRY 0x16
105
106#define LST_TRANS_STATQRY 0x21
107
108typedef int (*lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *);
109typedef int (*lstcon_rpc_readent_func_t)(int, srpc_msg_t *,
110 lstcon_rpc_ent_t __user *);
111
112int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop,
113 unsigned version, lstcon_rpc_t **crpc);
114int lstcon_dbgrpc_prep(struct lstcon_node *nd,
115 unsigned version, lstcon_rpc_t **crpc);
116int lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned version,
117 struct lstcon_tsb_hdr *tsb, lstcon_rpc_t **crpc);
118int lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned version,
119 struct lstcon_test *test, lstcon_rpc_t **crpc);
120int lstcon_statrpc_prep(struct lstcon_node *nd, unsigned version,
121 lstcon_rpc_t **crpc);
122void lstcon_rpc_put(lstcon_rpc_t *crpc);
123int lstcon_rpc_trans_prep(struct list_head *translist,
124 int transop, lstcon_rpc_trans_t **transpp);
125int lstcon_rpc_trans_ndlist(struct list_head *ndlist,
126 struct list_head *translist, int transop,
127 void *arg, lstcon_rpc_cond_func_t condition,
128 lstcon_rpc_trans_t **transpp);
129void lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans,
130 lstcon_trans_stat_t *stat);
131int lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
132 struct list_head __user *head_up,
133 lstcon_rpc_readent_func_t readent);
134void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error);
135void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans);
136void lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, lstcon_rpc_t *req);
137int lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout);
138int lstcon_rpc_pinger_start(void);
139void lstcon_rpc_pinger_stop(void);
140void lstcon_rpc_cleanup_wait(void);
141int lstcon_rpc_module_init(void);
142void lstcon_rpc_module_fini(void);
143
144#endif
145