[SCSI] ibmvfc: Fix deadlock in EH
[pandora-kernel.git] / drivers / scsi / ibmvscsi / ibmvfc.h
index b21e071..3a6a725 100644 (file)
 #include "viosrp.h"
 
 #define IBMVFC_NAME    "ibmvfc"
-#define IBMVFC_DRIVER_VERSION          "1.0.4"
-#define IBMVFC_DRIVER_DATE             "(November 14, 2008)"
+#define IBMVFC_DRIVER_VERSION          "1.0.5"
+#define IBMVFC_DRIVER_DATE             "(March 19, 2009)"
 
 #define IBMVFC_DEFAULT_TIMEOUT 60
+#define IBMVFC_ADISC_CANCEL_TIMEOUT    45
+#define IBMVFC_ADISC_TIMEOUT           15
+#define IBMVFC_ADISC_PLUS_CANCEL_TIMEOUT       \
+               (IBMVFC_ADISC_TIMEOUT + IBMVFC_ADISC_CANCEL_TIMEOUT)
 #define IBMVFC_INIT_TIMEOUT            120
 #define IBMVFC_MAX_REQUESTS_DEFAULT    100
 
@@ -53,9 +57,9 @@
  * Ensure we have resources for ERP and initialization:
  * 1 for ERP
  * 1 for initialization
- * 1 for each discovery thread
+ * 2 for each discovery thread
  */
-#define IBMVFC_NUM_INTERNAL_REQ        (1 + 1 + disc_threads)
+#define IBMVFC_NUM_INTERNAL_REQ        (1 + 1 + (disc_threads * 2))
 
 #define IBMVFC_MAD_SUCCESS             0x00
 #define IBMVFC_MAD_NOT_SUPPORTED       0xF1
@@ -571,7 +575,6 @@ enum ibmvfc_target_action {
        IBMVFC_TGT_ACTION_NONE = 0,
        IBMVFC_TGT_ACTION_INIT,
        IBMVFC_TGT_ACTION_INIT_WAIT,
-       IBMVFC_TGT_ACTION_ADD_RPORT,
        IBMVFC_TGT_ACTION_DEL_RPORT,
 };
 
@@ -584,11 +587,14 @@ struct ibmvfc_target {
        int target_id;
        enum ibmvfc_target_action action;
        int need_login;
+       int add_rport;
        int init_retries;
+       u32 cancel_key;
        struct ibmvfc_service_parms service_parms;
        struct ibmvfc_service_parms service_parms_change;
        struct fc_rport_identifiers ids;
        void (*job_step) (struct ibmvfc_target *);
+       struct timer_list timer;
        struct kref kref;
 };
 
@@ -629,7 +635,6 @@ enum ibmvfc_host_action {
        IBMVFC_HOST_ACTION_ALLOC_TGTS,
        IBMVFC_HOST_ACTION_TGT_INIT,
        IBMVFC_HOST_ACTION_TGT_DEL_FAILED,
-       IBMVFC_HOST_ACTION_TGT_ADD,
 };
 
 enum ibmvfc_host_state {
@@ -672,9 +677,11 @@ struct ibmvfc_host {
        int task_set;
        int init_retries;
        int discovery_threads;
+       int abort_threads;
        int client_migrated;
        int reinit;
        int delay_init;
+       int scan_complete;
        int events_to_log;
 #define IBMVFC_AE_LINKUP       0x0001
 #define IBMVFC_AE_LINKDOWN     0x0002
@@ -684,6 +691,8 @@ struct ibmvfc_host {
        char partition_name[97];
        void (*job_step) (struct ibmvfc_host *);
        struct task_struct *work_thread;
+       struct tasklet_struct tasklet;
+       struct work_struct rport_add_work_q;
        wait_queue_head_t init_wait_q;
        wait_queue_head_t work_wait_q;
 };
@@ -699,6 +708,12 @@ struct ibmvfc_host {
 #define tgt_err(t, fmt, ...)           \
        dev_err((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)
 
+#define tgt_log(t, level, fmt, ...) \
+       do { \
+               if ((t)->vhost->log_level >= level) \
+                       tgt_err(t, fmt, ##__VA_ARGS__); \
+       } while (0)
+
 #define ibmvfc_dbg(vhost, ...) \
        DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__))