Whamcloud - gitweb
brw_check_page(): suppress "use before initialization" compiler warning.
[fs/lustre-release.git] / lnet / selftest / selftest.h
index b759e6a..96ccb52 100644 (file)
@@ -1,25 +1,62 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *   Author: Isaac Huang <isaac@clusterfs.com>
+ * GPL HEADER START
  *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * 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.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/selftest/selftest.h
+ *
+ * Author: Isaac Huang <isaac@clusterfs.com>
  */
 #ifndef __SELFTEST_SELFTEST_H__
 #define __SELFTEST_SELFTEST_H__
 
 #define LNET_ONLY
 
-#include <libcfs/kp30.h>
+#ifndef __KERNEL__
+
+/* XXX workaround XXX */
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#endif
 #include <libcfs/libcfs.h>
 #include <lnet/lnet.h>
+#include <lnet/lib-lnet.h>
 #include <lnet/lib-types.h>
 #include <lnet/lnetst.h>
 
-#ifndef __KERNEL__
-#include <liblustre.h> /* userland spinlock_t and atomic_t */
-#endif
-
 #include "rpc.h"
 #include "timer.h"
 
@@ -35,6 +72,7 @@
 #define SWI_STATE_REQUEST_SENT             4
 #define SWI_STATE_REPLY_RECEIVED           5
 #define SWI_STATE_BULK_STARTED             6
+#define SWI_STATE_BULK_ERRORED             7
 #define SWI_STATE_DONE                     10
 
 /* forward refs */
@@ -50,11 +88,11 @@ struct sfw_test_instance;
  *   serialized with respect to itself.
  * - no CPU affinity, a workitem does not necessarily run on the same CPU
  *   that schedules it. However, this might change in the future.
- * - if a workitem is scheduled again before it has a chance to run, it 
+ * - if a workitem is scheduled again before it has a chance to run, it
  *   runs only once.
- * - if a workitem is scheduled while it runs, it runs again after it 
- *   completes; this ensures that events occurring while other events are 
- *   being processed receive due attention. This behavior also allows a 
+ * - if a workitem is scheduled while it runs, it runs again after it
+ *   completes; this ensures that events occurring while other events are
+ *   being processed receive due attention. This behavior also allows a
  *   workitem to reschedule itself.
  *
  * Usage notes:
@@ -316,6 +354,7 @@ typedef struct {
         struct list_head  sn_batches; /* list of batches */
         char              sn_name[LST_NAME_SIZE];
         atomic_t          sn_brw_errors;
+        atomic_t          sn_ping_errors;
 } sfw_session_t;
 
 #define sfw_sid_equal(sid0, sid1)     ((sid0).ses_nid == (sid1).ses_nid && \
@@ -333,7 +372,7 @@ typedef struct {
 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,     
+        int  (*tso_prep_rpc)(struct sfw_test_unit *tsu,
                              lnet_process_id_t dest,
                              srpc_client_rpc_t **rpc);   /* prep a tests rpc */
         void (*tso_done_rpc)(struct sfw_test_unit *tsu,
@@ -347,10 +386,10 @@ typedef struct sfw_test_instance {
         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_stop_onerr:1; /* stop on error */
-        int                     tsi_concur;       /* concurrency */
-        int                     tsi_loop;         /* loop count */
+        int                     tsi_is_client:1;     /* is test client */
+        int                     tsi_stoptsu_onerr:1; /* stop tsu on error */
+        int                     tsi_concur;          /* concurrency */
+        int                     tsi_loop;            /* loop count */
 
         /* status of test instance */
         spinlock_t              tsi_lock;         /* serialize */
@@ -366,7 +405,7 @@ typedef struct sfw_test_instance {
         } tsi_u;
 } sfw_test_instance_t;
 
-/* XXX: trailing (CFS_PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at 
+/* XXX: trailing (CFS_PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at
  * the end of pages are not used */
 #define SFW_MAX_CONCUR     LST_MAX_CONCUR
 #define SFW_ID_PER_PAGE    (CFS_PAGE_SIZE / sizeof(lnet_process_id_t))
@@ -377,7 +416,6 @@ 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 */
         int                     tsu_loop;         /* loop count of the test */
-        int                     tsu_error;        /* error code */
         sfw_test_instance_t    *tsu_instance;     /* pointer to test instance */
         void                   *tsu_private;      /* private data */
         swi_workitem_t          tsu_worker;       /* workitem of the test unit */
@@ -404,7 +442,7 @@ 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 npages, int sink);
 
 srpc_client_rpc_t *
-srpc_create_client_rpc(lnet_process_id_t peer, int service, 
+srpc_create_client_rpc(lnet_process_id_t peer, int service,
                        int nbulkiov, int bulklen,
                        void (*rpc_done)(srpc_client_rpc_t *),
                        void (*rpc_fini)(srpc_client_rpc_t *), void *priv);
@@ -492,12 +530,12 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer,
         return;
 }
 
-static inline const char * 
+static inline const char *
 swi_state2str (int state)
 {
 #define STATE2STR(x) case x: return #x
         switch(state) {
-                default: 
+                default:
                         LBUG();
                 STATE2STR(SWI_STATE_NEWBORN);
                 STATE2STR(SWI_STATE_REPLY_SUBMITTED);
@@ -506,6 +544,7 @@ swi_state2str (int state)
                 STATE2STR(SWI_STATE_REQUEST_SENT);
                 STATE2STR(SWI_STATE_REPLY_RECEIVED);
                 STATE2STR(SWI_STATE_BULK_STARTED);
+                STATE2STR(SWI_STATE_BULK_ERRORED);
                 STATE2STR(SWI_STATE_DONE);
         }
 #undef STATE2STR
@@ -517,7 +556,6 @@ swi_state2str (int state)
 
 int stt_poll_interval(void);
 int sfw_session_removed(void);
-void sfw_set_session_timeout(int timeout);
 
 int stt_check_events(void);
 int swi_check_events(void);