Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / drivers / infiniband / ulp / isert / ib_isert.h
index b3735a0..8dc8415 100644 (file)
@@ -4,9 +4,37 @@
 #include <rdma/ib_verbs.h>
 #include <rdma/rdma_cm.h>
 
+#define DRV_NAME       "isert"
+#define PFX            DRV_NAME ": "
+
+#define isert_dbg(fmt, arg...)                          \
+       do {                                             \
+               if (unlikely(isert_debug_level > 2))     \
+                       printk(KERN_DEBUG PFX "%s: " fmt,\
+                               __func__ , ## arg);      \
+       } while (0)
+
+#define isert_warn(fmt, arg...)                                \
+       do {                                            \
+               if (unlikely(isert_debug_level > 0))    \
+                       pr_warn(PFX "%s: " fmt,         \
+                               __func__ , ## arg);     \
+       } while (0)
+
+#define isert_info(fmt, arg...)                                \
+       do {                                            \
+               if (unlikely(isert_debug_level > 1))    \
+                       pr_info(PFX "%s: " fmt,         \
+                               __func__ , ## arg);     \
+       } while (0)
+
+#define isert_err(fmt, arg...) \
+       pr_err(PFX "%s: " fmt, __func__ , ## arg)
+
 #define ISERT_RDMA_LISTEN_BACKLOG      10
 #define ISCSI_ISER_SG_TABLESIZE                256
 #define ISER_FASTREG_LI_WRID           0xffffffffffffffffULL
+#define ISER_BEACON_WRID               0xfffffffffffffffeULL
 
 enum isert_desc_type {
        ISCSI_TX_CONTROL,
@@ -122,7 +150,6 @@ struct isert_device;
 struct isert_conn {
        enum iser_conn_state    state;
        int                     post_recv_buf_count;
-       atomic_t                post_send_buf_count;
        u32                     responder_resources;
        u32                     initiator_depth;
        bool                    pi_support;
@@ -155,27 +182,37 @@ struct isert_conn {
        /* lock to protect fastreg pool */
        spinlock_t              conn_lock;
        struct work_struct      release_work;
+       struct ib_recv_wr       beacon;
+       bool                    logout_posted;
 };
 
 #define ISERT_MAX_CQ 64
 
-struct isert_cq_desc {
-       struct isert_device     *device;
-       int                     cq_index;
-       struct work_struct      cq_rx_work;
-       struct work_struct      cq_tx_work;
+/**
+ * struct isert_comp - iSER completion context
+ *
+ * @device:     pointer to device handle
+ * @cq:         completion queue
+ * @wcs:        work completion array
+ * @active_qps: Number of active QPs attached
+ *              to completion context
+ * @work:       completion work handle
+ */
+struct isert_comp {
+       struct isert_device     *device;
+       struct ib_cq            *cq;
+       struct ib_wc             wcs[16];
+       int                      active_qps;
+       struct work_struct       work;
 };
 
 struct isert_device {
        int                     use_fastreg;
        bool                    pi_capable;
-       int                     cqs_used;
        int                     refcount;
-       int                     cq_active_qps[ISERT_MAX_CQ];
        struct ib_device        *ib_device;
-       struct ib_cq            *dev_rx_cq[ISERT_MAX_CQ];
-       struct ib_cq            *dev_tx_cq[ISERT_MAX_CQ];
-       struct isert_cq_desc    *cq_desc;
+       struct isert_comp       *comps;
+       int                     comps_used;
        struct list_head        dev_node;
        struct ib_device_attr   dev_attr;
        int                     (*reg_rdma_mem)(struct iscsi_conn *conn,