/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
/* client-side state of a RPC */
typedef struct srpc_client_rpc {
- cfs_list_t crpc_list; /* chain on user's lists */
- cfs_spinlock_t crpc_lock; /* serialize */
+ cfs_list_t crpc_list; /* chain on user's lists */
+ spinlock_t crpc_lock; /* serialize */
int crpc_service;
cfs_atomic_t crpc_refcount;
int crpc_timeout; /* # seconds to wait for reply */
/* CPU partition data of srpc service */
struct srpc_service_cd {
/** serialize */
- cfs_spinlock_t scd_lock;
+ spinlock_t scd_lock;
/** backref to service */
struct srpc_service *scd_svc;
/** event buffer */
lst_sid_t sn_id; /* unique identifier */
unsigned int sn_timeout; /* # seconds' inactivity to expire */
int sn_timer_active;
+ unsigned int sn_features;
stt_timer_t sn_timer;
cfs_list_t sn_batches; /* list of batches */
char sn_name[LST_NAME_SIZE];
sfw_batch_t *tsi_batch; /* batch */
sfw_test_client_ops_t *tsi_ops; /* test client operations */
- /* public parameter for all test units */
- int tsi_is_client:1; /* is test client */
- int tsi_stoptsu_onerr:1; /* stop tsu on error */
+ /* public parameter for all test units */
+ unsigned int tsi_is_client:1; /* is test client */
+ unsigned int tsi_stoptsu_onerr:1; /* stop tsu on error */
int tsi_concur; /* concurrency */
int tsi_loop; /* loop count */
- /* status of test instance */
- cfs_spinlock_t tsi_lock; /* serialize */
- int tsi_stopping:1; /* test is stopping */
+ /* status of test instance */
+ spinlock_t tsi_lock; /* serialize */
+ unsigned int tsi_stopping:1; /* test is stopping */
cfs_atomic_t tsi_nactive; /* # of active test unit */
cfs_list_t tsi_units; /* test units */
cfs_list_t tsi_free_rpcs; /* free rpcs */
cfs_list_t tsi_active_rpcs; /* active rpcs */
- union {
- test_bulk_req_t bulk; /* bulk parameter */
- test_ping_req_t ping; /* ping parameter */
- } tsi_u;
+ union {
+ test_ping_req_t ping; /* ping parameter */
+ test_bulk_req_t bulk_v0; /* bulk parameter */
+ test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */
+ } tsi_u;
} sfw_test_instance_t;
/* XXX: trailing (CFS_PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at
} sfw_test_case_t;
srpc_client_rpc_t *
-sfw_create_rpc(lnet_process_id_t peer, int service, int nbulkiov, int bulklen,
- void (*done) (srpc_client_rpc_t *), void *priv);
-int sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer,
- int nblk, int blklen, srpc_client_rpc_t **rpc);
+sfw_create_rpc(lnet_process_id_t peer, int service,
+ unsigned features, int nbulkiov, int bulklen,
+ void (*done) (srpc_client_rpc_t *), void *priv);
+int sfw_create_test_rpc(sfw_test_unit_t *tsu,
+ lnet_process_id_t peer, unsigned features,
+ int nblk, int blklen, srpc_client_rpc_t **rpc);
void sfw_abort_rpc(srpc_client_rpc_t *rpc);
void sfw_post_rpc(srpc_client_rpc_t *rpc);
void sfw_client_rpc_done(srpc_client_rpc_t *rpc);
void sfw_unpack_message(srpc_msg_t *msg);
void sfw_free_pages(srpc_server_rpc_t *rpc);
void sfw_add_bulk_page(srpc_bulk_t *bk, cfs_page_t *pg, int i);
-int sfw_alloc_pages(srpc_server_rpc_t *rpc, int cpt, int npages, int sink);
+int sfw_alloc_pages(srpc_server_rpc_t *rpc, int cpt, int npages, int len,
+ int sink);
int sfw_make_session (srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply);
srpc_client_rpc_t *
void srpc_post_rpc(srpc_client_rpc_t *rpc);
void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why);
void srpc_free_bulk(srpc_bulk_t *bk);
-srpc_bulk_t *srpc_alloc_bulk(int cpt, int npages, int sink);
+srpc_bulk_t *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len,
+ int sink);
int srpc_send_rpc(swi_workitem_t *wi);
int srpc_send_reply(srpc_server_rpc_t *rpc);
int srpc_add_service(srpc_service_t *sv);
CFS_INIT_LIST_HEAD(&rpc->crpc_list);
swi_init_workitem(&rpc->crpc_wi, rpc, srpc_send_rpc,
lst_sched_test[lnet_cpt_of_nid(peer.nid)]);
- cfs_spin_lock_init(&rpc->crpc_lock);
+ spin_lock_init(&rpc->crpc_lock);
cfs_atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */
rpc->crpc_dest = peer;
#endif
-#define lst_wait_until(cond, lock, fmt, ...) \
-do { \
- int __I = 2; \
- while (!(cond)) { \
- CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \
- fmt, ## __VA_ARGS__); \
- cfs_spin_unlock(&(lock)); \
- \
- selftest_wait_events(); \
- \
- cfs_spin_lock(&(lock)); \
- } \
+#define lst_wait_until(cond, lock, fmt, ...) \
+do { \
+ int __I = 2; \
+ while (!(cond)) { \
+ CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \
+ fmt, ## __VA_ARGS__); \
+ spin_unlock(&(lock)); \
+ \
+ selftest_wait_events(); \
+ \
+ spin_lock(&(lock)); \
+ } \
} while (0)
static inline void