Commit 74d68011 authored by Mike Shuey's avatar Mike Shuey Committed by Greg Kroah-Hartman

staging: lustre: lnet: selftest: code cleanup - variable spacing, indentation

Unify spacing in variable declarations, and align indentation in headers.
General whitespace cleanups.
Signed-off-by: default avatarMike Shuey <shuey@purdue.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 97d10d0a
...@@ -91,7 +91,7 @@ brw_client_init(sfw_test_instance_t *tsi) ...@@ -91,7 +91,7 @@ brw_client_init(sfw_test_instance_t *tsi)
len = npg * PAGE_CACHE_SIZE; len = npg * PAGE_CACHE_SIZE;
} else { } else {
test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
/* I should never get this step if it's unknown feature /* I should never get this step if it's unknown feature
* because make_session will reject unknown feature */ * because make_session will reject unknown feature */
...@@ -223,7 +223,7 @@ brw_check_page(struct page *pg, int pattern, __u64 magic) ...@@ -223,7 +223,7 @@ brw_check_page(struct page *pg, int pattern, __u64 magic)
static void static void
brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
{ {
int i; int i;
struct page *pg; struct page *pg;
for (i = 0; i < bk->bk_niov; i++) { for (i = 0; i < bk->bk_niov; i++) {
...@@ -235,7 +235,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) ...@@ -235,7 +235,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
static int static int
brw_check_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) brw_check_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
{ {
int i; int i;
struct page *pg; struct page *pg;
for (i = 0; i < bk->bk_niov; i++) { for (i = 0; i < bk->bk_niov; i++) {
...@@ -254,16 +254,16 @@ static int ...@@ -254,16 +254,16 @@ static int
brw_client_prep_rpc(sfw_test_unit_t *tsu, brw_client_prep_rpc(sfw_test_unit_t *tsu,
lnet_process_id_t dest, srpc_client_rpc_t **rpcpp) lnet_process_id_t dest, srpc_client_rpc_t **rpcpp)
{ {
srpc_bulk_t *bulk = tsu->tsu_private; srpc_bulk_t *bulk = tsu->tsu_private;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session; sfw_session_t *sn = tsi->tsi_batch->bat_session;
srpc_client_rpc_t *rpc; srpc_client_rpc_t *rpc;
srpc_brw_reqst_t *req; srpc_brw_reqst_t *req;
int flags; int flags;
int npg; int npg;
int len; int len;
int opc; int opc;
int rc; int rc;
LASSERT(sn != NULL); LASSERT(sn != NULL);
LASSERT(bulk != NULL); LASSERT(bulk != NULL);
...@@ -277,7 +277,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, ...@@ -277,7 +277,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
len = npg * PAGE_CACHE_SIZE; len = npg * PAGE_CACHE_SIZE;
} else { } else {
test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
/* I should never get this step if it's unknown feature /* I should never get this step if it's unknown feature
* because make_session will reject unknown feature */ * because make_session will reject unknown feature */
...@@ -311,12 +311,12 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, ...@@ -311,12 +311,12 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
static void static void
brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
{ {
__u64 magic = BRW_MAGIC; __u64 magic = BRW_MAGIC;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session; sfw_session_t *sn = tsi->tsi_batch->bat_session;
srpc_msg_t *msg = &rpc->crpc_replymsg; srpc_msg_t *msg = &rpc->crpc_replymsg;
srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
LASSERT(sn != NULL); LASSERT(sn != NULL);
...@@ -380,10 +380,10 @@ brw_server_rpc_done(srpc_server_rpc_t *rpc) ...@@ -380,10 +380,10 @@ brw_server_rpc_done(srpc_server_rpc_t *rpc)
static int static int
brw_bulk_ready(srpc_server_rpc_t *rpc, int status) brw_bulk_ready(srpc_server_rpc_t *rpc, int status)
{ {
__u64 magic = BRW_MAGIC; __u64 magic = BRW_MAGIC;
srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply; srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
srpc_brw_reqst_t *reqst; srpc_brw_reqst_t *reqst;
srpc_msg_t *reqstmsg; srpc_msg_t *reqstmsg;
LASSERT(rpc->srpc_bulk != NULL); LASSERT(rpc->srpc_bulk != NULL);
LASSERT(rpc->srpc_reqstbuf != NULL); LASSERT(rpc->srpc_reqstbuf != NULL);
...@@ -416,13 +416,13 @@ brw_bulk_ready(srpc_server_rpc_t *rpc, int status) ...@@ -416,13 +416,13 @@ brw_bulk_ready(srpc_server_rpc_t *rpc, int status)
static int static int
brw_server_handle(struct srpc_server_rpc *rpc) brw_server_handle(struct srpc_server_rpc *rpc)
{ {
struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_service *sv = rpc->srpc_scd->scd_svc;
srpc_msg_t *replymsg = &rpc->srpc_replymsg; srpc_msg_t *replymsg = &rpc->srpc_replymsg;
srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply; srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;
srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst;
int npg; int npg;
int rc; int rc;
LASSERT(sv->sv_id == SRPC_SERVICE_BRW); LASSERT(sv->sv_id == SRPC_SERVICE_BRW);
...@@ -490,17 +490,17 @@ brw_server_handle(struct srpc_server_rpc *rpc) ...@@ -490,17 +490,17 @@ brw_server_handle(struct srpc_server_rpc *rpc)
sfw_test_client_ops_t brw_test_client; sfw_test_client_ops_t brw_test_client;
void brw_init_test_client(void) void brw_init_test_client(void)
{ {
brw_test_client.tso_init = brw_client_init; brw_test_client.tso_init = brw_client_init;
brw_test_client.tso_fini = brw_client_fini; brw_test_client.tso_fini = brw_client_fini;
brw_test_client.tso_prep_rpc = brw_client_prep_rpc; brw_test_client.tso_prep_rpc = brw_client_prep_rpc;
brw_test_client.tso_done_rpc = brw_client_done_rpc; brw_test_client.tso_done_rpc = brw_client_done_rpc;
}; };
srpc_service_t brw_test_service; srpc_service_t brw_test_service;
void brw_init_test_service(void) void brw_init_test_service(void)
{ {
brw_test_service.sv_id = SRPC_SERVICE_BRW; brw_test_service.sv_id = SRPC_SERVICE_BRW;
brw_test_service.sv_name = "brw_test"; brw_test_service.sv_name = "brw_test";
brw_test_service.sv_handler = brw_server_handle; brw_test_service.sv_handler = brw_server_handle;
brw_test_service.sv_bulk_ready = brw_bulk_ready; brw_test_service.sv_bulk_ready = brw_bulk_ready;
......
...@@ -48,11 +48,11 @@ ...@@ -48,11 +48,11 @@
static int static int
lst_session_new_ioctl(lstio_session_new_args_t *args) lst_session_new_ioctl(lstio_session_new_args_t *args)
{ {
char *name; char *name;
int rc; int rc;
if (args->lstio_ses_idp == NULL || /* address for output sid */ if (args->lstio_ses_idp == NULL || /* address for output sid */
args->lstio_ses_key == 0 || /* no key is specified */ args->lstio_ses_key == 0 || /* no key is specified */
args->lstio_ses_namep == NULL || /* session name */ args->lstio_ses_namep == NULL || /* session name */
args->lstio_ses_nmlen <= 0 || args->lstio_ses_nmlen <= 0 ||
args->lstio_ses_nmlen > LST_NAME_SIZE) args->lstio_ses_nmlen > LST_NAME_SIZE)
...@@ -96,12 +96,12 @@ lst_session_info_ioctl(lstio_session_info_args_t *args) ...@@ -96,12 +96,12 @@ lst_session_info_ioctl(lstio_session_info_args_t *args)
{ {
/* no checking of key */ /* no checking of key */
if (args->lstio_ses_idp == NULL || /* address for output sid */ if (args->lstio_ses_idp == NULL || /* address for output sid */
args->lstio_ses_keyp == NULL || /* address for output key */ args->lstio_ses_keyp == NULL || /* address for output key */
args->lstio_ses_featp == NULL || /* address for output features */ args->lstio_ses_featp == NULL || /* address for output features */
args->lstio_ses_ndinfo == NULL || /* address for output ndinfo */ args->lstio_ses_ndinfo == NULL || /* address for output ndinfo */
args->lstio_ses_namep == NULL || /* address for output name */ args->lstio_ses_namep == NULL || /* address for output name */
args->lstio_ses_nmlen <= 0 || args->lstio_ses_nmlen <= 0 ||
args->lstio_ses_nmlen > LST_NAME_SIZE) args->lstio_ses_nmlen > LST_NAME_SIZE)
return -EINVAL; return -EINVAL;
...@@ -197,8 +197,8 @@ lst_debug_ioctl(lstio_debug_args_t *args) ...@@ -197,8 +197,8 @@ lst_debug_ioctl(lstio_debug_args_t *args)
static int static int
lst_group_add_ioctl(lstio_group_add_args_t *args) lst_group_add_ioctl(lstio_group_add_args_t *args)
{ {
char *name; char *name;
int rc; int rc;
if (args->lstio_grp_key != console_session.ses_key) if (args->lstio_grp_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -324,8 +324,8 @@ static int ...@@ -324,8 +324,8 @@ static int
lst_nodes_add_ioctl(lstio_group_nodes_args_t *args) lst_nodes_add_ioctl(lstio_group_nodes_args_t *args)
{ {
unsigned feats; unsigned feats;
int rc; int rc;
char *name; char *name;
if (args->lstio_grp_key != console_session.ses_key) if (args->lstio_grp_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -385,10 +385,10 @@ lst_group_list_ioctl(lstio_group_list_args_t *args) ...@@ -385,10 +385,10 @@ lst_group_list_ioctl(lstio_group_list_args_t *args)
static int static int
lst_group_info_ioctl(lstio_group_info_args_t *args) lst_group_info_ioctl(lstio_group_info_args_t *args)
{ {
char *name; char *name;
int ndent; int ndent;
int index; int index;
int rc; int rc;
if (args->lstio_grp_key != console_session.ses_key) if (args->lstio_grp_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -449,8 +449,8 @@ lst_group_info_ioctl(lstio_group_info_args_t *args) ...@@ -449,8 +449,8 @@ lst_group_info_ioctl(lstio_group_info_args_t *args)
static int static int
lst_batch_add_ioctl(lstio_batch_add_args_t *args) lst_batch_add_ioctl(lstio_batch_add_args_t *args)
{ {
int rc; int rc;
char *name; char *name;
if (args->lstio_bat_key != console_session.ses_key) if (args->lstio_bat_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -483,8 +483,8 @@ lst_batch_add_ioctl(lstio_batch_add_args_t *args) ...@@ -483,8 +483,8 @@ lst_batch_add_ioctl(lstio_batch_add_args_t *args)
static int static int
lst_batch_run_ioctl(lstio_batch_run_args_t *args) lst_batch_run_ioctl(lstio_batch_run_args_t *args)
{ {
int rc; int rc;
char *name; char *name;
if (args->lstio_bat_key != console_session.ses_key) if (args->lstio_bat_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -518,8 +518,8 @@ lst_batch_run_ioctl(lstio_batch_run_args_t *args) ...@@ -518,8 +518,8 @@ lst_batch_run_ioctl(lstio_batch_run_args_t *args)
static int static int
lst_batch_stop_ioctl(lstio_batch_stop_args_t *args) lst_batch_stop_ioctl(lstio_batch_stop_args_t *args)
{ {
int rc; int rc;
char *name; char *name;
if (args->lstio_bat_key != console_session.ses_key) if (args->lstio_bat_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -613,10 +613,10 @@ lst_batch_list_ioctl(lstio_batch_list_args_t *args) ...@@ -613,10 +613,10 @@ lst_batch_list_ioctl(lstio_batch_list_args_t *args)
static int static int
lst_batch_info_ioctl(lstio_batch_info_args_t *args) lst_batch_info_ioctl(lstio_batch_info_args_t *args)
{ {
char *name; char *name;
int rc; int rc;
int index; int index;
int ndent; int ndent;
if (args->lstio_bat_key != console_session.ses_key) if (args->lstio_bat_key != console_session.ses_key)
return -EACCES; return -EACCES;
...@@ -678,8 +678,8 @@ lst_batch_info_ioctl(lstio_batch_info_args_t *args) ...@@ -678,8 +678,8 @@ lst_batch_info_ioctl(lstio_batch_info_args_t *args)
static int static int
lst_stat_query_ioctl(lstio_stat_args_t *args) lst_stat_query_ioctl(lstio_stat_args_t *args)
{ {
int rc; int rc;
char *name; char *name;
/* TODO: not finished */ /* TODO: not finished */
if (args->lstio_sta_key != console_session.ses_key) if (args->lstio_sta_key != console_session.ses_key)
......
...@@ -117,8 +117,8 @@ static int ...@@ -117,8 +117,8 @@ static int
lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats, lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats,
int bulk_npg, int bulk_len, lstcon_rpc_t **crpcpp) int bulk_npg, int bulk_len, lstcon_rpc_t **crpcpp)
{ {
lstcon_rpc_t *crpc = NULL; lstcon_rpc_t *crpc = NULL;
int rc; int rc;
spin_lock(&console_session.ses_rpc_lock); spin_lock(&console_session.ses_rpc_lock);
...@@ -151,7 +151,7 @@ void ...@@ -151,7 +151,7 @@ void
lstcon_rpc_put(lstcon_rpc_t *crpc) lstcon_rpc_put(lstcon_rpc_t *crpc)
{ {
srpc_bulk_t *bulk = &crpc->crp_rpc->crpc_bulk; srpc_bulk_t *bulk = &crpc->crp_rpc->crpc_bulk;
int i; int i;
LASSERT(list_empty(&crpc->crp_link)); LASSERT(list_empty(&crpc->crp_link));
...@@ -336,8 +336,8 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans) ...@@ -336,8 +336,8 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans)
int int
lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout) lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
{ {
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
int rc; int rc;
if (list_empty(&trans->tas_rpcs_list)) if (list_empty(&trans->tas_rpcs_list))
return 0; return 0;
...@@ -386,8 +386,8 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout) ...@@ -386,8 +386,8 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
static int static int
lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp) lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
{ {
lstcon_node_t *nd = crpc->crp_node; lstcon_node_t *nd = crpc->crp_node;
srpc_client_rpc_t *rpc = crpc->crp_rpc; srpc_client_rpc_t *rpc = crpc->crp_rpc;
srpc_generic_reply_t *rep; srpc_generic_reply_t *rep;
LASSERT(nd != NULL && rpc != NULL); LASSERT(nd != NULL && rpc != NULL);
...@@ -423,9 +423,9 @@ lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp) ...@@ -423,9 +423,9 @@ lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
void void
lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)
{ {
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
srpc_msg_t *rep; srpc_msg_t *rep;
int error; int error;
LASSERT(stat != NULL); LASSERT(stat != NULL);
...@@ -470,16 +470,16 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, ...@@ -470,16 +470,16 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
struct list_head *head_up, struct list_head *head_up,
lstcon_rpc_readent_func_t readent) lstcon_rpc_readent_func_t readent)
{ {
struct list_head tmp; struct list_head tmp;
struct list_head *next; struct list_head *next;
lstcon_rpc_ent_t *ent; lstcon_rpc_ent_t *ent;
srpc_generic_reply_t *rep; srpc_generic_reply_t *rep;
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
srpc_msg_t *msg; srpc_msg_t *msg;
lstcon_node_t *nd; lstcon_node_t *nd;
long dur; long dur;
struct timeval tv; struct timeval tv;
int error; int error;
LASSERT(head_up != NULL); LASSERT(head_up != NULL);
...@@ -544,9 +544,9 @@ void ...@@ -544,9 +544,9 @@ void
lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)
{ {
srpc_client_rpc_t *rpc; srpc_client_rpc_t *rpc;
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
lstcon_rpc_t *tmp; lstcon_rpc_t *tmp;
int count = 0; int count = 0;
list_for_each_entry_safe(crpc, tmp, &trans->tas_rpcs_list, list_for_each_entry_safe(crpc, tmp, &trans->tas_rpcs_list,
crp_link) { crp_link) {
...@@ -601,7 +601,7 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, ...@@ -601,7 +601,7 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
{ {
srpc_mksn_reqst_t *msrq; srpc_mksn_reqst_t *msrq;
srpc_rmsn_reqst_t *rsrq; srpc_rmsn_reqst_t *rsrq;
int rc; int rc;
switch (transop) { switch (transop) {
case LST_TRANS_SESNEW: case LST_TRANS_SESNEW:
...@@ -638,7 +638,7 @@ int ...@@ -638,7 +638,7 @@ int
lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc) lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc)
{ {
srpc_debug_reqst_t *drq; srpc_debug_reqst_t *drq;
int rc; int rc;
rc = lstcon_rpc_prep(nd, SRPC_SERVICE_DEBUG, feats, 0, 0, crpc); rc = lstcon_rpc_prep(nd, SRPC_SERVICE_DEBUG, feats, 0, 0, crpc);
if (rc != 0) if (rc != 0)
...@@ -707,7 +707,7 @@ static lnet_process_id_packed_t * ...@@ -707,7 +707,7 @@ static lnet_process_id_packed_t *
lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov) lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
{ {
lnet_process_id_packed_t *pid; lnet_process_id_packed_t *pid;
int i; int i;
i = idx / SFW_ID_PER_PAGE; i = idx / SFW_ID_PER_PAGE;
...@@ -723,11 +723,11 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, ...@@ -723,11 +723,11 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov) int dist, int span, int nkiov, lnet_kiov_t *kiov)
{ {
lnet_process_id_packed_t *pid; lnet_process_id_packed_t *pid;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_node_t *nd; lstcon_node_t *nd;
int start; int start;
int end; int end;
int i = 0; int i = 0;
LASSERT(dist >= 1); LASSERT(dist >= 1);
LASSERT(span >= 1); LASSERT(span >= 1);
...@@ -777,8 +777,8 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req) ...@@ -777,8 +777,8 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
{ {
test_ping_req_t *prq = &req->tsr_u.ping; test_ping_req_t *prq = &req->tsr_u.ping;
prq->png_size = param->png_size; prq->png_size = param->png_size;
prq->png_flags = param->png_flags; prq->png_flags = param->png_flags;
/* TODO dest */ /* TODO dest */
return 0; return 0;
} }
...@@ -788,9 +788,10 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) ...@@ -788,9 +788,10 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
{ {
test_bulk_req_t *brq = &req->tsr_u.bulk_v0; test_bulk_req_t *brq = &req->tsr_u.bulk_v0;
brq->blk_opc = param->blk_opc; brq->blk_opc = param->blk_opc;
brq->blk_npg = (param->blk_size + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE; brq->blk_npg = (param->blk_size + PAGE_CACHE_SIZE - 1) /
brq->blk_flags = param->blk_flags; PAGE_CACHE_SIZE;
brq->blk_flags = param->blk_flags;
return 0; return 0;
} }
...@@ -816,7 +817,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, ...@@ -816,7 +817,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
lstcon_group_t *dgrp = test->tes_dst_grp; lstcon_group_t *dgrp = test->tes_dst_grp;
srpc_test_reqst_t *trq; srpc_test_reqst_t *trq;
srpc_bulk_t *bulk; srpc_bulk_t *bulk;
int i; int i;
int npg = 0; int npg = 0;
int nob = 0; int nob = 0;
int rc = 0; int rc = 0;
...@@ -835,8 +836,10 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, ...@@ -835,8 +836,10 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
trq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.tes_reqst; trq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.tes_reqst;
if (transop == LST_TRANS_TSBSRVADD) { if (transop == LST_TRANS_TSBSRVADD) {
int ndist = (sgrp->grp_nnode + test->tes_dist - 1) / test->tes_dist; int ndist = (sgrp->grp_nnode + test->tes_dist - 1) /
int nspan = (dgrp->grp_nnode + test->tes_span - 1) / test->tes_span; test->tes_dist;
int nspan = (dgrp->grp_nnode + test->tes_span - 1) /
test->tes_span;
int nmax = (ndist + nspan - 1) / nspan; int nmax = (ndist + nspan - 1) / nspan;
trq->tsr_ndest = 0; trq->tsr_ndest = 0;
...@@ -851,7 +854,8 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, ...@@ -851,7 +854,8 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
LASSERT(nob > 0); LASSERT(nob > 0);
len = (feats & LST_FEAT_BULK_LEN) == 0 ? len = (feats & LST_FEAT_BULK_LEN) == 0 ?
PAGE_CACHE_SIZE : min_t(int, nob, PAGE_CACHE_SIZE); PAGE_CACHE_SIZE :
min_t(int, nob, PAGE_CACHE_SIZE);
nob -= len; nob -= len;
bulk->bk_iovs[i].kiov_offset = 0; bulk->bk_iovs[i].kiov_offset = 0;
...@@ -883,8 +887,8 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, ...@@ -883,8 +887,8 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
trq->tsr_loop = test->tes_loop; trq->tsr_loop = test->tes_loop;
} }
trq->tsr_sid = console_session.ses_id; trq->tsr_sid = console_session.ses_id;
trq->tsr_bid = test->tes_hdr.tsb_id; trq->tsr_bid = test->tes_hdr.tsb_id;
trq->tsr_concur = test->tes_concur; trq->tsr_concur = test->tes_concur;
trq->tsr_is_client = (transop == LST_TRANS_TSBCLIADD) ? 1 : 0; trq->tsr_is_client = (transop == LST_TRANS_TSBCLIADD) ? 1 : 0;
trq->tsr_stop_onerr = !!test->tes_stop_onerr; trq->tsr_stop_onerr = !!test->tes_stop_onerr;
...@@ -966,7 +970,7 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg, ...@@ -966,7 +970,7 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
srpc_batch_reply_t *bat_rep; srpc_batch_reply_t *bat_rep;
srpc_test_reply_t *test_rep; srpc_test_reply_t *test_rep;
srpc_stat_reply_t *stat_rep; srpc_stat_reply_t *stat_rep;
int rc = 0; int rc = 0;
switch (trans->tas_opc) { switch (trans->tas_opc) {
case LST_TRANS_SESNEW: case LST_TRANS_SESNEW:
...@@ -1084,11 +1088,11 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, ...@@ -1084,11 +1088,11 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
lstcon_rpc_trans_t **transpp) lstcon_rpc_trans_t **transpp)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_node_t *nd; lstcon_node_t *nd;
lstcon_rpc_t *rpc; lstcon_rpc_t *rpc;
unsigned feats; unsigned feats;
int rc; int rc;
/* Creating session RPG for list of nodes */ /* Creating session RPG for list of nodes */
...@@ -1165,16 +1169,16 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, ...@@ -1165,16 +1169,16 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
static void static void
lstcon_rpc_pinger(void *arg) lstcon_rpc_pinger(void *arg)
{ {
stt_timer_t *ptimer = (stt_timer_t *)arg; stt_timer_t *ptimer = (stt_timer_t *)arg;
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
srpc_msg_t *rep; srpc_msg_t *rep;
srpc_debug_reqst_t *drq; srpc_debug_reqst_t *drq;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_node_t *nd; lstcon_node_t *nd;
time_t intv; time_t intv;
int count = 0; int count = 0;
int rc; int rc;
/* RPC pinger is a special case of transaction, /* RPC pinger is a special case of transaction,
* it's called by timer at 8 seconds interval. * it's called by timer at 8 seconds interval.
...@@ -1283,8 +1287,8 @@ lstcon_rpc_pinger(void *arg) ...@@ -1283,8 +1287,8 @@ lstcon_rpc_pinger(void *arg)
int int
lstcon_rpc_pinger_start(void) lstcon_rpc_pinger_start(void)
{ {
stt_timer_t *ptimer; stt_timer_t *ptimer;
int rc; int rc;
LASSERT(list_empty(&console_session.ses_rpc_freelist)); LASSERT(list_empty(&console_session.ses_rpc_freelist));
LASSERT(atomic_read(&console_session.ses_rpc_counter) == 0); LASSERT(atomic_read(&console_session.ses_rpc_counter) == 0);
...@@ -1324,9 +1328,9 @@ void ...@@ -1324,9 +1328,9 @@ void
lstcon_rpc_cleanup_wait(void) lstcon_rpc_cleanup_wait(void)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
struct list_head *pacer; struct list_head *pacer;
struct list_head zlist; struct list_head zlist;
/* Called with hold of global mutex */ /* Called with hold of global mutex */
......
...@@ -64,31 +64,29 @@ struct lstcon_test; ...@@ -64,31 +64,29 @@ struct lstcon_test;
struct lstcon_node; struct lstcon_node;
typedef struct lstcon_rpc { typedef struct lstcon_rpc {
struct list_head crp_link; /* chain on rpc transaction */ struct list_head crp_link; /* chain on rpc transaction */
srpc_client_rpc_t *crp_rpc; /* client rpc */ srpc_client_rpc_t *crp_rpc; /* client rpc */
struct lstcon_node *crp_node; /* destination node */ struct lstcon_node *crp_node; /* destination node */
struct lstcon_rpc_trans *crp_trans; /* conrpc transaction */ struct lstcon_rpc_trans *crp_trans; /* conrpc transaction */
unsigned int crp_posted:1; /* rpc is posted */ unsigned int crp_posted:1; /* rpc is posted */
unsigned int crp_finished:1; /* rpc is finished */ unsigned int crp_finished:1; /* rpc is finished */
unsigned int crp_unpacked:1; /* reply is unpacked */ unsigned int crp_unpacked:1; /* reply is unpacked */
/** RPC is embedded in other structure and can't free it */ /** RPC is embedded in other structure and can't free it */
unsigned int crp_embedded:1; unsigned int crp_embedded:1;
int crp_status; /* console rpc errors */ int crp_status; /* console rpc errors */
unsigned long crp_stamp; /* replied time stamp */ unsigned long crp_stamp; /* replied time stamp */
} lstcon_rpc_t; } lstcon_rpc_t;
typedef struct lstcon_rpc_trans { typedef struct lstcon_rpc_trans {
struct list_head tas_olink; /* link chain on owner list */ struct list_head tas_olink; /* link chain on owner list */
struct list_head tas_link; /* link chain on global list */ struct list_head tas_link; /* link chain on global list */
int tas_opc; /* operation code of transaction */ int tas_opc; /* operation code of transaction */
/* features mask is uptodate */ unsigned tas_feats_updated; /* features mask is uptodate */
unsigned tas_feats_updated; unsigned tas_features; /* test features mask */
/* test features mask */ wait_queue_head_t tas_waitq; /* wait queue head */
unsigned tas_features; atomic_t tas_remaining; /* # of un-scheduled rpcs */
wait_queue_head_t tas_waitq; /* wait queue head */ struct list_head tas_rpcs_list; /* queued requests */
atomic_t tas_remaining; /* # of un-scheduled rpcs */
struct list_head tas_rpcs_list; /* queued requests */
} lstcon_rpc_trans_t; } lstcon_rpc_trans_t;
#define LST_TRANS_PRIVATE 0x1000 #define LST_TRANS_PRIVATE 0x1000
......
...@@ -59,7 +59,7 @@ do { \ ...@@ -59,7 +59,7 @@ do { \
(p)->nle_nnode++; \ (p)->nle_nnode++; \
} while (0) } while (0)
lstcon_session_t console_session; lstcon_session_t console_session;
static void static void
lstcon_node_get(lstcon_node_t *nd) lstcon_node_get(lstcon_node_t *nd)
...@@ -73,7 +73,7 @@ static int ...@@ -73,7 +73,7 @@ static int
lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
{ {
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE; unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE;
LASSERT(id.nid != LNET_NID_ANY); LASSERT(id.nid != LNET_NID_ANY);
...@@ -117,7 +117,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) ...@@ -117,7 +117,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
static void static void
lstcon_node_put(lstcon_node_t *nd) lstcon_node_put(lstcon_node_t *nd)
{ {
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
LASSERT(nd->nd_ref > 0); LASSERT(nd->nd_ref > 0);
...@@ -140,10 +140,10 @@ static int ...@@ -140,10 +140,10 @@ static int
lstcon_ndlink_find(struct list_head *hash, lstcon_ndlink_find(struct list_head *hash,
lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create) lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create)
{ {
unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE; unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_node_t *nd; lstcon_node_t *nd;
int rc; int rc;
if (id.nid == LNET_NID_ANY) if (id.nid == LNET_NID_ANY)
return -EINVAL; return -EINVAL;
...@@ -197,7 +197,7 @@ static int ...@@ -197,7 +197,7 @@ static int
lstcon_group_alloc(char *name, lstcon_group_t **grpp) lstcon_group_alloc(char *name, lstcon_group_t **grpp)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
int i; int i;
LIBCFS_ALLOC(grp, offsetof(lstcon_group_t, LIBCFS_ALLOC(grp, offsetof(lstcon_group_t,
grp_ndl_hash[LST_NODE_HASHSIZE])); grp_ndl_hash[LST_NODE_HASHSIZE]));
...@@ -243,7 +243,7 @@ lstcon_group_drain(lstcon_group_t *grp, int keep) ...@@ -243,7 +243,7 @@ lstcon_group_drain(lstcon_group_t *grp, int keep)
static void static void
lstcon_group_decref(lstcon_group_t *grp) lstcon_group_decref(lstcon_group_t *grp)
{ {
int i; int i;
if (--grp->grp_ref > 0) if (--grp->grp_ref > 0)
return; return;
...@@ -264,7 +264,7 @@ lstcon_group_decref(lstcon_group_t *grp) ...@@ -264,7 +264,7 @@ lstcon_group_decref(lstcon_group_t *grp)
static int static int
lstcon_group_find(const char *name, lstcon_group_t **grpp) lstcon_group_find(const char *name, lstcon_group_t **grpp)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
list_for_each_entry(grp, &console_session.ses_grp_list, grp_link) { list_for_each_entry(grp, &console_session.ses_grp_list, grp_link) {
if (strncmp(grp->grp_name, name, LST_NAME_SIZE) != 0) if (strncmp(grp->grp_name, name, LST_NAME_SIZE) != 0)
...@@ -288,7 +288,7 @@ static int ...@@ -288,7 +288,7 @@ static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create) lstcon_ndlink_t **ndlpp, int create)
{ {
int rc; int rc;
rc = lstcon_ndlink_find(&grp->grp_ndl_hash[0], id, ndlpp, create); rc = lstcon_ndlink_find(&grp->grp_ndl_hash[0], id, ndlpp, create);
if (rc != 0) if (rc != 0)
...@@ -404,12 +404,12 @@ lstcon_group_nodes_add(lstcon_group_t *grp, ...@@ -404,12 +404,12 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
int count, lnet_process_id_t *ids_up, int count, lnet_process_id_t *ids_up,
unsigned *featp, struct list_head *result_up) unsigned *featp, struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int i; int i;
int rc; int rc;
rc = lstcon_group_alloc(NULL, &tmp); rc = lstcon_group_alloc(NULL, &tmp);
if (rc != 0) { if (rc != 0) {
...@@ -471,12 +471,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, ...@@ -471,12 +471,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp,
int count, lnet_process_id_t *ids_up, int count, lnet_process_id_t *ids_up,
struct list_head *result_up) struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int rc; int rc;
int i; int i;
/* End session and remove node from the group */ /* End session and remove node from the group */
...@@ -525,7 +525,7 @@ int ...@@ -525,7 +525,7 @@ int
lstcon_group_add(char *name) lstcon_group_add(char *name)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0; rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
if (rc != 0) { if (rc != 0) {
...@@ -549,8 +549,8 @@ int ...@@ -549,8 +549,8 @@ int
lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up, lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up,
unsigned *featp, struct list_head *result_up) unsigned *featp, struct list_head *result_up)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
LASSERT(count > 0); LASSERT(count > 0);
LASSERT(ids_up != NULL); LASSERT(ids_up != NULL);
...@@ -580,8 +580,8 @@ int ...@@ -580,8 +580,8 @@ int
lstcon_group_del(char *name) lstcon_group_del(char *name)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -621,7 +621,7 @@ int ...@@ -621,7 +621,7 @@ int
lstcon_group_clean(char *name, int args) lstcon_group_clean(char *name, int args)
{ {
lstcon_group_t *grp = NULL; lstcon_group_t *grp = NULL;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -654,7 +654,7 @@ lstcon_nodes_remove(char *name, int count, ...@@ -654,7 +654,7 @@ lstcon_nodes_remove(char *name, int count,
lnet_process_id_t *ids_up, struct list_head *result_up) lnet_process_id_t *ids_up, struct list_head *result_up)
{ {
lstcon_group_t *grp = NULL; lstcon_group_t *grp = NULL;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -682,9 +682,9 @@ lstcon_nodes_remove(char *name, int count, ...@@ -682,9 +682,9 @@ lstcon_nodes_remove(char *name, int count,
int int
lstcon_group_refresh(char *name, struct list_head *result_up) lstcon_group_refresh(char *name, struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -743,10 +743,10 @@ static int ...@@ -743,10 +743,10 @@ static int
lstcon_nodes_getent(struct list_head *head, int *index_p, lstcon_nodes_getent(struct list_head *head, int *index_p,
int *count_p, lstcon_node_ent_t *dents_up) int *count_p, lstcon_node_ent_t *dents_up)
{ {
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_node_t *nd; lstcon_node_t *nd;
int count = 0; int count = 0;
int index = 0; int index = 0;
LASSERT(index_p != NULL && count_p != NULL); LASSERT(index_p != NULL && count_p != NULL);
LASSERT(dents_up != NULL); LASSERT(dents_up != NULL);
...@@ -784,9 +784,9 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -784,9 +784,9 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
int *index_p, int *count_p, lstcon_node_ent_t *dents_up) int *index_p, int *count_p, lstcon_node_ent_t *dents_up)
{ {
lstcon_ndlist_ent_t *gentp; lstcon_ndlist_ent_t *gentp;
lstcon_group_t *grp; lstcon_group_t *grp;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -828,7 +828,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, ...@@ -828,7 +828,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
static int static int
lstcon_batch_find(const char *name, lstcon_batch_t **batpp) lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) { list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) {
if (strncmp(bat->bat_name, name, LST_NAME_SIZE) == 0) { if (strncmp(bat->bat_name, name, LST_NAME_SIZE) == 0) {
...@@ -843,9 +843,9 @@ lstcon_batch_find(const char *name, lstcon_batch_t **batpp) ...@@ -843,9 +843,9 @@ lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
int int
lstcon_batch_add(char *name) lstcon_batch_add(char *name)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
int i; int i;
int rc; int rc;
rc = (lstcon_batch_find(name, &bat) == 0)? -EEXIST: 0; rc = (lstcon_batch_find(name, &bat) == 0)? -EEXIST: 0;
if (rc != 0) { if (rc != 0) {
...@@ -903,7 +903,7 @@ lstcon_batch_add(char *name) ...@@ -903,7 +903,7 @@ lstcon_batch_add(char *name)
int int
lstcon_batch_list(int index, int len, char *name_up) lstcon_batch_list(int index, int len, char *name_up)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
LASSERT(name_up != NULL); LASSERT(name_up != NULL);
LASSERT(index >= 0); LASSERT(index >= 0);
...@@ -924,12 +924,12 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, ...@@ -924,12 +924,12 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server,
lstcon_node_ent_t *dents_up) lstcon_node_ent_t *dents_up)
{ {
lstcon_test_batch_ent_t *entp; lstcon_test_batch_ent_t *entp;
struct list_head *clilst; struct list_head *clilst;
struct list_head *srvlst; struct list_head *srvlst;
lstcon_test_t *test = NULL; lstcon_test_t *test = NULL;
lstcon_batch_t *bat; lstcon_batch_t *bat;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
int rc; int rc;
rc = lstcon_batch_find(name, &bat); rc = lstcon_batch_find(name, &bat);
if (rc != 0) { if (rc != 0) {
...@@ -1018,7 +1018,7 @@ lstcon_batch_op(lstcon_batch_t *bat, int transop, ...@@ -1018,7 +1018,7 @@ lstcon_batch_op(lstcon_batch_t *bat, int transop,
struct list_head *result_up) struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
int rc; int rc;
rc = lstcon_rpc_trans_ndlist(&bat->bat_cli_list, rc = lstcon_rpc_trans_ndlist(&bat->bat_cli_list,
&bat->bat_trans_list, transop, &bat->bat_trans_list, transop,
...@@ -1041,7 +1041,7 @@ int ...@@ -1041,7 +1041,7 @@ int
lstcon_batch_run(char *name, int timeout, struct list_head *result_up) lstcon_batch_run(char *name, int timeout, struct list_head *result_up)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
int rc; int rc;
if (lstcon_batch_find(name, &bat) != 0) { if (lstcon_batch_find(name, &bat) != 0) {
CDEBUG(D_NET, "Can't find batch %s\n", name); CDEBUG(D_NET, "Can't find batch %s\n", name);
...@@ -1063,7 +1063,7 @@ int ...@@ -1063,7 +1063,7 @@ int
lstcon_batch_stop(char *name, int force, struct list_head *result_up) lstcon_batch_stop(char *name, int force, struct list_head *result_up)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
int rc; int rc;
if (lstcon_batch_find(name, &bat) != 0) { if (lstcon_batch_find(name, &bat) != 0) {
CDEBUG(D_NET, "Can't find batch %s\n", name); CDEBUG(D_NET, "Can't find batch %s\n", name);
...@@ -1084,9 +1084,9 @@ lstcon_batch_stop(char *name, int force, struct list_head *result_up) ...@@ -1084,9 +1084,9 @@ lstcon_batch_stop(char *name, int force, struct list_head *result_up)
static void static void
lstcon_batch_destroy(lstcon_batch_t *bat) lstcon_batch_destroy(lstcon_batch_t *bat)
{ {
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_test_t *test; lstcon_test_t *test;
int i; int i;
list_del(&bat->bat_link); list_del(&bat->bat_link);
...@@ -1137,11 +1137,11 @@ lstcon_batch_destroy(lstcon_batch_t *bat) ...@@ -1137,11 +1137,11 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
static int static int
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{ {
lstcon_test_t *test; lstcon_test_t *test;
lstcon_batch_t *batch; lstcon_batch_t *batch;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
struct list_head *hash; struct list_head *hash;
struct list_head *head; struct list_head *head;
test = (lstcon_test_t *)arg; test = (lstcon_test_t *)arg;
LASSERT(test != NULL); LASSERT(test != NULL);
...@@ -1181,10 +1181,10 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) ...@@ -1181,10 +1181,10 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
static int static int
lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up) lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_group_t *grp; lstcon_group_t *grp;
int transop; int transop;
int rc; int rc;
LASSERT(test->tes_src_grp != NULL); LASSERT(test->tes_src_grp != NULL);
LASSERT(test->tes_dst_grp != NULL); LASSERT(test->tes_dst_grp != NULL);
...@@ -1251,8 +1251,8 @@ lstcon_verify_batch(const char *name, lstcon_batch_t **batch) ...@@ -1251,8 +1251,8 @@ lstcon_verify_batch(const char *name, lstcon_batch_t **batch)
static int static int
lstcon_verify_group(const char *name, lstcon_group_t **grp) lstcon_verify_group(const char *name, lstcon_group_t **grp)
{ {
int rc; int rc;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
rc = lstcon_group_find(name, grp); rc = lstcon_group_find(name, grp);
if (rc != 0) { if (rc != 0) {
...@@ -1398,13 +1398,13 @@ lstcon_test_batch_query(char *name, int testidx, int client, ...@@ -1398,13 +1398,13 @@ lstcon_test_batch_query(char *name, int testidx, int client,
int timeout, struct list_head *result_up) int timeout, struct list_head *result_up)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
struct list_head *translist; struct list_head *translist;
struct list_head *ndlist; struct list_head *ndlist;
lstcon_tsb_hdr_t *hdr; lstcon_tsb_hdr_t *hdr;
lstcon_batch_t *batch; lstcon_batch_t *batch;
lstcon_test_t *test = NULL; lstcon_test_t *test = NULL;
int transop; int transop;
int rc; int rc;
rc = lstcon_batch_find(name, &batch); rc = lstcon_batch_find(name, &batch);
if (rc != 0) { if (rc != 0) {
...@@ -1460,9 +1460,9 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg, ...@@ -1460,9 +1460,9 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
lstcon_rpc_ent_t *ent_up) lstcon_rpc_ent_t *ent_up)
{ {
srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; srpc_stat_reply_t *rep = &msg->msg_body.stat_reply;
sfw_counters_t *sfwk_stat; sfw_counters_t *sfwk_stat;
srpc_counters_t *srpc_stat; srpc_counters_t *srpc_stat;
lnet_counters_t *lnet_stat; lnet_counters_t *lnet_stat;
if (rep->str_status != 0) if (rep->str_status != 0)
return 0; return 0;
...@@ -1483,9 +1483,9 @@ static int ...@@ -1483,9 +1483,9 @@ static int
lstcon_ndlist_stat(struct list_head *ndlist, lstcon_ndlist_stat(struct list_head *ndlist,
int timeout, struct list_head *result_up) int timeout, struct list_head *result_up)
{ {
struct list_head head; struct list_head head;
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
int rc; int rc;
INIT_LIST_HEAD(&head); INIT_LIST_HEAD(&head);
...@@ -1508,8 +1508,8 @@ lstcon_ndlist_stat(struct list_head *ndlist, ...@@ -1508,8 +1508,8 @@ lstcon_ndlist_stat(struct list_head *ndlist,
int int
lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up) lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
rc = lstcon_group_find(grp_name, &grp); rc = lstcon_group_find(grp_name, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -1528,11 +1528,11 @@ int ...@@ -1528,11 +1528,11 @@ int
lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
int timeout, struct list_head *result_up) int timeout, struct list_head *result_up)
{ {
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int i; int i;
int rc; int rc;
rc = lstcon_group_alloc(NULL, &tmp); rc = lstcon_group_alloc(NULL, &tmp);
if (rc != 0) { if (rc != 0) {
...@@ -1604,7 +1604,7 @@ lstcon_batch_debug(int timeout, char *name, ...@@ -1604,7 +1604,7 @@ lstcon_batch_debug(int timeout, char *name,
int client, struct list_head *result_up) int client, struct list_head *result_up)
{ {
lstcon_batch_t *bat; lstcon_batch_t *bat;
int rc; int rc;
rc = lstcon_batch_find(name, &bat); rc = lstcon_batch_find(name, &bat);
if (rc != 0) if (rc != 0)
...@@ -1622,7 +1622,7 @@ lstcon_group_debug(int timeout, char *name, ...@@ -1622,7 +1622,7 @@ lstcon_group_debug(int timeout, char *name,
struct list_head *result_up) struct list_head *result_up)
{ {
lstcon_group_t *grp; lstcon_group_t *grp;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
if (rc != 0) if (rc != 0)
...@@ -1640,11 +1640,11 @@ lstcon_nodes_debug(int timeout, ...@@ -1640,11 +1640,11 @@ lstcon_nodes_debug(int timeout,
int count, lnet_process_id_t *ids_up, int count, lnet_process_id_t *ids_up,
struct list_head *result_up) struct list_head *result_up)
{ {
lnet_process_id_t id; lnet_process_id_t id;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
lstcon_group_t *grp; lstcon_group_t *grp;
int i; int i;
int rc; int rc;
rc = lstcon_group_alloc(NULL, &grp); rc = lstcon_group_alloc(NULL, &grp);
if (rc != 0) { if (rc != 0) {
...@@ -1689,7 +1689,7 @@ lstcon_session_match(lst_sid_t sid) ...@@ -1689,7 +1689,7 @@ lstcon_session_match(lst_sid_t sid)
static void static void
lstcon_new_session_id(lst_sid_t *sid) lstcon_new_session_id(lst_sid_t *sid)
{ {
lnet_process_id_t id; lnet_process_id_t id;
LASSERT(console_session.ses_state == LST_SESSION_NONE); LASSERT(console_session.ses_state == LST_SESSION_NONE);
...@@ -1704,8 +1704,8 @@ int ...@@ -1704,8 +1704,8 @@ int
lstcon_session_new(char *name, int key, unsigned feats, lstcon_session_new(char *name, int key, unsigned feats,
int timeout, int force, lst_sid_t *sid_up) int timeout, int force, lst_sid_t *sid_up)
{ {
int rc = 0; int rc = 0;
int i; int i;
if (console_session.ses_state != LST_SESSION_NONE) { if (console_session.ses_state != LST_SESSION_NONE) {
/* session exists */ /* session exists */
...@@ -1733,9 +1733,9 @@ lstcon_session_new(char *name, int key, unsigned feats, ...@@ -1733,9 +1733,9 @@ lstcon_session_new(char *name, int key, unsigned feats,
lstcon_new_session_id(&console_session.ses_id); lstcon_new_session_id(&console_session.ses_id);
console_session.ses_key = key; console_session.ses_key = key;
console_session.ses_state = LST_SESSION_ACTIVE; console_session.ses_state = LST_SESSION_ACTIVE;
console_session.ses_force = !!force; console_session.ses_force = !!force;
console_session.ses_features = feats; console_session.ses_features = feats;
console_session.ses_feats_updated = 0; console_session.ses_feats_updated = 0;
console_session.ses_timeout = (timeout <= 0) ? console_session.ses_timeout = (timeout <= 0) ?
...@@ -1770,8 +1770,8 @@ lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp, ...@@ -1770,8 +1770,8 @@ lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp,
lstcon_ndlist_ent_t *ndinfo_up, char *name_up, int len) lstcon_ndlist_ent_t *ndinfo_up, char *name_up, int len)
{ {
lstcon_ndlist_ent_t *entp; lstcon_ndlist_ent_t *entp;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
int rc = 0; int rc = 0;
if (console_session.ses_state != LST_SESSION_ACTIVE) if (console_session.ses_state != LST_SESSION_ACTIVE)
return -ESRCH; return -ESRCH;
...@@ -1802,9 +1802,9 @@ int ...@@ -1802,9 +1802,9 @@ int
lstcon_session_end(void) lstcon_session_end(void)
{ {
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_group_t *grp; lstcon_group_t *grp;
lstcon_batch_t *bat; lstcon_batch_t *bat;
int rc = 0; int rc = 0;
LASSERT(console_session.ses_state == LST_SESSION_ACTIVE); LASSERT(console_session.ses_state == LST_SESSION_ACTIVE);
...@@ -1894,13 +1894,13 @@ lstcon_session_feats_check(unsigned feats) ...@@ -1894,13 +1894,13 @@ lstcon_session_feats_check(unsigned feats)
static int static int
lstcon_acceptor_handle(srpc_server_rpc_t *rpc) lstcon_acceptor_handle(srpc_server_rpc_t *rpc)
{ {
srpc_msg_t *rep = &rpc->srpc_replymsg; srpc_msg_t *rep = &rpc->srpc_replymsg;
srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg; srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg;
srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; srpc_join_reqst_t *jreq = &req->msg_body.join_reqst;
srpc_join_reply_t *jrep = &rep->msg_body.join_reply; srpc_join_reply_t *jrep = &rep->msg_body.join_reply;
lstcon_group_t *grp = NULL; lstcon_group_t *grp = NULL;
lstcon_ndlink_t *ndl; lstcon_ndlink_t *ndl;
int rc = 0; int rc = 0;
sfw_unpack_message(req); sfw_unpack_message(req);
...@@ -1978,9 +1978,9 @@ srpc_service_t lstcon_acceptor_service; ...@@ -1978,9 +1978,9 @@ srpc_service_t lstcon_acceptor_service;
static void lstcon_init_acceptor_service(void) static void lstcon_init_acceptor_service(void)
{ {
/* initialize selftest console acceptor service table */ /* initialize selftest console acceptor service table */
lstcon_acceptor_service.sv_name = "join session"; lstcon_acceptor_service.sv_name = "join session";
lstcon_acceptor_service.sv_handler = lstcon_acceptor_handle; lstcon_acceptor_service.sv_handler = lstcon_acceptor_handle;
lstcon_acceptor_service.sv_id = SRPC_SERVICE_JOIN; lstcon_acceptor_service.sv_id = SRPC_SERVICE_JOIN;
lstcon_acceptor_service.sv_wi_total = SFW_FRWK_WI_MAX; lstcon_acceptor_service.sv_wi_total = SFW_FRWK_WI_MAX;
} }
...@@ -1992,19 +1992,19 @@ static DECLARE_IOCTL_HANDLER(lstcon_ioctl_handler, lstcon_ioctl_entry); ...@@ -1992,19 +1992,19 @@ static DECLARE_IOCTL_HANDLER(lstcon_ioctl_handler, lstcon_ioctl_entry);
int int
lstcon_console_init(void) lstcon_console_init(void)
{ {
int i; int i;
int rc; int rc;
memset(&console_session, 0, sizeof(lstcon_session_t)); memset(&console_session, 0, sizeof(lstcon_session_t));
console_session.ses_id = LST_INVALID_SID; console_session.ses_id = LST_INVALID_SID;
console_session.ses_state = LST_SESSION_NONE; console_session.ses_state = LST_SESSION_NONE;
console_session.ses_timeout = 0; console_session.ses_timeout = 0;
console_session.ses_force = 0; console_session.ses_force = 0;
console_session.ses_expired = 0; console_session.ses_expired = 0;
console_session.ses_feats_updated = 0; console_session.ses_feats_updated = 0;
console_session.ses_features = LST_FEATS_MASK; console_session.ses_features = LST_FEATS_MASK;
console_session.ses_laststamp = get_seconds(); console_session.ses_laststamp = get_seconds();
mutex_init(&console_session.ses_mutex); mutex_init(&console_session.ses_mutex);
...@@ -2062,7 +2062,7 @@ lstcon_console_init(void) ...@@ -2062,7 +2062,7 @@ lstcon_console_init(void)
int int
lstcon_console_fini(void) lstcon_console_fini(void)
{ {
int i; int i;
libcfs_deregister_ioctl(&lstcon_ioctl_handler); libcfs_deregister_ioctl(&lstcon_ioctl_handler);
......
...@@ -52,119 +52,121 @@ ...@@ -52,119 +52,121 @@
#include "conrpc.h" #include "conrpc.h"
typedef struct lstcon_node { typedef struct lstcon_node {
lnet_process_id_t nd_id; /* id of the node */ lnet_process_id_t nd_id; /* id of the node */
int nd_ref; /* reference count */ int nd_ref; /* reference count */
int nd_state; /* state of the node */ int nd_state; /* state of the node */
int nd_timeout; /* session timeout */ int nd_timeout; /* session timeout */
unsigned long nd_stamp; /* timestamp of last replied RPC */ unsigned long nd_stamp; /* timestamp of last replied RPC */
struct lstcon_rpc nd_ping; /* ping rpc */ struct lstcon_rpc nd_ping; /* ping rpc */
} lstcon_node_t; /*** node descriptor */ } lstcon_node_t; /* node descriptor */
typedef struct { typedef struct {
struct list_head ndl_link; /* chain on list */ struct list_head ndl_link; /* chain on list */
struct list_head ndl_hlink; /* chain on hash */ struct list_head ndl_hlink; /* chain on hash */
lstcon_node_t *ndl_node; /* pointer to node */ lstcon_node_t *ndl_node; /* pointer to node */
} lstcon_ndlink_t; /*** node link descriptor */ } lstcon_ndlink_t; /* node link descriptor */
typedef struct { typedef struct {
struct list_head grp_link; /* chain on global group list */ struct list_head grp_link; /* chain on global group list
int grp_ref; /* reference count */ */
int grp_userland; /* has userland nodes */ int grp_ref; /* reference count */
int grp_nnode; /* # of nodes */ int grp_userland; /* has userland nodes */
char grp_name[LST_NAME_SIZE]; /* group name */ int grp_nnode; /* # of nodes */
char grp_name[LST_NAME_SIZE]; /* group name */
struct list_head grp_trans_list; /* transaction list */ struct list_head grp_trans_list; /* transaction list */
struct list_head grp_ndl_list; /* nodes list */ struct list_head grp_ndl_list; /* nodes list */
struct list_head grp_ndl_hash[0];/* hash table for nodes */ struct list_head grp_ndl_hash[0]; /* hash table for nodes */
} lstcon_group_t; /*** (alias of nodes) group descriptor */ } lstcon_group_t; /* (alias of nodes) group descriptor */
#define LST_BATCH_IDLE 0xB0 /* idle batch */ #define LST_BATCH_IDLE 0xB0 /* idle batch */
#define LST_BATCH_RUNNING 0xB1 /* running batch */ #define LST_BATCH_RUNNING 0xB1 /* running batch */
typedef struct lstcon_tsb_hdr { typedef struct lstcon_tsb_hdr {
lst_bid_t tsb_id; /* batch ID */ lst_bid_t tsb_id; /* batch ID */
int tsb_index; /* test index */ int tsb_index; /* test index */
} lstcon_tsb_hdr_t; } lstcon_tsb_hdr_t;
typedef struct { typedef struct {
lstcon_tsb_hdr_t bat_hdr; /* test_batch header */ lstcon_tsb_hdr_t bat_hdr; /* test_batch header */
struct list_head bat_link; /* chain on session's batches list */ struct list_head bat_link; /* chain on session's batches list */
int bat_ntest; /* # of test */ int bat_ntest; /* # of test */
int bat_state; /* state of the batch */ int bat_state; /* state of the batch */
int bat_arg; /* parameter for run|stop, timeout for run, force for stop */ int bat_arg; /* parameter for run|stop, timeout
char bat_name[LST_NAME_SIZE]; /* name of batch */ * for run, force for stop */
char bat_name[LST_NAME_SIZE];/* name of batch */
struct list_head bat_test_list; /* list head of tests (lstcon_test_t) */
struct list_head bat_trans_list; /* list head of transaction */ struct list_head bat_test_list; /* list head of tests (lstcon_test_t)
struct list_head bat_cli_list; /* list head of client nodes (lstcon_node_t) */ */
struct list_head *bat_cli_hash; /* hash table of client nodes */ struct list_head bat_trans_list; /* list head of transaction */
struct list_head bat_srv_list; /* list head of server nodes */ struct list_head bat_cli_list; /* list head of client nodes
struct list_head *bat_srv_hash; /* hash table of server nodes */ * (lstcon_node_t) */
} lstcon_batch_t; /*** (tests ) batch descriptor */ struct list_head *bat_cli_hash; /* hash table of client nodes */
struct list_head bat_srv_list; /* list head of server nodes */
struct list_head *bat_srv_hash; /* hash table of server nodes */
} lstcon_batch_t; /* (tests ) batch descriptor */
typedef struct lstcon_test { typedef struct lstcon_test {
lstcon_tsb_hdr_t tes_hdr; /* test batch header */ lstcon_tsb_hdr_t tes_hdr; /* test batch header */
struct list_head tes_link; /* chain on batch's tests list */ struct list_head tes_link; /* chain on batch's tests list */
lstcon_batch_t *tes_batch; /* pointer to batch */ lstcon_batch_t *tes_batch; /* pointer to batch */
int tes_type; /* type of the test, i.e: bulk, ping */ int tes_type; /* type of the test, i.e: bulk, ping */
int tes_stop_onerr; /* stop on error */ int tes_stop_onerr; /* stop on error */
int tes_oneside; /* one-sided test */ int tes_oneside; /* one-sided test */
int tes_concur; /* concurrency */ int tes_concur; /* concurrency */
int tes_loop; /* loop count */ int tes_loop; /* loop count */
int tes_dist; /* nodes distribution of target group */ int tes_dist; /* nodes distribution of target group */
int tes_span; /* nodes span of target group */ int tes_span; /* nodes span of target group */
int tes_cliidx; /* client index, used for RPC creating */ int tes_cliidx; /* client index, used for RPC creating */
struct list_head tes_trans_list; /* transaction list */ struct list_head tes_trans_list; /* transaction list */
lstcon_group_t *tes_src_grp; /* group run the test */ lstcon_group_t *tes_src_grp; /* group run the test */
lstcon_group_t *tes_dst_grp; /* target group */ lstcon_group_t *tes_dst_grp; /* target group */
int tes_paramlen; /* test parameter length */ int tes_paramlen; /* test parameter length */
char tes_param[0]; /* test parameter */ char tes_param[0]; /* test parameter */
} lstcon_test_t; /*** a single test descriptor */ } lstcon_test_t; /* a single test descriptor */
#define LST_GLOBAL_HASHSIZE 503 /* global nodes hash table size */ #define LST_GLOBAL_HASHSIZE 503 /* global nodes hash table size */
#define LST_NODE_HASHSIZE 239 /* node hash table (for batch or group) */ #define LST_NODE_HASHSIZE 239 /* node hash table (for batch or group) */
#define LST_SESSION_NONE 0x0 /* no session */ #define LST_SESSION_NONE 0x0 /* no session */
#define LST_SESSION_ACTIVE 0x1 /* working session */ #define LST_SESSION_ACTIVE 0x1 /* working session */
#define LST_CONSOLE_TIMEOUT 300 /* default console timeout */ #define LST_CONSOLE_TIMEOUT 300 /* default console timeout */
typedef struct { typedef struct {
struct mutex ses_mutex; /* only 1 thread in session */ struct mutex ses_mutex; /* only 1 thread in session */
lst_sid_t ses_id; /* global session id */ lst_sid_t ses_id; /* global session id */
int ses_key; /* local session key */ int ses_key; /* local session key */
int ses_state; /* state of session */ int ses_state; /* state of session */
int ses_timeout; /* timeout in seconds */ int ses_timeout; /* timeout in seconds */
time_t ses_laststamp; /* last operation stamp (seconds) */ time_t ses_laststamp; /* last operation stamp (seconds)
/** tests features of the session */ */
unsigned ses_features; unsigned ses_features; /* tests features of the session
/** features are synced with remote test nodes */ */
unsigned ses_feats_updated:1; unsigned ses_feats_updated:1; /* features are synced with
/** force creating */ * remote test nodes */
unsigned ses_force:1; unsigned ses_force:1; /* force creating */
/** session is shutting down */ unsigned ses_shutdown:1; /* session is shutting down */
unsigned ses_shutdown:1; unsigned ses_expired:1; /* console is timedout */
/** console is timedout */ __u64 ses_id_cookie; /* batch id cookie */
unsigned ses_expired:1; char ses_name[LST_NAME_SIZE];/* session name */
__u64 ses_id_cookie; /* batch id cookie */ lstcon_rpc_trans_t *ses_ping; /* session pinger */
char ses_name[LST_NAME_SIZE]; /* session name */ stt_timer_t ses_ping_timer; /* timer for pinger */
lstcon_rpc_trans_t *ses_ping; /* session pinger */ lstcon_trans_stat_t ses_trans_stat; /* transaction stats */
stt_timer_t ses_ping_timer; /* timer for pinger */
lstcon_trans_stat_t ses_trans_stat; /* transaction stats */ struct list_head ses_trans_list; /* global list of transaction */
struct list_head ses_grp_list; /* global list of groups */
struct list_head ses_trans_list; /* global list of transaction */ struct list_head ses_bat_list; /* global list of batches */
struct list_head ses_grp_list; /* global list of groups */ struct list_head ses_ndl_list; /* global list of nodes */
struct list_head ses_bat_list; /* global list of batches */ struct list_head *ses_ndl_hash; /* hash table of nodes */
struct list_head ses_ndl_list; /* global list of nodes */
struct list_head *ses_ndl_hash; /* hash table of nodes */ spinlock_t ses_rpc_lock; /* serialize */
atomic_t ses_rpc_counter; /* # of initialized RPCs */
spinlock_t ses_rpc_lock; /* serialize */ struct list_head ses_rpc_freelist; /* idle console rpc */
atomic_t ses_rpc_counter;/* # of initialized RPCs */ } lstcon_session_t; /* session descriptor */
struct list_head ses_rpc_freelist; /* idle console rpc */
} lstcon_session_t; /*** session descriptor */
extern lstcon_session_t console_session; extern lstcon_session_t console_session;
......
...@@ -53,20 +53,20 @@ static int rpc_timeout = 64; ...@@ -53,20 +53,20 @@ static int rpc_timeout = 64;
module_param(rpc_timeout, int, 0644); module_param(rpc_timeout, int, 0644);
MODULE_PARM_DESC(rpc_timeout, "rpc timeout in seconds (64 by default, 0 == never)"); MODULE_PARM_DESC(rpc_timeout, "rpc timeout in seconds (64 by default, 0 == never)");
#define sfw_unpack_id(id) \ #define sfw_unpack_id(id) \
do { \ do { \
__swab64s(&(id).nid); \ __swab64s(&(id).nid); \
__swab32s(&(id).pid); \ __swab32s(&(id).pid); \
} while (0) } while (0)
#define sfw_unpack_sid(sid) \ #define sfw_unpack_sid(sid) \
do { \ do { \
__swab64s(&(sid).ses_nid); \ __swab64s(&(sid).ses_nid); \
__swab64s(&(sid).ses_stamp); \ __swab64s(&(sid).ses_stamp); \
} while (0) } while (0)
#define sfw_unpack_fw_counters(fc) \ #define sfw_unpack_fw_counters(fc) \
do { \ do { \
__swab32s(&(fc).running_ms); \ __swab32s(&(fc).running_ms); \
__swab32s(&(fc).active_batches); \ __swab32s(&(fc).active_batches); \
__swab32s(&(fc).zombie_sessions); \ __swab32s(&(fc).zombie_sessions); \
...@@ -75,7 +75,7 @@ do { \ ...@@ -75,7 +75,7 @@ do { \
} while (0) } while (0)
#define sfw_unpack_rpc_counters(rc) \ #define sfw_unpack_rpc_counters(rc) \
do { \ do { \
__swab32s(&(rc).errors); \ __swab32s(&(rc).errors); \
__swab32s(&(rc).rpcs_sent); \ __swab32s(&(rc).rpcs_sent); \
__swab32s(&(rc).rpcs_rcvd); \ __swab32s(&(rc).rpcs_rcvd); \
...@@ -86,7 +86,7 @@ do { \ ...@@ -86,7 +86,7 @@ do { \
} while (0) } while (0)
#define sfw_unpack_lnet_counters(lc) \ #define sfw_unpack_lnet_counters(lc) \
do { \ do { \
__swab32s(&(lc).errors); \ __swab32s(&(lc).errors); \
__swab32s(&(lc).msgs_max); \ __swab32s(&(lc).msgs_max); \
__swab32s(&(lc).msgs_alloc); \ __swab32s(&(lc).msgs_alloc); \
...@@ -104,14 +104,14 @@ do { \ ...@@ -104,14 +104,14 @@ do { \
#define sfw_batch_active(b) (atomic_read(&(b)->bat_nactive) != 0) #define sfw_batch_active(b) (atomic_read(&(b)->bat_nactive) != 0)
static struct smoketest_framework { static struct smoketest_framework {
struct list_head fw_zombie_rpcs; /* RPCs to be recycled */ struct list_head fw_zombie_rpcs; /* RPCs to be recycled */
struct list_head fw_zombie_sessions; /* stopping sessions */ struct list_head fw_zombie_sessions; /* stopping sessions */
struct list_head fw_tests; /* registered test cases */ struct list_head fw_tests; /* registered test cases */
atomic_t fw_nzombies; /* # zombie sessions */ atomic_t fw_nzombies; /* # zombie sessions */
spinlock_t fw_lock; /* serialise */ spinlock_t fw_lock; /* serialise */
sfw_session_t *fw_session; /* _the_ session */ sfw_session_t *fw_session; /* _the_ session */
int fw_shuttingdown; /* shutdown in progress */ int fw_shuttingdown; /* shutdown in progress */
srpc_server_rpc_t *fw_active_srpc; /* running RPC */ srpc_server_rpc_t *fw_active_srpc; /* running RPC */
} sfw_data; } sfw_data;
/* forward ref's */ /* forward ref's */
...@@ -160,7 +160,7 @@ static void ...@@ -160,7 +160,7 @@ static void
sfw_add_session_timer(void) sfw_add_session_timer(void)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
stt_timer_t *timer = &sn->sn_timer; stt_timer_t *timer = &sn->sn_timer;
LASSERT(!sfw_data.fw_shuttingdown); LASSERT(!sfw_data.fw_shuttingdown);
...@@ -199,8 +199,8 @@ sfw_deactivate_session(void) ...@@ -199,8 +199,8 @@ sfw_deactivate_session(void)
__must_hold(&sfw_data.fw_lock) __must_hold(&sfw_data.fw_lock)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
int nactive = 0; int nactive = 0;
sfw_batch_t *tsb; sfw_batch_t *tsb;
sfw_test_case_t *tsc; sfw_test_case_t *tsc;
if (sn == NULL) return; if (sn == NULL) return;
...@@ -273,7 +273,7 @@ sfw_init_session(sfw_session_t *sn, lst_sid_t sid, ...@@ -273,7 +273,7 @@ sfw_init_session(sfw_session_t *sn, lst_sid_t sid,
strlcpy(&sn->sn_name[0], name, sizeof(sn->sn_name)); strlcpy(&sn->sn_name[0], name, sizeof(sn->sn_name));
sn->sn_timer_active = 0; sn->sn_timer_active = 0;
sn->sn_id = sid; sn->sn_id = sid;
sn->sn_features = features; sn->sn_features = features;
sn->sn_timeout = session_timeout; sn->sn_timeout = session_timeout;
sn->sn_started = cfs_time_current(); sn->sn_started = cfs_time_current();
...@@ -287,8 +287,8 @@ sfw_init_session(sfw_session_t *sn, lst_sid_t sid, ...@@ -287,8 +287,8 @@ sfw_init_session(sfw_session_t *sn, lst_sid_t sid,
static void static void
sfw_server_rpc_done(struct srpc_server_rpc *rpc) sfw_server_rpc_done(struct srpc_server_rpc *rpc)
{ {
struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_service *sv = rpc->srpc_scd->scd_svc;
int status = rpc->srpc_status; int status = rpc->srpc_status;
CDEBUG(D_NET, CDEBUG(D_NET,
"Incoming framework RPC done: service %s, peer %s, status %s:%d\n", "Incoming framework RPC done: service %s, peer %s, status %s:%d\n",
...@@ -327,7 +327,7 @@ static sfw_batch_t * ...@@ -327,7 +327,7 @@ static sfw_batch_t *
sfw_find_batch(lst_bid_t bid) sfw_find_batch(lst_bid_t bid)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
sfw_batch_t *bat; sfw_batch_t *bat;
LASSERT(sn != NULL); LASSERT(sn != NULL);
...@@ -343,7 +343,7 @@ static sfw_batch_t * ...@@ -343,7 +343,7 @@ static sfw_batch_t *
sfw_bid2batch(lst_bid_t bid) sfw_bid2batch(lst_bid_t bid)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
sfw_batch_t *bat; sfw_batch_t *bat;
LASSERT(sn != NULL); LASSERT(sn != NULL);
...@@ -368,10 +368,10 @@ sfw_bid2batch(lst_bid_t bid) ...@@ -368,10 +368,10 @@ sfw_bid2batch(lst_bid_t bid)
static int static int
sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
sfw_counters_t *cnt = &reply->str_fw; sfw_counters_t *cnt = &reply->str_fw;
sfw_batch_t *bat; sfw_batch_t *bat;
struct timeval tv; struct timeval tv;
reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
...@@ -412,9 +412,9 @@ int ...@@ -412,9 +412,9 @@ int
sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
srpc_msg_t *msg = container_of(request, srpc_msg_t, srpc_msg_t *msg = container_of(request, srpc_msg_t,
msg_body.mksn_reqst); msg_body.mksn_reqst);
int cplen = 0; int cplen = 0;
if (request->mksn_sid.ses_nid == LNET_NID_ANY) { if (request->mksn_sid.ses_nid == LNET_NID_ANY) {
reply->mksn_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; reply->mksn_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
...@@ -533,7 +533,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) ...@@ -533,7 +533,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply)
static void static void
sfw_test_rpc_fini(srpc_client_rpc_t *rpc) sfw_test_rpc_fini(srpc_client_rpc_t *rpc)
{ {
sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_unit_t *tsu = rpc->crpc_priv;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
/* Called with hold of tsi->tsi_lock */ /* Called with hold of tsi->tsi_lock */
...@@ -544,9 +544,9 @@ sfw_test_rpc_fini(srpc_client_rpc_t *rpc) ...@@ -544,9 +544,9 @@ sfw_test_rpc_fini(srpc_client_rpc_t *rpc)
static inline int static inline int
sfw_test_buffers(sfw_test_instance_t *tsi) sfw_test_buffers(sfw_test_instance_t *tsi)
{ {
struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service); struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service);
struct srpc_service *svc = tsc->tsc_srv_service; struct srpc_service *svc = tsc->tsc_srv_service;
int nbuf; int nbuf;
nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts; nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts;
return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA); return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA);
...@@ -555,10 +555,10 @@ sfw_test_buffers(sfw_test_instance_t *tsi) ...@@ -555,10 +555,10 @@ sfw_test_buffers(sfw_test_instance_t *tsi)
static int static int
sfw_load_test(struct sfw_test_instance *tsi) sfw_load_test(struct sfw_test_instance *tsi)
{ {
struct sfw_test_case *tsc; struct sfw_test_case *tsc;
struct srpc_service *svc; struct srpc_service *svc;
int nbuf; int nbuf;
int rc; int rc;
LASSERT(tsi != NULL); LASSERT(tsi != NULL);
tsc = sfw_find_test_case(tsi->tsi_service); tsc = sfw_find_test_case(tsi->tsi_service);
...@@ -611,7 +611,7 @@ static void ...@@ -611,7 +611,7 @@ static void
sfw_destroy_test_instance(sfw_test_instance_t *tsi) sfw_destroy_test_instance(sfw_test_instance_t *tsi)
{ {
srpc_client_rpc_t *rpc; srpc_client_rpc_t *rpc;
sfw_test_unit_t *tsu; sfw_test_unit_t *tsu;
if (!tsi->tsi_is_client) goto clean; if (!tsi->tsi_is_client) goto clean;
...@@ -728,14 +728,14 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) ...@@ -728,14 +728,14 @@ sfw_unpack_addtest_req(srpc_msg_t *msg)
static int static int
sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc) sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc)
{ {
srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg;
srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst;
srpc_bulk_t *bk = rpc->srpc_bulk; srpc_bulk_t *bk = rpc->srpc_bulk;
int ndest = req->tsr_ndest; int ndest = req->tsr_ndest;
sfw_test_unit_t *tsu; sfw_test_unit_t *tsu;
sfw_test_instance_t *tsi; sfw_test_instance_t *tsi;
int i; int i;
int rc; int rc;
LIBCFS_ALLOC(tsi, sizeof(*tsi)); LIBCFS_ALLOC(tsi, sizeof(*tsi));
if (tsi == NULL) { if (tsi == NULL) {
...@@ -751,9 +751,9 @@ sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc) ...@@ -751,9 +751,9 @@ sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc)
INIT_LIST_HEAD(&tsi->tsi_active_rpcs); INIT_LIST_HEAD(&tsi->tsi_active_rpcs);
tsi->tsi_stopping = 0; tsi->tsi_stopping = 0;
tsi->tsi_batch = tsb; tsi->tsi_batch = tsb;
tsi->tsi_loop = req->tsr_loop; tsi->tsi_loop = req->tsr_loop;
tsi->tsi_concur = req->tsr_concur; tsi->tsi_concur = req->tsr_concur;
tsi->tsi_service = req->tsr_service; tsi->tsi_service = req->tsr_service;
tsi->tsi_is_client = !!(req->tsr_is_client); tsi->tsi_is_client = !!(req->tsr_is_client);
tsi->tsi_stoptsu_onerr = !!(req->tsr_stop_onerr); tsi->tsi_stoptsu_onerr = !!(req->tsr_stop_onerr);
...@@ -782,8 +782,8 @@ sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc) ...@@ -782,8 +782,8 @@ sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc)
for (i = 0; i < ndest; i++) { for (i = 0; i < ndest; i++) {
lnet_process_id_packed_t *dests; lnet_process_id_packed_t *dests;
lnet_process_id_packed_t id; lnet_process_id_packed_t id;
int j; int j;
dests = page_address(bk->bk_iovs[i / SFW_ID_PER_PAGE].kiov_page); dests = page_address(bk->bk_iovs[i / SFW_ID_PER_PAGE].kiov_page);
LASSERT(dests != NULL); /* my pages are within KVM always */ LASSERT(dests != NULL); /* my pages are within KVM always */
...@@ -824,8 +824,8 @@ static void ...@@ -824,8 +824,8 @@ static void
sfw_test_unit_done(sfw_test_unit_t *tsu) sfw_test_unit_done(sfw_test_unit_t *tsu)
{ {
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_batch_t *tsb = tsi->tsi_batch; sfw_batch_t *tsb = tsi->tsi_batch;
sfw_session_t *sn = tsb->bat_session; sfw_session_t *sn = tsb->bat_session;
LASSERT(sfw_test_active(tsi)); LASSERT(sfw_test_active(tsi));
...@@ -866,9 +866,9 @@ sfw_test_unit_done(sfw_test_unit_t *tsu) ...@@ -866,9 +866,9 @@ sfw_test_unit_done(sfw_test_unit_t *tsu)
static void static void
sfw_test_rpc_done(srpc_client_rpc_t *rpc) sfw_test_rpc_done(srpc_client_rpc_t *rpc)
{ {
sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_unit_t *tsu = rpc->crpc_priv;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
int done = 0; int done = 0;
tsi->tsi_ops->tso_done_rpc(tsu, rpc); tsi->tsi_ops->tso_done_rpc(tsu, rpc);
...@@ -904,7 +904,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, ...@@ -904,7 +904,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer,
unsigned features, int nblk, int blklen, unsigned features, int nblk, int blklen,
srpc_client_rpc_t **rpcpp) srpc_client_rpc_t **rpcpp)
{ {
srpc_client_rpc_t *rpc = NULL; srpc_client_rpc_t *rpc = NULL;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
spin_lock(&tsi->tsi_lock); spin_lock(&tsi->tsi_lock);
...@@ -945,9 +945,9 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, ...@@ -945,9 +945,9 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer,
static int static int
sfw_run_test(swi_workitem_t *wi) sfw_run_test(swi_workitem_t *wi)
{ {
sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; sfw_test_unit_t *tsu = wi->swi_workitem.wi_data;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
srpc_client_rpc_t *rpc = NULL; srpc_client_rpc_t *rpc = NULL;
LASSERT(wi == &tsu->tsu_worker); LASSERT(wi == &tsu->tsu_worker);
...@@ -995,8 +995,8 @@ sfw_run_test(swi_workitem_t *wi) ...@@ -995,8 +995,8 @@ sfw_run_test(swi_workitem_t *wi)
static int static int
sfw_run_batch(sfw_batch_t *tsb) sfw_run_batch(sfw_batch_t *tsb)
{ {
swi_workitem_t *wi; swi_workitem_t *wi;
sfw_test_unit_t *tsu; sfw_test_unit_t *tsu;
sfw_test_instance_t *tsi; sfw_test_instance_t *tsi;
if (sfw_batch_active(tsb)) { if (sfw_batch_active(tsb)) {
...@@ -1032,7 +1032,7 @@ int ...@@ -1032,7 +1032,7 @@ int
sfw_stop_batch(sfw_batch_t *tsb, int force) sfw_stop_batch(sfw_batch_t *tsb, int force)
{ {
sfw_test_instance_t *tsi; sfw_test_instance_t *tsi;
srpc_client_rpc_t *rpc; srpc_client_rpc_t *rpc;
if (!sfw_batch_active(tsb)) { if (!sfw_batch_active(tsb)) {
CDEBUG(D_NET, "Batch %llu inactive\n", tsb->bat_id.bat_id); CDEBUG(D_NET, "Batch %llu inactive\n", tsb->bat_id.bat_id);
...@@ -1118,11 +1118,11 @@ sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, ...@@ -1118,11 +1118,11 @@ sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len,
static int static int
sfw_add_test(srpc_server_rpc_t *rpc) sfw_add_test(srpc_server_rpc_t *rpc)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply;
srpc_test_reqst_t *request; srpc_test_reqst_t *request;
int rc; int rc;
sfw_batch_t *bat; sfw_batch_t *bat;
request = &rpc->srpc_reqstbuf->buf_msg.msg_body.tes_reqst; request = &rpc->srpc_reqstbuf->buf_msg.msg_body.tes_reqst;
reply->tsr_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; reply->tsr_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
...@@ -1160,8 +1160,8 @@ sfw_add_test(srpc_server_rpc_t *rpc) ...@@ -1160,8 +1160,8 @@ sfw_add_test(srpc_server_rpc_t *rpc)
if (request->tsr_is_client && rpc->srpc_bulk == NULL) { if (request->tsr_is_client && rpc->srpc_bulk == NULL) {
/* rpc will be resumed later in sfw_bulk_ready */ /* rpc will be resumed later in sfw_bulk_ready */
int npg = sfw_id_pages(request->tsr_ndest); int npg = sfw_id_pages(request->tsr_ndest);
int len; int len;
if ((sn->sn_features & LST_FEAT_BULK_LEN) == 0) { if ((sn->sn_features & LST_FEAT_BULK_LEN) == 0) {
len = npg * PAGE_CACHE_SIZE; len = npg * PAGE_CACHE_SIZE;
...@@ -1189,8 +1189,8 @@ static int ...@@ -1189,8 +1189,8 @@ static int
sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
int rc = 0; int rc = 0;
sfw_batch_t *bat; sfw_batch_t *bat;
reply->bar_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; reply->bar_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
...@@ -1229,11 +1229,11 @@ sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) ...@@ -1229,11 +1229,11 @@ sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply)
static int static int
sfw_handle_server_rpc(struct srpc_server_rpc *rpc) sfw_handle_server_rpc(struct srpc_server_rpc *rpc)
{ {
struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_service *sv = rpc->srpc_scd->scd_svc;
srpc_msg_t *reply = &rpc->srpc_replymsg; srpc_msg_t *reply = &rpc->srpc_replymsg;
srpc_msg_t *request = &rpc->srpc_reqstbuf->buf_msg; srpc_msg_t *request = &rpc->srpc_reqstbuf->buf_msg;
unsigned features = LST_FEATS_MASK; unsigned features = LST_FEATS_MASK;
int rc = 0; int rc = 0;
LASSERT(sfw_data.fw_active_srpc == NULL); LASSERT(sfw_data.fw_active_srpc == NULL);
LASSERT(sv->sv_id <= SRPC_FRAMEWORK_SERVICE_MAX_ID); LASSERT(sv->sv_id <= SRPC_FRAMEWORK_SERVICE_MAX_ID);
...@@ -1334,8 +1334,8 @@ sfw_handle_server_rpc(struct srpc_server_rpc *rpc) ...@@ -1334,8 +1334,8 @@ sfw_handle_server_rpc(struct srpc_server_rpc *rpc)
static int static int
sfw_bulk_ready(struct srpc_server_rpc *rpc, int status) sfw_bulk_ready(struct srpc_server_rpc *rpc, int status)
{ {
struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_service *sv = rpc->srpc_scd->scd_svc;
int rc; int rc;
LASSERT(rpc->srpc_bulk != NULL); LASSERT(rpc->srpc_bulk != NULL);
LASSERT(sv->sv_id == SRPC_SERVICE_TEST); LASSERT(sv->sv_id == SRPC_SERVICE_TEST);
...@@ -1640,10 +1640,10 @@ extern void brw_init_test_service(void); ...@@ -1640,10 +1640,10 @@ extern void brw_init_test_service(void);
int int
sfw_startup(void) sfw_startup(void)
{ {
int i; int i;
int rc; int rc;
int error; int error;
srpc_service_t *sv; srpc_service_t *sv;
sfw_test_case_t *tsc; sfw_test_case_t *tsc;
...@@ -1735,9 +1735,9 @@ sfw_startup(void) ...@@ -1735,9 +1735,9 @@ sfw_startup(void)
void void
sfw_shutdown(void) sfw_shutdown(void)
{ {
srpc_service_t *sv; srpc_service_t *sv;
sfw_test_case_t *tsc; sfw_test_case_t *tsc;
int i; int i;
spin_lock(&sfw_data.fw_lock); spin_lock(&sfw_data.fw_lock);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "selftest.h" #include "selftest.h"
enum { enum {
LST_INIT_NONE = 0, LST_INIT_NONE = 0,
LST_INIT_WI_SERIAL, LST_INIT_WI_SERIAL,
LST_INIT_WI_TEST, LST_INIT_WI_TEST,
LST_INIT_RPC, LST_INIT_RPC,
...@@ -58,7 +58,7 @@ struct cfs_wi_sched **lst_sched_test; ...@@ -58,7 +58,7 @@ struct cfs_wi_sched **lst_sched_test;
static void static void
lnet_selftest_fini(void) lnet_selftest_fini(void)
{ {
int i; int i;
switch (lst_init_step) { switch (lst_init_step) {
case LST_INIT_CONSOLE: case LST_INIT_CONSOLE:
...@@ -92,9 +92,9 @@ lnet_selftest_fini(void) ...@@ -92,9 +92,9 @@ lnet_selftest_fini(void)
static int static int
lnet_selftest_init(void) lnet_selftest_init(void)
{ {
int nscheds; int nscheds;
int rc; int rc;
int i; int i;
rc = cfs_wi_sched_create("lst_s", lnet_cpt_table(), CFS_CPT_ANY, rc = cfs_wi_sched_create("lst_s", lnet_cpt_table(), CFS_CPT_ANY,
1, &lst_sched_serial); 1, &lst_sched_serial);
......
...@@ -73,7 +73,7 @@ static void ...@@ -73,7 +73,7 @@ static void
ping_client_fini(sfw_test_instance_t *tsi) ping_client_fini(sfw_test_instance_t *tsi)
{ {
sfw_session_t *sn = tsi->tsi_batch->bat_session; sfw_session_t *sn = tsi->tsi_batch->bat_session;
int errors; int errors;
LASSERT(sn != NULL); LASSERT(sn != NULL);
LASSERT(tsi->tsi_is_client); LASSERT(tsi->tsi_is_client);
...@@ -89,11 +89,11 @@ static int ...@@ -89,11 +89,11 @@ static int
ping_client_prep_rpc(sfw_test_unit_t *tsu, ping_client_prep_rpc(sfw_test_unit_t *tsu,
lnet_process_id_t dest, srpc_client_rpc_t **rpc) lnet_process_id_t dest, srpc_client_rpc_t **rpc)
{ {
srpc_ping_reqst_t *req; srpc_ping_reqst_t *req;
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session; sfw_session_t *sn = tsi->tsi_batch->bat_session;
struct timeval tv; struct timeval tv;
int rc; int rc;
LASSERT(sn != NULL); LASSERT(sn != NULL);
LASSERT((sn->sn_features & ~LST_FEATS_MASK) == 0); LASSERT((sn->sn_features & ~LST_FEATS_MASK) == 0);
...@@ -121,10 +121,10 @@ static void ...@@ -121,10 +121,10 @@ static void
ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
{ {
sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session; sfw_session_t *sn = tsi->tsi_batch->bat_session;
srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst;
srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply;
struct timeval tv; struct timeval tv;
LASSERT(sn != NULL); LASSERT(sn != NULL);
...@@ -171,9 +171,9 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) ...@@ -171,9 +171,9 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
static int static int
ping_server_handle(struct srpc_server_rpc *rpc) ping_server_handle(struct srpc_server_rpc *rpc)
{ {
struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_service *sv = rpc->srpc_scd->scd_svc;
srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
srpc_msg_t *replymsg = &rpc->srpc_replymsg; srpc_msg_t *replymsg = &rpc->srpc_replymsg;
srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst; srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst;
srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply; srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply;
......
...@@ -104,7 +104,7 @@ srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob) ...@@ -104,7 +104,7 @@ srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob)
void void
srpc_free_bulk(srpc_bulk_t *bk) srpc_free_bulk(srpc_bulk_t *bk)
{ {
int i; int i;
struct page *pg; struct page *pg;
LASSERT(bk != NULL); LASSERT(bk != NULL);
...@@ -124,8 +124,8 @@ srpc_free_bulk(srpc_bulk_t *bk) ...@@ -124,8 +124,8 @@ srpc_free_bulk(srpc_bulk_t *bk)
srpc_bulk_t * srpc_bulk_t *
srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)
{ {
srpc_bulk_t *bk; srpc_bulk_t *bk;
int i; int i;
LASSERT(bulk_npg > 0 && bulk_npg <= LNET_MAX_IOV); LASSERT(bulk_npg > 0 && bulk_npg <= LNET_MAX_IOV);
...@@ -143,7 +143,7 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) ...@@ -143,7 +143,7 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)
for (i = 0; i < bulk_npg; i++) { for (i = 0; i < bulk_npg; i++) {
struct page *pg; struct page *pg;
int nob; int nob;
pg = alloc_pages_node(cfs_cpt_spread_node(lnet_cpt_table(), cpt), pg = alloc_pages_node(cfs_cpt_spread_node(lnet_cpt_table(), cpt),
GFP_IOFS, 0); GFP_IOFS, 0);
...@@ -193,11 +193,11 @@ srpc_init_server_rpc(struct srpc_server_rpc *rpc, ...@@ -193,11 +193,11 @@ srpc_init_server_rpc(struct srpc_server_rpc *rpc,
static void static void
srpc_service_fini(struct srpc_service *svc) srpc_service_fini(struct srpc_service *svc)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc; struct srpc_server_rpc *rpc;
struct srpc_buffer *buf; struct srpc_buffer *buf;
struct list_head *q; struct list_head *q;
int i; int i;
if (svc->sv_cpt_data == NULL) if (svc->sv_cpt_data == NULL)
return; return;
...@@ -249,11 +249,11 @@ int srpc_add_buffer(struct swi_workitem *wi); ...@@ -249,11 +249,11 @@ int srpc_add_buffer(struct swi_workitem *wi);
static int static int
srpc_service_init(struct srpc_service *svc) srpc_service_init(struct srpc_service *svc)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc; struct srpc_server_rpc *rpc;
int nrpcs; int nrpcs;
int i; int i;
int j; int j;
svc->sv_shuttingdown = 0; svc->sv_shuttingdown = 0;
...@@ -357,8 +357,8 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, ...@@ -357,8 +357,8 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf,
int len, int options, lnet_process_id_t peer, int len, int options, lnet_process_id_t peer,
lnet_handle_md_t *mdh, srpc_event_t *ev) lnet_handle_md_t *mdh, srpc_event_t *ev)
{ {
int rc; int rc;
lnet_md_t md; lnet_md_t md;
lnet_handle_me_t meh; lnet_handle_me_t meh;
rc = LNetMEAttach(portal, peer, matchbits, 0, LNET_UNLINK, rc = LNetMEAttach(portal, peer, matchbits, 0, LNET_UNLINK,
...@@ -397,7 +397,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, ...@@ -397,7 +397,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
int options, lnet_process_id_t peer, lnet_nid_t self, int options, lnet_process_id_t peer, lnet_nid_t self,
lnet_handle_md_t *mdh, srpc_event_t *ev) lnet_handle_md_t *mdh, srpc_event_t *ev)
{ {
int rc; int rc;
lnet_md_t md; lnet_md_t md;
md.user_ptr = ev; md.user_ptr = ev;
...@@ -471,9 +471,9 @@ static int ...@@ -471,9 +471,9 @@ static int
srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf) srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf)
__must_hold(&scd->scd_lock) __must_hold(&scd->scd_lock)
{ {
struct srpc_service *sv = scd->scd_svc; struct srpc_service *sv = scd->scd_svc;
struct srpc_msg *msg = &buf->buf_msg; struct srpc_msg *msg = &buf->buf_msg;
int rc; int rc;
LNetInvalidateHandle(&buf->buf_mdh); LNetInvalidateHandle(&buf->buf_mdh);
list_add(&buf->buf_list, &scd->scd_buf_posted); list_add(&buf->buf_list, &scd->scd_buf_posted);
...@@ -519,9 +519,9 @@ srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf) ...@@ -519,9 +519,9 @@ srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf)
int int
srpc_add_buffer(struct swi_workitem *wi) srpc_add_buffer(struct swi_workitem *wi)
{ {
struct srpc_service_cd *scd = wi->swi_workitem.wi_data; struct srpc_service_cd *scd = wi->swi_workitem.wi_data;
struct srpc_buffer *buf; struct srpc_buffer *buf;
int rc = 0; int rc = 0;
/* it's called by workitem scheduler threads, these threads /* it's called by workitem scheduler threads, these threads
* should have been set CPT affinity, so buffers will be posted * should have been set CPT affinity, so buffers will be posted
...@@ -579,9 +579,9 @@ srpc_add_buffer(struct swi_workitem *wi) ...@@ -579,9 +579,9 @@ srpc_add_buffer(struct swi_workitem *wi)
int int
srpc_service_add_buffers(struct srpc_service *sv, int nbuffer) srpc_service_add_buffers(struct srpc_service *sv, int nbuffer)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
int rc = 0; int rc = 0;
int i; int i;
LASSERTF(nbuffer > 0, "nbuffer must be positive: %d\n", nbuffer); LASSERTF(nbuffer > 0, "nbuffer must be positive: %d\n", nbuffer);
...@@ -633,9 +633,9 @@ srpc_service_add_buffers(struct srpc_service *sv, int nbuffer) ...@@ -633,9 +633,9 @@ srpc_service_add_buffers(struct srpc_service *sv, int nbuffer)
void void
srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer) srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
int num; int num;
int i; int i;
LASSERT(!sv->sv_shuttingdown); LASSERT(!sv->sv_shuttingdown);
...@@ -653,9 +653,9 @@ srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer) ...@@ -653,9 +653,9 @@ srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer)
int int
srpc_finish_service(struct srpc_service *sv) srpc_finish_service(struct srpc_service *sv)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc; struct srpc_server_rpc *rpc;
int i; int i;
LASSERT(sv->sv_shuttingdown); /* srpc_shutdown_service called */ LASSERT(sv->sv_shuttingdown); /* srpc_shutdown_service called */
...@@ -731,9 +731,9 @@ srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf) ...@@ -731,9 +731,9 @@ srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf)
void void
srpc_abort_service(struct srpc_service *sv) srpc_abort_service(struct srpc_service *sv)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc; struct srpc_server_rpc *rpc;
int i; int i;
CDEBUG(D_NET, "Aborting service: id %d, name %s\n", CDEBUG(D_NET, "Aborting service: id %d, name %s\n",
sv->sv_id, sv->sv_name); sv->sv_id, sv->sv_name);
...@@ -756,10 +756,10 @@ srpc_abort_service(struct srpc_service *sv) ...@@ -756,10 +756,10 @@ srpc_abort_service(struct srpc_service *sv)
void void
srpc_shutdown_service(srpc_service_t *sv) srpc_shutdown_service(srpc_service_t *sv)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc; struct srpc_server_rpc *rpc;
srpc_buffer_t *buf; srpc_buffer_t *buf;
int i; int i;
CDEBUG(D_NET, "Shutting down service: id %d, name %s\n", CDEBUG(D_NET, "Shutting down service: id %d, name %s\n",
sv->sv_id, sv->sv_name); sv->sv_id, sv->sv_name);
...@@ -792,7 +792,7 @@ static int ...@@ -792,7 +792,7 @@ static int
srpc_send_request(srpc_client_rpc_t *rpc) srpc_send_request(srpc_client_rpc_t *rpc)
{ {
srpc_event_t *ev = &rpc->crpc_reqstev; srpc_event_t *ev = &rpc->crpc_reqstev;
int rc; int rc;
ev->ev_fired = 0; ev->ev_fired = 0;
ev->ev_data = rpc; ev->ev_data = rpc;
...@@ -812,8 +812,8 @@ static int ...@@ -812,8 +812,8 @@ static int
srpc_prepare_reply(srpc_client_rpc_t *rpc) srpc_prepare_reply(srpc_client_rpc_t *rpc)
{ {
srpc_event_t *ev = &rpc->crpc_replyev; srpc_event_t *ev = &rpc->crpc_replyev;
__u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid;
int rc; int rc;
ev->ev_fired = 0; ev->ev_fired = 0;
ev->ev_data = rpc; ev->ev_data = rpc;
...@@ -835,11 +835,11 @@ srpc_prepare_reply(srpc_client_rpc_t *rpc) ...@@ -835,11 +835,11 @@ srpc_prepare_reply(srpc_client_rpc_t *rpc)
static int static int
srpc_prepare_bulk(srpc_client_rpc_t *rpc) srpc_prepare_bulk(srpc_client_rpc_t *rpc)
{ {
srpc_bulk_t *bk = &rpc->crpc_bulk; srpc_bulk_t *bk = &rpc->crpc_bulk;
srpc_event_t *ev = &rpc->crpc_bulkev; srpc_event_t *ev = &rpc->crpc_bulkev;
__u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid;
int rc; int rc;
int opt; int opt;
LASSERT(bk->bk_niov <= LNET_MAX_IOV); LASSERT(bk->bk_niov <= LNET_MAX_IOV);
...@@ -868,11 +868,11 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc) ...@@ -868,11 +868,11 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc)
static int static int
srpc_do_bulk(srpc_server_rpc_t *rpc) srpc_do_bulk(srpc_server_rpc_t *rpc)
{ {
srpc_event_t *ev = &rpc->srpc_ev; srpc_event_t *ev = &rpc->srpc_ev;
srpc_bulk_t *bk = rpc->srpc_bulk; srpc_bulk_t *bk = rpc->srpc_bulk;
__u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid; __u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid;
int rc; int rc;
int opt; int opt;
LASSERT(bk != NULL); LASSERT(bk != NULL);
...@@ -896,9 +896,9 @@ srpc_do_bulk(srpc_server_rpc_t *rpc) ...@@ -896,9 +896,9 @@ srpc_do_bulk(srpc_server_rpc_t *rpc)
static void static void
srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status)
{ {
struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc; struct srpc_service *sv = scd->scd_svc;
srpc_buffer_t *buffer; srpc_buffer_t *buffer;
LASSERT(status != 0 || rpc->srpc_wi.swi_state == SWI_STATE_DONE); LASSERT(status != 0 || rpc->srpc_wi.swi_state == SWI_STATE_DONE);
...@@ -959,11 +959,11 @@ srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) ...@@ -959,11 +959,11 @@ srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status)
int int
srpc_handle_rpc(swi_workitem_t *wi) srpc_handle_rpc(swi_workitem_t *wi)
{ {
struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data; struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data;
struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc; struct srpc_service *sv = scd->scd_svc;
srpc_event_t *ev = &rpc->srpc_ev; srpc_event_t *ev = &rpc->srpc_ev;
int rc = 0; int rc = 0;
LASSERT(wi == &rpc->srpc_wi); LASSERT(wi == &rpc->srpc_wi);
...@@ -989,7 +989,7 @@ srpc_handle_rpc(swi_workitem_t *wi) ...@@ -989,7 +989,7 @@ srpc_handle_rpc(swi_workitem_t *wi)
default: default:
LBUG(); LBUG();
case SWI_STATE_NEWBORN: { case SWI_STATE_NEWBORN: {
srpc_msg_t *msg; srpc_msg_t *msg;
srpc_generic_reply_t *reply; srpc_generic_reply_t *reply;
msg = &rpc->srpc_reqstbuf->buf_msg; msg = &rpc->srpc_reqstbuf->buf_msg;
...@@ -1173,10 +1173,10 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status) ...@@ -1173,10 +1173,10 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status)
int int
srpc_send_rpc(swi_workitem_t *wi) srpc_send_rpc(swi_workitem_t *wi)
{ {
int rc = 0; int rc = 0;
srpc_client_rpc_t *rpc; srpc_client_rpc_t *rpc;
srpc_msg_t *reply; srpc_msg_t *reply;
int do_bulk; int do_bulk;
LASSERT(wi != NULL); LASSERT(wi != NULL);
...@@ -1359,13 +1359,13 @@ srpc_post_rpc(srpc_client_rpc_t *rpc) ...@@ -1359,13 +1359,13 @@ srpc_post_rpc(srpc_client_rpc_t *rpc)
int int
srpc_send_reply(struct srpc_server_rpc *rpc) srpc_send_reply(struct srpc_server_rpc *rpc)
{ {
srpc_event_t *ev = &rpc->srpc_ev; srpc_event_t *ev = &rpc->srpc_ev;
struct srpc_msg *msg = &rpc->srpc_replymsg; struct srpc_msg *msg = &rpc->srpc_replymsg;
struct srpc_buffer *buffer = rpc->srpc_reqstbuf; struct srpc_buffer *buffer = rpc->srpc_reqstbuf;
struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc; struct srpc_service *sv = scd->scd_svc;
__u64 rpyid; __u64 rpyid;
int rc; int rc;
LASSERT(buffer != NULL); LASSERT(buffer != NULL);
rpyid = buffer->buf_msg.msg_body.reqst.rpyid; rpyid = buffer->buf_msg.msg_body.reqst.rpyid;
...@@ -1403,14 +1403,14 @@ srpc_send_reply(struct srpc_server_rpc *rpc) ...@@ -1403,14 +1403,14 @@ srpc_send_reply(struct srpc_server_rpc *rpc)
static void static void
srpc_lnet_ev_handler(lnet_event_t *ev) srpc_lnet_ev_handler(lnet_event_t *ev)
{ {
struct srpc_service_cd *scd; struct srpc_service_cd *scd;
srpc_event_t *rpcev = ev->md.user_ptr; srpc_event_t *rpcev = ev->md.user_ptr;
srpc_client_rpc_t *crpc; srpc_client_rpc_t *crpc;
srpc_server_rpc_t *srpc; srpc_server_rpc_t *srpc;
srpc_buffer_t *buffer; srpc_buffer_t *buffer;
srpc_service_t *sv; srpc_service_t *sv;
srpc_msg_t *msg; srpc_msg_t *msg;
srpc_msg_type_t type; srpc_msg_type_t type;
LASSERT(!in_interrupt()); LASSERT(!in_interrupt());
......
...@@ -79,60 +79,61 @@ typedef struct { ...@@ -79,60 +79,61 @@ typedef struct {
} WIRE_ATTR srpc_generic_reqst_t; } WIRE_ATTR srpc_generic_reqst_t;
typedef struct { typedef struct {
__u32 status; __u32 status;
lst_sid_t sid; lst_sid_t sid;
} WIRE_ATTR srpc_generic_reply_t; } WIRE_ATTR srpc_generic_reply_t;
/* FRAMEWORK RPCs */ /* FRAMEWORK RPCs */
typedef struct { typedef struct {
__u64 mksn_rpyid; /* reply buffer matchbits */ __u64 mksn_rpyid; /* reply buffer matchbits */
lst_sid_t mksn_sid; /* session id */ lst_sid_t mksn_sid; /* session id */
__u32 mksn_force; /* use brute force */ __u32 mksn_force; /* use brute force */
char mksn_name[LST_NAME_SIZE]; char mksn_name[LST_NAME_SIZE];
} WIRE_ATTR srpc_mksn_reqst_t; /* make session request */ } WIRE_ATTR srpc_mksn_reqst_t; /* make session request */
typedef struct { typedef struct {
__u32 mksn_status; /* session status */ __u32 mksn_status; /* session status */
lst_sid_t mksn_sid; /* session id */ lst_sid_t mksn_sid; /* session id */
__u32 mksn_timeout; /* session timeout */ __u32 mksn_timeout; /* session timeout */
char mksn_name[LST_NAME_SIZE]; char mksn_name[LST_NAME_SIZE];
} WIRE_ATTR srpc_mksn_reply_t; /* make session reply */ } WIRE_ATTR srpc_mksn_reply_t; /* make session reply */
typedef struct { typedef struct {
__u64 rmsn_rpyid; /* reply buffer matchbits */ __u64 rmsn_rpyid; /* reply buffer matchbits */
lst_sid_t rmsn_sid; /* session id */ lst_sid_t rmsn_sid; /* session id */
} WIRE_ATTR srpc_rmsn_reqst_t; /* remove session request */ } WIRE_ATTR srpc_rmsn_reqst_t; /* remove session request */
typedef struct { typedef struct {
__u32 rmsn_status; __u32 rmsn_status;
lst_sid_t rmsn_sid; /* session id */ lst_sid_t rmsn_sid; /* session id */
} WIRE_ATTR srpc_rmsn_reply_t; /* remove session reply */ } WIRE_ATTR srpc_rmsn_reply_t; /* remove session reply */
typedef struct { typedef struct {
__u64 join_rpyid; /* reply buffer matchbits */ __u64 join_rpyid; /* reply buffer matchbits */
lst_sid_t join_sid; /* session id to join */ lst_sid_t join_sid; /* session id to join */
char join_group[LST_NAME_SIZE]; /* group name */ char join_group[LST_NAME_SIZE]; /* group name */
} WIRE_ATTR srpc_join_reqst_t; } WIRE_ATTR srpc_join_reqst_t;
typedef struct { typedef struct {
__u32 join_status; /* returned status */ __u32 join_status; /* returned status */
lst_sid_t join_sid; /* session id */ lst_sid_t join_sid; /* session id */
__u32 join_timeout; /* # seconds' inactivity to expire */ __u32 join_timeout; /* # seconds' inactivity to
char join_session[LST_NAME_SIZE]; /* session name */ * expire */
char join_session[LST_NAME_SIZE]; /* session name */
} WIRE_ATTR srpc_join_reply_t; } WIRE_ATTR srpc_join_reply_t;
typedef struct { typedef struct {
__u64 dbg_rpyid; /* reply buffer matchbits */ __u64 dbg_rpyid; /* reply buffer matchbits */
lst_sid_t dbg_sid; /* session id */ lst_sid_t dbg_sid; /* session id */
__u32 dbg_flags; /* bitmap of debug */ __u32 dbg_flags; /* bitmap of debug */
} WIRE_ATTR srpc_debug_reqst_t; } WIRE_ATTR srpc_debug_reqst_t;
typedef struct { typedef struct {
__u32 dbg_status; /* returned code */ __u32 dbg_status; /* returned code */
lst_sid_t dbg_sid; /* session id */ lst_sid_t dbg_sid; /* session id */
__u32 dbg_timeout; /* session timeout */ __u32 dbg_timeout; /* session timeout */
__u32 dbg_nbatch; /* # of batches in the node */ __u32 dbg_nbatch; /* # of batches in the node */
char dbg_name[LST_NAME_SIZE]; /* session name */ char dbg_name[LST_NAME_SIZE]; /* session name */
} WIRE_ATTR srpc_debug_reply_t; } WIRE_ATTR srpc_debug_reply_t;
#define SRPC_BATCH_OPC_RUN 1 #define SRPC_BATCH_OPC_RUN 1
...@@ -140,55 +141,51 @@ typedef struct { ...@@ -140,55 +141,51 @@ typedef struct {
#define SRPC_BATCH_OPC_QUERY 3 #define SRPC_BATCH_OPC_QUERY 3
typedef struct { typedef struct {
__u64 bar_rpyid; /* reply buffer matchbits */ __u64 bar_rpyid; /* reply buffer matchbits */
lst_sid_t bar_sid; /* session id */ lst_sid_t bar_sid; /* session id */
lst_bid_t bar_bid; /* batch id */ lst_bid_t bar_bid; /* batch id */
__u32 bar_opc; /* create/start/stop batch */ __u32 bar_opc; /* create/start/stop batch */
__u32 bar_testidx; /* index of test */ __u32 bar_testidx; /* index of test */
__u32 bar_arg; /* parameters */ __u32 bar_arg; /* parameters */
} WIRE_ATTR srpc_batch_reqst_t; } WIRE_ATTR srpc_batch_reqst_t;
typedef struct { typedef struct {
__u32 bar_status; /* status of request */ __u32 bar_status; /* status of request */
lst_sid_t bar_sid; /* session id */ lst_sid_t bar_sid; /* session id */
__u32 bar_active; /* # of active tests in batch/test */ __u32 bar_active; /* # of active tests in batch/test */
__u32 bar_time; /* remained time */ __u32 bar_time; /* remained time */
} WIRE_ATTR srpc_batch_reply_t; } WIRE_ATTR srpc_batch_reply_t;
typedef struct { typedef struct {
__u64 str_rpyid; /* reply buffer matchbits */ __u64 str_rpyid; /* reply buffer matchbits */
lst_sid_t str_sid; /* session id */ lst_sid_t str_sid; /* session id */
__u32 str_type; /* type of stat */ __u32 str_type; /* type of stat */
} WIRE_ATTR srpc_stat_reqst_t; } WIRE_ATTR srpc_stat_reqst_t;
typedef struct { typedef struct {
__u32 str_status; __u32 str_status;
lst_sid_t str_sid; lst_sid_t str_sid;
sfw_counters_t str_fw; sfw_counters_t str_fw;
srpc_counters_t str_rpc; srpc_counters_t str_rpc;
lnet_counters_t str_lnet; lnet_counters_t str_lnet;
} WIRE_ATTR srpc_stat_reply_t; } WIRE_ATTR srpc_stat_reply_t;
typedef struct { typedef struct {
__u32 blk_opc; /* bulk operation code */ __u32 blk_opc; /* bulk operation code */
__u32 blk_npg; /* # of pages */ __u32 blk_npg; /* # of pages */
__u32 blk_flags; /* reserved flags */ __u32 blk_flags; /* reserved flags */
} WIRE_ATTR test_bulk_req_t; } WIRE_ATTR test_bulk_req_t;
typedef struct { typedef struct {
/** bulk operation code */ __u16 blk_opc; /* bulk operation code */
__u16 blk_opc; __u16 blk_flags; /* data check flags */
/** data check flags */ __u32 blk_len; /* data length */
__u16 blk_flags; __u32 blk_offset; /* reserved: offset */
/** data length */
__u32 blk_len;
/** reserved: offset */
__u32 blk_offset;
} WIRE_ATTR test_bulk_req_v1_t; } WIRE_ATTR test_bulk_req_v1_t;
typedef struct { typedef struct {
__u32 png_size; /* size of ping message */ __u32 png_size; /* size of ping message */
__u32 png_flags; /* reserved flags */ __u32 png_flags; /* reserved flags */
} WIRE_ATTR test_ping_req_t; } WIRE_ATTR test_ping_req_t;
typedef struct { typedef struct {
...@@ -197,8 +194,8 @@ typedef struct { ...@@ -197,8 +194,8 @@ typedef struct {
lst_sid_t tsr_sid; /* session id */ lst_sid_t tsr_sid; /* session id */
lst_bid_t tsr_bid; /* batch id */ lst_bid_t tsr_bid; /* batch id */
__u32 tsr_service; /* test type: bulk|ping|... */ __u32 tsr_service; /* test type: bulk|ping|... */
/* test client loop count or # server buffers needed */ __u32 tsr_loop; /* test client loop count or
__u32 tsr_loop; * # server buffers needed */
__u32 tsr_concur; /* concurrency of test */ __u32 tsr_concur; /* concurrency of test */
__u8 tsr_is_client; /* is test client or not */ __u8 tsr_is_client; /* is test client or not */
__u8 tsr_stop_onerr; /* stop on error */ __u8 tsr_stop_onerr; /* stop on error */
...@@ -234,8 +231,8 @@ typedef struct { ...@@ -234,8 +231,8 @@ typedef struct {
typedef struct { typedef struct {
__u64 brw_rpyid; /* reply buffer matchbits */ __u64 brw_rpyid; /* reply buffer matchbits */
__u64 brw_bulkid; /* bulk buffer matchbits */ __u64 brw_bulkid; /* bulk buffer matchbits */
__u32 brw_rw; /* read or write */ __u32 brw_rw; /* read or write */
__u32 brw_len; /* bulk data len */ __u32 brw_len; /* bulk data len */
__u32 brw_flags; /* bulk data patterns */ __u32 brw_flags; /* bulk data patterns */
} WIRE_ATTR srpc_brw_reqst_t; /* bulk r/w request */ } WIRE_ATTR srpc_brw_reqst_t; /* bulk r/w request */
...@@ -243,20 +240,16 @@ typedef struct { ...@@ -243,20 +240,16 @@ typedef struct {
__u32 brw_status; __u32 brw_status;
} WIRE_ATTR srpc_brw_reply_t; /* bulk r/w reply */ } WIRE_ATTR srpc_brw_reply_t; /* bulk r/w reply */
#define SRPC_MSG_MAGIC 0xeeb0f00d #define SRPC_MSG_MAGIC 0xeeb0f00d
#define SRPC_MSG_VERSION 1 #define SRPC_MSG_VERSION 1
typedef struct srpc_msg { typedef struct srpc_msg {
/** magic number */ __u32 msg_magic; /* magic number */
__u32 msg_magic; __u32 msg_version; /* message version number */
/** message version number */ __u32 msg_type; /* type of message body: srpc_msg_type_t */
__u32 msg_version;
/** type of message body: srpc_msg_type_t */
__u32 msg_type;
__u32 msg_reserved0; __u32 msg_reserved0;
__u32 msg_reserved1; __u32 msg_reserved1;
/** test session features */ __u32 msg_ses_feats; /* test session features */
__u32 msg_ses_feats;
union { union {
srpc_generic_reqst_t reqst; srpc_generic_reqst_t reqst;
srpc_generic_reply_t reply; srpc_generic_reply_t reply;
......
...@@ -57,14 +57,14 @@ ...@@ -57,14 +57,14 @@
#endif #endif
#define SWI_STATE_NEWBORN 0 #define SWI_STATE_NEWBORN 0
#define SWI_STATE_REPLY_SUBMITTED 1 #define SWI_STATE_REPLY_SUBMITTED 1
#define SWI_STATE_REPLY_SENT 2 #define SWI_STATE_REPLY_SENT 2
#define SWI_STATE_REQUEST_SUBMITTED 3 #define SWI_STATE_REQUEST_SUBMITTED 3
#define SWI_STATE_REQUEST_SENT 4 #define SWI_STATE_REQUEST_SENT 4
#define SWI_STATE_REPLY_RECEIVED 5 #define SWI_STATE_REPLY_RECEIVED 5
#define SWI_STATE_BULK_STARTED 6 #define SWI_STATE_BULK_STARTED 6
#define SWI_STATE_DONE 10 #define SWI_STATE_DONE 10
/* forward refs */ /* forward refs */
struct srpc_service; struct srpc_service;
...@@ -75,24 +75,24 @@ struct sfw_test_instance; ...@@ -75,24 +75,24 @@ struct sfw_test_instance;
/* services below SRPC_FRAMEWORK_SERVICE_MAX_ID are framework /* services below SRPC_FRAMEWORK_SERVICE_MAX_ID are framework
* services, e.g. create/modify session. * services, e.g. create/modify session.
*/ */
#define SRPC_SERVICE_DEBUG 0 #define SRPC_SERVICE_DEBUG 0
#define SRPC_SERVICE_MAKE_SESSION 1 #define SRPC_SERVICE_MAKE_SESSION 1
#define SRPC_SERVICE_REMOVE_SESSION 2 #define SRPC_SERVICE_REMOVE_SESSION 2
#define SRPC_SERVICE_BATCH 3 #define SRPC_SERVICE_BATCH 3
#define SRPC_SERVICE_TEST 4 #define SRPC_SERVICE_TEST 4
#define SRPC_SERVICE_QUERY_STAT 5 #define SRPC_SERVICE_QUERY_STAT 5
#define SRPC_SERVICE_JOIN 6 #define SRPC_SERVICE_JOIN 6
#define SRPC_FRAMEWORK_SERVICE_MAX_ID 10 #define SRPC_FRAMEWORK_SERVICE_MAX_ID 10
/* other services start from SRPC_FRAMEWORK_SERVICE_MAX_ID+1 */ /* other services start from SRPC_FRAMEWORK_SERVICE_MAX_ID+1 */
#define SRPC_SERVICE_BRW 11 #define SRPC_SERVICE_BRW 11
#define SRPC_SERVICE_PING 12 #define SRPC_SERVICE_PING 12
#define SRPC_SERVICE_MAX_ID 12 #define SRPC_SERVICE_MAX_ID 12
#define SRPC_REQUEST_PORTAL 50 #define SRPC_REQUEST_PORTAL 50
/* a lazy portal for framework RPC requests */ /* a lazy portal for framework RPC requests */
#define SRPC_FRAMEWORK_REQUEST_PORTAL 51 #define SRPC_FRAMEWORK_REQUEST_PORTAL 51
/* all reply/bulk RDMAs go to this portal */ /* all reply/bulk RDMAs go to this portal */
#define SRPC_RDMA_PORTAL 52 #define SRPC_RDMA_PORTAL 52
static inline srpc_msg_type_t static inline srpc_msg_type_t
srpc_service2request (int service) srpc_service2request (int service)
...@@ -136,7 +136,8 @@ srpc_service2reply (int service) ...@@ -136,7 +136,8 @@ srpc_service2reply (int service)
} }
typedef enum { typedef enum {
SRPC_BULK_REQ_RCVD = 1, /* passive bulk request(PUT sink/GET source) received */ SRPC_BULK_REQ_RCVD = 1, /* passive bulk request(PUT sink/GET source)
* received */
SRPC_BULK_PUT_SENT = 2, /* active bulk PUT sent (source) */ SRPC_BULK_PUT_SENT = 2, /* active bulk PUT sent (source) */
SRPC_BULK_GET_RPLD = 3, /* active bulk GET replied (sink) */ SRPC_BULK_GET_RPLD = 3, /* active bulk GET replied (sink) */
SRPC_REPLY_RCVD = 4, /* incoming reply received */ SRPC_REPLY_RCVD = 4, /* incoming reply received */
...@@ -149,114 +150,114 @@ typedef enum { ...@@ -149,114 +150,114 @@ typedef enum {
typedef struct { typedef struct {
srpc_event_type_t ev_type; /* what's up */ srpc_event_type_t ev_type; /* what's up */
lnet_event_kind_t ev_lnet; /* LNet event type */ lnet_event_kind_t ev_lnet; /* LNet event type */
int ev_fired; /* LNet event fired? */ int ev_fired; /* LNet event fired? */
int ev_status; /* LNet event status */ int ev_status; /* LNet event status */
void *ev_data; /* owning server/client RPC */ void *ev_data; /* owning server/client RPC */
} srpc_event_t; } srpc_event_t;
typedef struct { typedef struct {
int bk_len; /* len of bulk data */ int bk_len; /* len of bulk data */
lnet_handle_md_t bk_mdh; lnet_handle_md_t bk_mdh;
int bk_sink; /* sink/source */ int bk_sink; /* sink/source */
int bk_niov; /* # iov in bk_iovs */ int bk_niov; /* # iov in bk_iovs */
lnet_kiov_t bk_iovs[0]; lnet_kiov_t bk_iovs[0];
} srpc_bulk_t; /* bulk descriptor */ } srpc_bulk_t; /* bulk descriptor */
/* message buffer descriptor */ /* message buffer descriptor */
typedef struct srpc_buffer { typedef struct srpc_buffer {
struct list_head buf_list; /* chain on srpc_service::*_msgq */ struct list_head buf_list; /* chain on srpc_service::*_msgq */
srpc_msg_t buf_msg; srpc_msg_t buf_msg;
lnet_handle_md_t buf_mdh; lnet_handle_md_t buf_mdh;
lnet_nid_t buf_self; lnet_nid_t buf_self;
lnet_process_id_t buf_peer; lnet_process_id_t buf_peer;
} srpc_buffer_t; } srpc_buffer_t;
struct swi_workitem; struct swi_workitem;
typedef int (*swi_action_t) (struct swi_workitem *); typedef int (*swi_action_t) (struct swi_workitem *);
typedef struct swi_workitem { typedef struct swi_workitem {
struct cfs_wi_sched *swi_sched; struct cfs_wi_sched *swi_sched;
cfs_workitem_t swi_workitem; cfs_workitem_t swi_workitem;
swi_action_t swi_action; swi_action_t swi_action;
int swi_state; int swi_state;
} swi_workitem_t; } swi_workitem_t;
/* server-side state of a RPC */ /* server-side state of a RPC */
typedef struct srpc_server_rpc { typedef struct srpc_server_rpc {
/* chain on srpc_service::*_rpcq */ /* chain on srpc_service::*_rpcq */
struct list_head srpc_list; struct list_head srpc_list;
struct srpc_service_cd *srpc_scd; struct srpc_service_cd *srpc_scd;
swi_workitem_t srpc_wi; swi_workitem_t srpc_wi;
srpc_event_t srpc_ev; /* bulk/reply event */ srpc_event_t srpc_ev; /* bulk/reply event */
lnet_nid_t srpc_self; lnet_nid_t srpc_self;
lnet_process_id_t srpc_peer; lnet_process_id_t srpc_peer;
srpc_msg_t srpc_replymsg; srpc_msg_t srpc_replymsg;
lnet_handle_md_t srpc_replymdh; lnet_handle_md_t srpc_replymdh;
srpc_buffer_t *srpc_reqstbuf; srpc_buffer_t *srpc_reqstbuf;
srpc_bulk_t *srpc_bulk; srpc_bulk_t *srpc_bulk;
unsigned int srpc_aborted; /* being given up */ unsigned int srpc_aborted; /* being given up */
int srpc_status; int srpc_status;
void (*srpc_done)(struct srpc_server_rpc *); void (*srpc_done)(struct srpc_server_rpc *);
} srpc_server_rpc_t; } srpc_server_rpc_t;
/* client-side state of a RPC */ /* client-side state of a RPC */
typedef struct srpc_client_rpc { typedef struct srpc_client_rpc {
struct list_head crpc_list; /* chain on user's lists */ struct list_head crpc_list; /* chain on user's lists */
spinlock_t crpc_lock; /* serialize */ spinlock_t crpc_lock; /* serialize */
int crpc_service; int crpc_service;
atomic_t crpc_refcount; atomic_t crpc_refcount;
int crpc_timeout; /* # seconds to wait for reply */ int crpc_timeout; /* # seconds to wait for reply */
stt_timer_t crpc_timer; stt_timer_t crpc_timer;
swi_workitem_t crpc_wi; swi_workitem_t crpc_wi;
lnet_process_id_t crpc_dest; lnet_process_id_t crpc_dest;
void (*crpc_done)(struct srpc_client_rpc *); void (*crpc_done)(struct srpc_client_rpc *);
void (*crpc_fini)(struct srpc_client_rpc *); void (*crpc_fini)(struct srpc_client_rpc *);
int crpc_status; /* completion status */ int crpc_status; /* completion status */
void *crpc_priv; /* caller data */ void *crpc_priv; /* caller data */
/* state flags */ /* state flags */
unsigned int crpc_aborted:1; /* being given up */ unsigned int crpc_aborted:1; /* being given up */
unsigned int crpc_closed:1; /* completed */ unsigned int crpc_closed:1; /* completed */
/* RPC events */ /* RPC events */
srpc_event_t crpc_bulkev; /* bulk event */ srpc_event_t crpc_bulkev; /* bulk event */
srpc_event_t crpc_reqstev; /* request event */ srpc_event_t crpc_reqstev; /* request event */
srpc_event_t crpc_replyev; /* reply event */ srpc_event_t crpc_replyev; /* reply event */
/* bulk, request(reqst), and reply exchanged on wire */ /* bulk, request(reqst), and reply exchanged on wire */
srpc_msg_t crpc_reqstmsg; srpc_msg_t crpc_reqstmsg;
srpc_msg_t crpc_replymsg; srpc_msg_t crpc_replymsg;
lnet_handle_md_t crpc_reqstmdh; lnet_handle_md_t crpc_reqstmdh;
lnet_handle_md_t crpc_replymdh; lnet_handle_md_t crpc_replymdh;
srpc_bulk_t crpc_bulk; srpc_bulk_t crpc_bulk;
} srpc_client_rpc_t; } srpc_client_rpc_t;
#define srpc_client_rpc_size(rpc) \ #define srpc_client_rpc_size(rpc) \
offsetof(srpc_client_rpc_t, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov]) offsetof(srpc_client_rpc_t, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov])
#define srpc_client_rpc_addref(rpc) \ #define srpc_client_rpc_addref(rpc) \
do { \ do { \
CDEBUG(D_NET, "RPC[%p] -> %s (%d)++\n", \ CDEBUG(D_NET, "RPC[%p] -> %s (%d)++\n", \
(rpc), libcfs_id2str((rpc)->crpc_dest), \ (rpc), libcfs_id2str((rpc)->crpc_dest), \
atomic_read(&(rpc)->crpc_refcount)); \ atomic_read(&(rpc)->crpc_refcount)); \
LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \ LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \
atomic_inc(&(rpc)->crpc_refcount); \ atomic_inc(&(rpc)->crpc_refcount); \
} while (0) } while (0)
#define srpc_client_rpc_decref(rpc) \ #define srpc_client_rpc_decref(rpc) \
do { \ do { \
CDEBUG(D_NET, "RPC[%p] -> %s (%d)--\n", \ CDEBUG(D_NET, "RPC[%p] -> %s (%d)--\n", \
(rpc), libcfs_id2str((rpc)->crpc_dest), \ (rpc), libcfs_id2str((rpc)->crpc_dest), \
atomic_read(&(rpc)->crpc_refcount)); \ atomic_read(&(rpc)->crpc_refcount)); \
LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \ LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \
if (atomic_dec_and_test(&(rpc)->crpc_refcount)) \ if (atomic_dec_and_test(&(rpc)->crpc_refcount)) \
srpc_destroy_client_rpc(rpc); \ srpc_destroy_client_rpc(rpc); \
} while (0) } while (0)
#define srpc_event_pending(rpc) ((rpc)->crpc_bulkev.ev_fired == 0 || \ #define srpc_event_pending(rpc) ((rpc)->crpc_bulkev.ev_fired == 0 || \
(rpc)->crpc_reqstev.ev_fired == 0 || \ (rpc)->crpc_reqstev.ev_fired == 0 || \
(rpc)->crpc_replyev.ev_fired == 0) (rpc)->crpc_replyev.ev_fired == 0)
/* CPU partition data of srpc service */ /* CPU partition data of srpc service */
...@@ -268,9 +269,9 @@ struct srpc_service_cd { ...@@ -268,9 +269,9 @@ struct srpc_service_cd {
/** event buffer */ /** event buffer */
srpc_event_t scd_ev; srpc_event_t scd_ev;
/** free RPC descriptors */ /** free RPC descriptors */
struct list_head scd_rpc_free; struct list_head scd_rpc_free;
/** in-flight RPCs */ /** in-flight RPCs */
struct list_head scd_rpc_active; struct list_head scd_rpc_active;
/** workitem for posting buffer */ /** workitem for posting buffer */
swi_workitem_t scd_buf_wi; swi_workitem_t scd_buf_wi;
/** CPT id */ /** CPT id */
...@@ -278,7 +279,7 @@ struct srpc_service_cd { ...@@ -278,7 +279,7 @@ struct srpc_service_cd {
/** error code for scd_buf_wi */ /** error code for scd_buf_wi */
int scd_buf_err; int scd_buf_err;
/** timestamp for scd_buf_err */ /** timestamp for scd_buf_err */
unsigned long scd_buf_err_stamp; unsigned long scd_buf_err_stamp;
/** total # request buffers */ /** total # request buffers */
int scd_buf_total; int scd_buf_total;
/** # posted request buffers */ /** # posted request buffers */
...@@ -290,9 +291,9 @@ struct srpc_service_cd { ...@@ -290,9 +291,9 @@ struct srpc_service_cd {
/** increase/decrease some buffers */ /** increase/decrease some buffers */
int scd_buf_adjust; int scd_buf_adjust;
/** posted message buffers */ /** posted message buffers */
struct list_head scd_buf_posted; struct list_head scd_buf_posted;
/** blocked for RPC descriptor */ /** blocked for RPC descriptor */
struct list_head scd_buf_blocked; struct list_head scd_buf_blocked;
}; };
/* number of server workitems (mini-thread) for testing service */ /* number of server workitems (mini-thread) for testing service */
...@@ -318,40 +319,42 @@ typedef struct srpc_service { ...@@ -318,40 +319,42 @@ typedef struct srpc_service {
* - sv_handler: process incoming RPC request * - sv_handler: process incoming RPC request
* - sv_bulk_ready: notify bulk data * - sv_bulk_ready: notify bulk data
*/ */
int (*sv_handler) (srpc_server_rpc_t *); int (*sv_handler) (srpc_server_rpc_t *);
int (*sv_bulk_ready) (srpc_server_rpc_t *, int); int (*sv_bulk_ready) (srpc_server_rpc_t *, int);
} srpc_service_t; } srpc_service_t;
typedef struct { typedef struct {
struct list_head sn_list; /* chain on fw_zombie_sessions */ struct list_head sn_list; /* chain on fw_zombie_sessions */
lst_sid_t sn_id; /* unique identifier */ lst_sid_t sn_id; /* unique identifier */
unsigned int sn_timeout; /* # seconds' inactivity to expire */ unsigned int sn_timeout; /* # seconds' inactivity to expire */
int sn_timer_active; int sn_timer_active;
unsigned int sn_features; unsigned int sn_features;
stt_timer_t sn_timer; stt_timer_t sn_timer;
struct list_head sn_batches; /* list of batches */ struct list_head sn_batches; /* list of batches */
char sn_name[LST_NAME_SIZE]; char sn_name[LST_NAME_SIZE];
atomic_t sn_refcount; atomic_t sn_refcount;
atomic_t sn_brw_errors; atomic_t sn_brw_errors;
atomic_t sn_ping_errors; atomic_t sn_ping_errors;
unsigned long sn_started; unsigned long sn_started;
} sfw_session_t; } sfw_session_t;
#define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \ #define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \
(sid0).ses_stamp == (sid1).ses_stamp) (sid0).ses_stamp == (sid1).ses_stamp)
typedef struct { typedef struct {
struct list_head bat_list; /* chain on sn_batches */ struct list_head bat_list; /* chain on sn_batches */
lst_bid_t bat_id; /* batch id */ lst_bid_t bat_id; /* batch id */
int bat_error; /* error code of batch */ int bat_error; /* error code of batch */
sfw_session_t *bat_session; /* batch's session */ sfw_session_t *bat_session; /* batch's session */
atomic_t bat_nactive; /* # of active tests */ atomic_t bat_nactive; /* # of active tests */
struct list_head bat_tests; /* test instances */ struct list_head bat_tests; /* test instances */
} sfw_batch_t; } sfw_batch_t;
typedef struct { typedef struct {
int (*tso_init)(struct sfw_test_instance *tsi); /* initialize test client */ int (*tso_init)(struct sfw_test_instance *tsi); /* initialize test
void (*tso_fini)(struct sfw_test_instance *tsi); /* finalize test client */ * client */
void (*tso_fini)(struct sfw_test_instance *tsi); /* finalize test
* client */
int (*tso_prep_rpc)(struct sfw_test_unit *tsu, int (*tso_prep_rpc)(struct sfw_test_unit *tsu,
lnet_process_id_t dest, lnet_process_id_t dest,
srpc_client_rpc_t **rpc); /* prep a tests rpc */ srpc_client_rpc_t **rpc); /* prep a tests rpc */
...@@ -360,29 +363,31 @@ typedef struct { ...@@ -360,29 +363,31 @@ typedef struct {
} sfw_test_client_ops_t; } sfw_test_client_ops_t;
typedef struct sfw_test_instance { typedef struct sfw_test_instance {
struct list_head tsi_list; /* chain on batch */ struct list_head tsi_list; /* chain on batch */
int tsi_service; /* test type */ int tsi_service; /* test type */
sfw_batch_t *tsi_batch; /* batch */ sfw_batch_t *tsi_batch; /* batch */
sfw_test_client_ops_t *tsi_ops; /* test client operations */ sfw_test_client_ops_t *tsi_ops; /* test client operation
*/
/* public parameter for all test units */ /* public parameter for all test units */
unsigned int tsi_is_client:1; /* is test client */ unsigned int tsi_is_client:1; /* is test client */
unsigned int tsi_stoptsu_onerr:1; /* stop tsu on error */ unsigned int tsi_stoptsu_onerr:1; /* stop tsu on error */
int tsi_concur; /* concurrency */ int tsi_concur; /* concurrency */
int tsi_loop; /* loop count */ int tsi_loop; /* loop count */
/* status of test instance */ /* status of test instance */
spinlock_t tsi_lock; /* serialize */ spinlock_t tsi_lock; /* serialize */
unsigned int tsi_stopping:1; /* test is stopping */ unsigned int tsi_stopping:1; /* test is stopping */
atomic_t tsi_nactive; /* # of active test unit */ atomic_t tsi_nactive; /* # of active test
struct list_head tsi_units; /* test units */ * unit */
struct list_head tsi_free_rpcs; /* free rpcs */ struct list_head tsi_units; /* test units */
struct list_head tsi_active_rpcs; /* active rpcs */ struct list_head tsi_free_rpcs; /* free rpcs */
struct list_head tsi_active_rpcs; /* active rpcs */
union { union {
test_ping_req_t ping; /* ping parameter */ test_ping_req_t ping; /* ping parameter */
test_bulk_req_t bulk_v0; /* bulk parameter */ test_bulk_req_t bulk_v0; /* bulk parameter */
test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */ test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */
} tsi_u; } tsi_u;
} sfw_test_instance_t; } sfw_test_instance_t;
...@@ -394,18 +399,18 @@ typedef struct sfw_test_instance { ...@@ -394,18 +399,18 @@ typedef struct sfw_test_instance {
#define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE) #define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE)
typedef struct sfw_test_unit { typedef struct sfw_test_unit {
struct list_head tsu_list; /* chain on lst_test_instance */ struct list_head tsu_list; /* chain on lst_test_instance */
lnet_process_id_t tsu_dest; /* id of dest node */ lnet_process_id_t tsu_dest; /* id of dest node */
int tsu_loop; /* loop count of the test */ int tsu_loop; /* loop count of the test */
sfw_test_instance_t *tsu_instance; /* pointer to test instance */ sfw_test_instance_t *tsu_instance; /* pointer to test instance */
void *tsu_private; /* private data */ void *tsu_private; /* private data */
swi_workitem_t tsu_worker; /* workitem of the test unit */ swi_workitem_t tsu_worker; /* workitem of the test unit */
} sfw_test_unit_t; } sfw_test_unit_t;
typedef struct sfw_test_case { typedef struct sfw_test_case {
struct list_head tsc_list; /* chain on fw_tests */ struct list_head tsc_list; /* chain on fw_tests */
srpc_service_t *tsc_srv_service; /* test service */ srpc_service_t *tsc_srv_service; /* test service */
sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */ sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */
} sfw_test_case_t; } sfw_test_case_t;
srpc_client_rpc_t * srpc_client_rpc_t *
...@@ -501,9 +506,9 @@ void srpc_shutdown(void); ...@@ -501,9 +506,9 @@ void srpc_shutdown(void);
static inline void static inline void
srpc_destroy_client_rpc (srpc_client_rpc_t *rpc) srpc_destroy_client_rpc (srpc_client_rpc_t *rpc)
{ {
LASSERT (rpc != NULL); LASSERT(rpc != NULL);
LASSERT (!srpc_event_pending(rpc)); LASSERT(!srpc_event_pending(rpc));
LASSERT (atomic_read(&rpc->crpc_refcount) == 0); LASSERT(atomic_read(&rpc->crpc_refcount) == 0);
if (rpc->crpc_fini == NULL) { if (rpc->crpc_fini == NULL) {
LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc)); LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc));
...@@ -520,7 +525,7 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer, ...@@ -520,7 +525,7 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer,
void (*rpc_done)(srpc_client_rpc_t *), void (*rpc_done)(srpc_client_rpc_t *),
void (*rpc_fini)(srpc_client_rpc_t *), void *priv) void (*rpc_fini)(srpc_client_rpc_t *), void *priv)
{ {
LASSERT (nbulkiov <= LNET_MAX_IOV); LASSERT(nbulkiov <= LNET_MAX_IOV);
memset(rpc, 0, offsetof(srpc_client_rpc_t, memset(rpc, 0, offsetof(srpc_client_rpc_t,
crpc_bulk.bk_iovs[nbulkiov])); crpc_bulk.bk_iovs[nbulkiov]));
...@@ -531,13 +536,13 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer, ...@@ -531,13 +536,13 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer,
spin_lock_init(&rpc->crpc_lock); spin_lock_init(&rpc->crpc_lock);
atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */ atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */
rpc->crpc_dest = peer; rpc->crpc_dest = peer;
rpc->crpc_priv = priv; rpc->crpc_priv = priv;
rpc->crpc_service = service; rpc->crpc_service = service;
rpc->crpc_bulk.bk_len = bulklen; rpc->crpc_bulk.bk_len = bulklen;
rpc->crpc_bulk.bk_niov = nbulkiov; rpc->crpc_bulk.bk_niov = nbulkiov;
rpc->crpc_done = rpc_done; rpc->crpc_done = rpc_done;
rpc->crpc_fini = rpc_fini; rpc->crpc_fini = rpc_fini;
LNetInvalidateHandle(&rpc->crpc_reqstmdh); LNetInvalidateHandle(&rpc->crpc_reqstmdh);
LNetInvalidateHandle(&rpc->crpc_replymdh); LNetInvalidateHandle(&rpc->crpc_replymdh);
LNetInvalidateHandle(&rpc->crpc_bulk.bk_mdh); LNetInvalidateHandle(&rpc->crpc_bulk.bk_mdh);
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* sorted by increasing expiry time. The number of slots is 2**7 (128), * sorted by increasing expiry time. The number of slots is 2**7 (128),
* to cover a time period of 1024 seconds into the future before wrapping. * to cover a time period of 1024 seconds into the future before wrapping.
*/ */
#define STTIMER_MINPOLL 3 /* log2 min poll interval (8 s) */ #define STTIMER_MINPOLL 3 /* log2 min poll interval (8 s) */
#define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL) #define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL)
#define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1)) #define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1))
#define STTIMER_NSLOTS (1 << 7) #define STTIMER_NSLOTS (1 << 7)
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
(STTIMER_NSLOTS - 1))]) (STTIMER_NSLOTS - 1))])
static struct st_timer_data { static struct st_timer_data {
spinlock_t stt_lock; spinlock_t stt_lock;
/* start time of the slot processed previously */ unsigned long stt_prev_slot; /* start time of the slot processed
unsigned long stt_prev_slot; * previously */
struct list_head stt_hash[STTIMER_NSLOTS]; struct list_head stt_hash[STTIMER_NSLOTS];
int stt_shuttingdown; int stt_shuttingdown;
wait_queue_head_t stt_waitq; wait_queue_head_t stt_waitq;
int stt_nthreads; int stt_nthreads;
} stt_data; } stt_data;
void void
...@@ -124,7 +124,7 @@ stt_del_timer(stt_timer_t *timer) ...@@ -124,7 +124,7 @@ stt_del_timer(stt_timer_t *timer)
static int static int
stt_expire_list(struct list_head *slot, unsigned long now) stt_expire_list(struct list_head *slot, unsigned long now)
{ {
int expired = 0; int expired = 0;
stt_timer_t *timer; stt_timer_t *timer;
while (!list_empty(slot)) { while (!list_empty(slot)) {
...@@ -148,7 +148,7 @@ stt_expire_list(struct list_head *slot, unsigned long now) ...@@ -148,7 +148,7 @@ stt_expire_list(struct list_head *slot, unsigned long now)
static int static int
stt_check_timers(unsigned long *last) stt_check_timers(unsigned long *last)
{ {
int expired = 0; int expired = 0;
unsigned long now; unsigned long now;
unsigned long this_slot; unsigned long this_slot;
......
...@@ -39,15 +39,15 @@ ...@@ -39,15 +39,15 @@
#define __SELFTEST_TIMER_H__ #define __SELFTEST_TIMER_H__
typedef struct { typedef struct {
struct list_head stt_list; struct list_head stt_list;
unsigned long stt_expires; unsigned long stt_expires;
void (*stt_func) (void *); void (*stt_func) (void *);
void *stt_data; void *stt_data;
} stt_timer_t; } stt_timer_t;
void stt_add_timer (stt_timer_t *timer); void stt_add_timer(stt_timer_t *timer);
int stt_del_timer (stt_timer_t *timer); int stt_del_timer(stt_timer_t *timer);
int stt_startup (void); int stt_startup(void);
void stt_shutdown (void); void stt_shutdown(void);
#endif /* __SELFTEST_TIMER_H__ */ #endif /* __SELFTEST_TIMER_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment