[SCSI] be2iscsi: Alloc only one EQ if intr mode
[safe/jmp/linux-2.6] / drivers / scsi / be2iscsi / be.h
index b36020d..136b49c 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
 
 #include <linux/pci.h>
 #include <linux/if_vlan.h>
-
-#define FW_VER_LEN 32
+#include <linux/blk-iopoll.h>
+#define FW_VER_LEN     32
+#define MCC_Q_LEN      128
+#define MCC_CQ_LEN     256
+#define MAX_MCC_CMD    16
+/* BladeEngine Generation numbers */
+#define BE_GEN2 2
+#define BE_GEN3 3
 
 struct be_dma_mem {
        void *va;
@@ -55,6 +61,11 @@ static inline void *queue_head_node(struct be_queue_info *q)
        return q->dma_mem.va + q->head * q->entry_size;
 }
 
+static inline void *queue_get_wrb(struct be_queue_info *q, unsigned int wrb_num)
+{
+       return q->dma_mem.va + wrb_num * q->entry_size;
+}
+
 static inline void *queue_tail_node(struct be_queue_info *q)
 {
        return q->dma_mem.va + q->tail * q->entry_size;
@@ -74,18 +85,14 @@ static inline void queue_tail_inc(struct be_queue_info *q)
 
 struct be_eq_obj {
        struct be_queue_info q;
-       char desc[32];
-
-       /* Adaptive interrupt coalescing (AIC) info */
-       bool enable_aic;
-       u16 min_eqd;            /* in usecs */
-       u16 max_eqd;            /* in usecs */
-       u16 cur_eqd;            /* in usecs */
+       struct beiscsi_hba *phba;
+       struct be_queue_info *cq;
+       struct blk_iopoll       iopoll;
 };
 
 struct be_mcc_obj {
-       struct be_queue_info *q;
-       struct be_queue_info *cq;
+       struct be_queue_info q;
+       struct be_queue_info cq;
 };
 
 struct be_ctrl_info {
@@ -106,15 +113,19 @@ struct be_ctrl_info {
        spinlock_t mcc_lock;    /* For serializing mcc cmds to BE card */
        spinlock_t mcc_cq_lock;
 
-       /* MCC Async callback */
-       void (*async_cb) (void *adapter, bool link_up);
-       void *adapter_ctxt;
+       wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
+       unsigned int mcc_tag[MAX_MCC_CMD];
+       unsigned int mcc_numtag[MAX_MCC_CMD + 1];
+       unsigned short mcc_alloc_index;
+       unsigned short mcc_free_index;
+       unsigned int mcc_tag_available;
 };
 
 #include "be_cmds.h"
 
 #define PAGE_SHIFT_4K 12
 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
+#define mcc_timeout            120000 /* 5s timeout */
 
 /* Returns number of pages spanned by the data starting at the given addr */
 #define PAGES_4K_SPANNED(_address, size)                               \
@@ -176,8 +187,4 @@ static inline void swap_dws(void *wrb, int len)
        } while (len);
 #endif /* __BIG_ENDIAN */
 }
-
-extern void beiscsi_cq_notify(struct be_ctrl_info *ctrl, u16 qid, bool arm,
-                             u16 num_popped);
-
 #endif /* BEISCSI_H */