RDMA/cxgb3: QP flush fixes
[safe/jmp/linux-2.6] / drivers / infiniband / hw / cxgb3 / iwch_provider.h
index de0fe1b..db5100d 100644 (file)
@@ -73,6 +73,7 @@ struct tpt_attributes {
 
 struct iwch_mr {
        struct ib_mr ibmr;
+       struct ib_umem *umem;
        struct iwch_dev *rhp;
        u64 kva;
        struct tpt_attributes attr;
@@ -117,6 +118,7 @@ enum IWCH_QP_FLAGS {
 };
 
 struct iwch_mpa_attributes {
+       u8 initiator;
        u8 recv_marker_enabled;
        u8 xmit_marker_enabled; /* iWARP: enable inbound Read Resp. */
        u8 crc_enabled;
@@ -212,7 +214,7 @@ static inline struct iwch_mm_entry *remove_mmap(struct iwch_ucontext *ucontext,
                if (mm->key == key && mm->len == len) {
                        list_del_init(&mm->entry);
                        spin_unlock(&ucontext->mmap_lock);
-                       PDBG("%s key 0x%x addr 0x%llx len %d\n", __FUNCTION__,
+                       PDBG("%s key 0x%x addr 0x%llx len %d\n", __func__,
                             key, (unsigned long long) mm->addr, mm->len);
                        return mm;
                }
@@ -225,7 +227,7 @@ static inline void insert_mmap(struct iwch_ucontext *ucontext,
                               struct iwch_mm_entry *mm)
 {
        spin_lock(&ucontext->mmap_lock);
-       PDBG("%s key 0x%x addr 0x%llx len %d\n", __FUNCTION__,
+       PDBG("%s key 0x%x addr 0x%llx len %d\n", __func__,
             mm->key, (unsigned long long) mm->addr, mm->len);
        list_add_tail(&mm->entry, &ucontext->mmaps);
        spin_unlock(&ucontext->mmap_lock);
@@ -286,27 +288,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state)
        }
 }
 
-enum iwch_mem_perms {
-       IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0,
-       IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1,
-       IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2,
-       IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3,
-       IWCH_MEM_ACCESS_ATOMICS = 1 << 4,
-       IWCH_MEM_ACCESS_BINDING = 1 << 5,
-       IWCH_MEM_ACCESS_LOCAL =
-           (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE),
-       IWCH_MEM_ACCESS_REMOTE =
-           (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ)
-           /* cannot go beyond 1 << 31 */
-} __attribute__ ((packed));
-
-static inline u32 iwch_convert_access(int acc)
+static inline u32 iwch_ib_to_tpt_access(int acc)
 {
-       return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0)
-           | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) |
-           (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) |
-           (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) |
-           IWCH_MEM_ACCESS_LOCAL_READ;
+       return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
+              (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) |
+              (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) |
+              TPT_LOCAL_READ;
+}
+
+static inline u32 iwch_ib_to_mwbind_access(int acc)
+{
+       return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) |
+              (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) |
+              (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) |
+              T3_MEM_ACCESS_LOCAL_READ;
 }
 
 enum iwch_mmid_state {
@@ -328,6 +323,7 @@ enum iwch_qp_query_flags {
        IWCH_QP_QUERY_TEST_USERWRITE = 0x32     /* Test special */
 };
 
+u16 iwch_rqes_posted(struct iwch_qp *qhp);
 int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                      struct ib_send_wr **bad_wr);
 int iwch_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
@@ -337,6 +333,7 @@ int iwch_bind_mw(struct ib_qp *qp,
                             struct ib_mw_bind *mw_bind);
 int iwch_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
 int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg);
+int iwch_post_zb_read(struct iwch_qp *qhp);
 int iwch_register_device(struct iwch_dev *dev);
 void iwch_unregister_device(struct iwch_dev *dev);
 int iwch_quiesce_qps(struct iwch_cq *chp);