Whamcloud - gitweb
LU-6142 lnet: remove most of typedefs from LNet headers
[fs/lustre-release.git] / lnet / selftest / selftest.h
index 9379cbd..44bb2f8 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- * copy of GPLv2].
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -28,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -43,7 +38,6 @@
 
 #define LNET_ONLY
 
-#include <linux/ktime.h>
 #include <libcfs/libcfs.h>
 #include <lnet/api.h>
 #include <lnet/lib-lnet.h>
@@ -149,7 +143,7 @@ typedef enum {
 /* RPC event */
 typedef struct {
         srpc_event_type_t ev_type;   /* what's up */
-        lnet_event_kind_t ev_lnet;   /* LNet event type */
+       enum lnet_event_kind ev_lnet;   /* LNet event type */
         int               ev_fired;  /* LNet event fired? */
         int               ev_status; /* LNet event status */
         void             *ev_data;   /* owning server/client RPC */
@@ -157,7 +151,7 @@ typedef struct {
 
 typedef struct {
         int              bk_len;  /* len of bulk data */
-        lnet_handle_md_t bk_mdh;
+       struct lnet_handle_md bk_mdh;
         int              bk_sink; /* sink/source */
         int              bk_niov; /* # iov in bk_iovs */
         lnet_kiov_t      bk_iovs[0];
@@ -167,9 +161,9 @@ typedef struct {
 typedef struct srpc_buffer {
        struct list_head        buf_list; /* chain on srpc_service::*_msgq */
        srpc_msg_t              buf_msg;
-       lnet_handle_md_t        buf_mdh;
+       struct lnet_handle_md   buf_mdh;
        lnet_nid_t              buf_self;
-       lnet_process_id_t       buf_peer;
+       struct lnet_process_id  buf_peer;
 } srpc_buffer_t;
 
 struct swi_workitem;
@@ -190,9 +184,9 @@ typedef struct srpc_server_rpc {
        swi_workitem_t          srpc_wi;
        srpc_event_t            srpc_ev;        /* bulk/reply event */
        lnet_nid_t              srpc_self;
-       lnet_process_id_t       srpc_peer;
+       struct lnet_process_id  srpc_peer;
        srpc_msg_t              srpc_replymsg;
-       lnet_handle_md_t        srpc_replymdh;
+       struct lnet_handle_md   srpc_replymdh;
        srpc_buffer_t           *srpc_reqstbuf;
        srpc_bulk_t             *srpc_bulk;
 
@@ -211,7 +205,7 @@ typedef struct srpc_client_rpc {
        int                     crpc_timeout;
        stt_timer_t             crpc_timer;
        swi_workitem_t          crpc_wi;
-       lnet_process_id_t       crpc_dest;
+       struct lnet_process_id  crpc_dest;
 
         void               (*crpc_done)(struct srpc_client_rpc *);
         void               (*crpc_fini)(struct srpc_client_rpc *);
@@ -230,8 +224,8 @@ typedef struct srpc_client_rpc {
         /* bulk, request(reqst), and reply exchanged on wire */
         srpc_msg_t           crpc_reqstmsg;
         srpc_msg_t           crpc_replymsg;
-        lnet_handle_md_t     crpc_reqstmdh;
-        lnet_handle_md_t     crpc_replymdh;
+       struct lnet_handle_md   crpc_reqstmdh;
+       struct lnet_handle_md   crpc_replymdh;
         srpc_bulk_t          crpc_bulk;
 } srpc_client_rpc_t;
 
@@ -280,7 +274,7 @@ struct srpc_service_cd {
        /** error code for scd_buf_wi */
        int                     scd_buf_err;
        /** timestamp for scd_buf_err */
-       unsigned long           scd_buf_err_stamp;
+       time64_t                scd_buf_err_stamp;
        /** total # request buffers */
        int                     scd_buf_total;
        /** # posted request buffers */
@@ -327,7 +321,7 @@ typedef struct srpc_service {
 typedef struct {
        /* chain on fw_zombie_sessions */
        struct list_head        sn_list;
-       lst_sid_t               sn_id;          /* unique identifier */
+       struct lst_sid          sn_id;          /* unique identifier */
        /* # seconds' inactivity to expire */
        unsigned int            sn_timeout;
        int                     sn_timer_active;
@@ -346,7 +340,7 @@ typedef struct {
 
 typedef struct {
        struct list_head        bat_list;       /* chain on sn_batches */
-       lst_bid_t               bat_id;         /* batch id */
+       struct lst_bid          bat_id;         /* batch id */
        int                     bat_error;      /* error code of batch */
        sfw_session_t           *bat_session;   /* batch's session */
        atomic_t                bat_nactive;    /* # of active tests */
@@ -357,7 +351,7 @@ typedef struct {
         int  (*tso_init)(struct sfw_test_instance *tsi); /* intialize test client */
         void (*tso_fini)(struct sfw_test_instance *tsi); /* finalize test client */
         int  (*tso_prep_rpc)(struct sfw_test_unit *tsu,
-                             lnet_process_id_t dest,
+                            struct lnet_process_id dest,
                              srpc_client_rpc_t **rpc);   /* prep a tests rpc */
         void (*tso_done_rpc)(struct sfw_test_unit *tsu,
                              srpc_client_rpc_t *rpc);    /* done a test rpc */
@@ -390,16 +384,16 @@ typedef struct sfw_test_instance {
        } tsi_u;
 } sfw_test_instance_t;
 
-/* XXX: trailing (PAGE_CACHE_SIZE % sizeof(lnet_process_id_t)) bytes at
+/* XXX: trailing (PAGE_SIZE % sizeof(struct lnet_process_id)) bytes at
  * the end of pages are not used */
 #define SFW_MAX_CONCUR     LST_MAX_CONCUR
-#define SFW_ID_PER_PAGE    (PAGE_CACHE_SIZE / sizeof(lnet_process_id_packed_t))
+#define SFW_ID_PER_PAGE    (PAGE_SIZE / sizeof(struct lnet_process_id_packed))
 #define SFW_MAX_NDESTS     (LNET_MAX_IOV * SFW_ID_PER_PAGE)
 #define sfw_id_pages(n)    (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE)
 
 typedef struct sfw_test_unit {
        struct list_head        tsu_list;       /* chain on lst_test_instance */
-       lnet_process_id_t       tsu_dest;       /* id of dest node */
+       struct lnet_process_id  tsu_dest;       /* id of dest node */
        int                     tsu_loop;       /* loop count of the test */
        sfw_test_instance_t     *tsu_instance;  /* pointer to test instance */
        void                    *tsu_private;   /* private data */
@@ -413,11 +407,11 @@ typedef struct sfw_test_case {
 } sfw_test_case_t;
 
 srpc_client_rpc_t *
-sfw_create_rpc(lnet_process_id_t peer, int service,
+sfw_create_rpc(struct lnet_process_id 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,
+                       struct lnet_process_id peer, unsigned int 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);
@@ -430,15 +424,15 @@ int sfw_alloc_pages(srpc_server_rpc_t *rpc, int cpt, int npages, int len,
 int sfw_make_session (srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply);
 
 srpc_client_rpc_t *
-srpc_create_client_rpc(lnet_process_id_t peer, int service,
+srpc_create_client_rpc(struct lnet_process_id peer, int service,
                        int nbulkiov, int bulklen,
                        void (*rpc_done)(srpc_client_rpc_t *),
                        void (*rpc_fini)(srpc_client_rpc_t *), void *priv);
 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, unsigned bulk_npg, unsigned bulk_len,
-                            int sink);
+srpc_bulk_t *srpc_alloc_bulk(int cpt, unsigned off, 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);
@@ -448,8 +442,8 @@ void srpc_abort_service(srpc_service_t *sv);
 int srpc_finish_service(srpc_service_t *sv);
 int srpc_service_add_buffers(srpc_service_t *sv, int nbuffer);
 void srpc_service_remove_buffers(srpc_service_t *sv, int nbuffer);
-void srpc_get_counters(srpc_counters_t *cnt);
-void srpc_set_counters(const srpc_counters_t *cnt);
+void srpc_get_counters(struct srpc_counters *cnt);
+void srpc_set_counters(const struct srpc_counters *cnt);
 
 extern struct cfs_wi_sched *lst_sched_serial;
 extern struct cfs_wi_sched **lst_sched_test;
@@ -518,7 +512,7 @@ srpc_destroy_client_rpc (srpc_client_rpc_t *rpc)
 }
 
 static inline void
-srpc_init_client_rpc(srpc_client_rpc_t *rpc, lnet_process_id_t peer,
+srpc_init_client_rpc(srpc_client_rpc_t *rpc, struct lnet_process_id peer,
                     int service, int nbulkiov, int bulklen,
                     void (*rpc_done)(srpc_client_rpc_t *),
                     void (*rpc_fini)(srpc_client_rpc_t *), void *priv)
@@ -530,7 +524,7 @@ srpc_init_client_rpc(srpc_client_rpc_t *rpc, lnet_process_id_t peer,
 
        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)]);
+                         lst_sched_test[lnet_cpt_of_nid(peer.nid, NULL)]);
        spin_lock_init(&rpc->crpc_lock);
        atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */
 
@@ -541,9 +535,9 @@ srpc_init_client_rpc(srpc_client_rpc_t *rpc, lnet_process_id_t peer,
         rpc->crpc_bulk.bk_niov = nbulkiov;
         rpc->crpc_done         = rpc_done;
         rpc->crpc_fini         = rpc_fini;
-        LNetInvalidateHandle(&rpc->crpc_reqstmdh);
-        LNetInvalidateHandle(&rpc->crpc_replymdh);
-        LNetInvalidateHandle(&rpc->crpc_bulk.bk_mdh);
+       LNetInvalidateMDHandle(&rpc->crpc_reqstmdh);
+       LNetInvalidateMDHandle(&rpc->crpc_replymdh);
+       LNetInvalidateMDHandle(&rpc->crpc_bulk.bk_mdh);
 
         /* no event is expected at this point */
         rpc->crpc_bulkev.ev_fired  =
@@ -579,7 +573,7 @@ swi_state2str (int state)
 do {                                                                   \
        int __I = 2;                                                    \
        while (!(cond)) {                                               \
-               CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET,               \
+               CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET,        \
                       fmt, ## __VA_ARGS__);                            \
                spin_unlock(&(lock));                                   \
                                                                        \