Whamcloud - gitweb
b=16046
[fs/lustre-release.git] / lnet / selftest / selftest.h
index 72cc17a..5038350 100644 (file)
 
 #define LNET_ONLY
 
+#ifndef __KERNEL__
+
+/* XXX workaround XXX */
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+/* TODO: remove these when libcfs provides proper primitives for userspace
+ *
+ * Dummy implementations of spinlock_t and atomic_t work since userspace
+ * selftest is completely single-threaded, even using multi-threaded usocklnd.
+ */
+typedef struct { } spinlock_t;
+static inline void spin_lock(spinlock_t *l) {return;}
+static inline void spin_unlock(spinlock_t *l) {return;}
+static inline void spin_lock_init(spinlock_t *l) {return;}
+
+typedef struct { volatile int counter; } atomic_t;
+#define atomic_read(a) ((a)->counter)
+#define atomic_set(a,b) do {(a)->counter = b; } while (0)
+#define atomic_dec_and_test(a) ((--((a)->counter)) == 0)
+#define atomic_inc(a)  (((a)->counter)++)
+#define atomic_dec(a)  do { (a)->counter--; } while (0)
+
+#endif
+
 #include <libcfs/kp30.h>
 #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"
 
@@ -316,6 +339,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 && \
@@ -347,10 +371,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 */
@@ -377,7 +401,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 */
@@ -516,6 +539,7 @@ swi_state2str (int state)
 #ifndef __KERNEL__
 
 int stt_poll_interval(void);
+int sfw_session_removed(void);
 
 int stt_check_events(void);
 int swi_check_events(void);